1 | /* |
2 | * Copyright (C) 1995 Paul Olav Tvete <paul@troll.no> |
3 | * Copyright (C) 2000-2009 Stephan Kulow <coolo@kde.org> |
4 | * |
5 | * License of original code: |
6 | * ------------------------------------------------------------------------- |
7 | * Permission to use, copy, modify, and distribute this software and its |
8 | * documentation for any purpose and without fee is hereby granted, |
9 | * provided that the above copyright notice appear in all copies and that |
10 | * both that copyright notice and this permission notice appear in |
11 | * supporting documentation. |
12 | * |
13 | * This file is provided AS IS with no warranties of any kind. The author |
14 | * shall have no liability with respect to the infringement of copyrights, |
15 | * trade secrets or any patents by this file or any part thereof. In no |
16 | * event will the author be liable for any lost revenue or profits or |
17 | * other special, indirect and consequential damages. |
18 | * ------------------------------------------------------------------------- |
19 | * |
20 | * License of modifications/additions made after 2009-01-01: |
21 | * ------------------------------------------------------------------------- |
22 | * This program is free software; you can redistribute it and/or |
23 | * modify it under the terms of the GNU General Public License as |
24 | * published by the Free Software Foundation; either version 2 of |
25 | * the License, or (at your option) any later version. |
26 | * |
27 | * This program is distributed in the hope that it will be useful, |
28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
30 | * GNU General Public License for more details. |
31 | * |
32 | * You should have received a copy of the GNU General Public License |
33 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
34 | * ------------------------------------------------------------------------- |
35 | */ |
36 | |
37 | #ifndef HINT_H |
38 | #define HINT_H |
39 | |
40 | #include <QList> |
41 | |
42 | class KCard; |
43 | class PatPile; |
44 | |
45 | |
46 | class MoveHint |
47 | { |
48 | public: |
49 | MoveHint() |
50 | : m_card( 0 ), |
51 | m_to( 0 ), |
52 | m_priority( 0 ) |
53 | { |
54 | } |
55 | |
56 | MoveHint( KCard * card, PatPile * to, int prio ) |
57 | : m_card( card ), |
58 | m_to( to ), |
59 | m_priority( prio ) |
60 | { |
61 | Q_ASSERT( card ); |
62 | Q_ASSERT( to ); |
63 | } |
64 | |
65 | KCard * card() const |
66 | { |
67 | return m_card; |
68 | } |
69 | |
70 | PatPile * pile() const |
71 | { |
72 | return m_to; |
73 | } |
74 | |
75 | int priority() const |
76 | { |
77 | return m_priority; |
78 | } |
79 | |
80 | bool isValid() const |
81 | { |
82 | return m_card && m_to; |
83 | } |
84 | |
85 | bool operator<( const MoveHint & other ) const |
86 | { |
87 | return m_priority < other.m_priority; |
88 | } |
89 | |
90 | private: |
91 | KCard * m_card; |
92 | PatPile * m_to; |
93 | int m_priority; |
94 | }; |
95 | |
96 | #endif |
97 | |