File indexing completed on 2024-05-12 08:00:33
0001 /* 0002 * Copyright (C) 1995 Paul Olav Tvete <paul@troll.no> 0003 * Copyright (C) 2000-2009 Stephan Kulow <coolo@kde.org> 0004 * 0005 * License of original code: 0006 * ------------------------------------------------------------------------- 0007 * Permission to use, copy, modify, and distribute this software and its 0008 * documentation for any purpose and without fee is hereby granted, 0009 * provided that the above copyright notice appear in all copies and that 0010 * both that copyright notice and this permission notice appear in 0011 * supporting documentation. 0012 * 0013 * This file is provided AS IS with no warranties of any kind. The author 0014 * shall have no liability with respect to the infringement of copyrights, 0015 * trade secrets or any patents by this file or any part thereof. In no 0016 * event will the author be liable for any lost revenue or profits or 0017 * other special, indirect and consequential damages. 0018 * ------------------------------------------------------------------------- 0019 * 0020 * License of modifications/additions made after 2009-01-01: 0021 * ------------------------------------------------------------------------- 0022 * This program is free software; you can redistribute it and/or 0023 * modify it under the terms of the GNU General Public License as 0024 * published by the Free Software Foundation; either version 2 of 0025 * the License, or (at your option) any later version. 0026 * 0027 * This program is distributed in the hope that it will be useful, 0028 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0029 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0030 * GNU General Public License for more details. 0031 * 0032 * You should have received a copy of the GNU General Public License 0033 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0034 * ------------------------------------------------------------------------- 0035 */ 0036 0037 #ifndef HINT_H 0038 #define HINT_H 0039 0040 #include <QtGlobal> 0041 0042 class KCard; 0043 class PatPile; 0044 0045 class MoveHint 0046 { 0047 public: 0048 MoveHint() 0049 : m_card(nullptr) 0050 , m_to(nullptr) 0051 , m_priority(0) 0052 { 0053 } 0054 0055 MoveHint(KCard *card, PatPile *to, int prio) 0056 : m_card(card) 0057 , m_to(to) 0058 , m_priority(prio) 0059 { 0060 Q_ASSERT(card); 0061 Q_ASSERT(to); 0062 } 0063 0064 KCard *card() const 0065 { 0066 return m_card; 0067 } 0068 0069 PatPile *pile() const 0070 { 0071 return m_to; 0072 } 0073 0074 int priority() const 0075 { 0076 return m_priority; 0077 } 0078 0079 bool isValid() const 0080 { 0081 return m_card && m_to; 0082 } 0083 0084 bool operator<(const MoveHint &other) const 0085 { 0086 return m_priority < other.m_priority; 0087 } 0088 0089 private: 0090 KCard *m_card; 0091 PatPile *m_to; 0092 int m_priority; 0093 }; 0094 0095 #endif