14 * |
14 * |
15 * You should have received a copy of the GNU General Public License |
15 * You should have received a copy of the GNU General Public License |
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 */ |
17 */ |
18 |
18 |
19 #ifndef HISTORY_H |
19 #ifndef LDFORGE_HISTORY_H |
20 #define HISTORY_H |
20 #define LDFORGE_HISTORY_H |
21 |
21 |
22 #include "common.h" |
22 #include "common.h" |
23 #include "ldtypes.h" |
23 #include "ldtypes.h" |
24 |
24 |
25 #define IMPLEMENT_HISTORY_TYPE(N) \ |
25 #define IMPLEMENT_HISTORY_TYPE(N) \ |
55 |
55 |
56 void open(); |
56 void open(); |
57 void close(); |
57 void close(); |
58 void add (AbstractHistoryEntry* entry); |
58 void add (AbstractHistoryEntry* entry); |
59 |
59 |
60 inline long size() const |
60 inline long getSize() const |
61 { return m_changesets.size(); |
61 { return m_changesets.size(); |
62 } |
62 } |
63 |
63 |
64 inline History& operator<< (AbstractHistoryEntry* entry) |
64 inline History& operator<< (AbstractHistoryEntry* entry) |
65 { add (entry); |
65 { add (entry); |
66 return *this; |
66 return *this; |
67 } |
67 } |
68 |
68 |
69 inline const Changeset& changeset (long pos) const |
69 inline const Changeset& getChangeset (long pos) const |
70 { return m_changesets[pos]; |
70 { return m_changesets[pos]; |
71 } |
71 } |
72 |
72 |
73 private: |
73 private: |
74 Changeset m_currentArchive; |
74 Changeset m_currentArchive; |
166 MoveHistory (QList<int> indices, vertex dest) : |
166 MoveHistory (QList<int> indices, vertex dest) : |
167 indices (indices), |
167 indices (indices), |
168 dest (dest) {} |
168 dest (dest) {} |
169 }; |
169 }; |
170 |
170 |
|
171 // ============================================================================= |
|
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
|
173 // ============================================================================= |
171 class SwapHistory : public AbstractHistoryEntry |
174 class SwapHistory : public AbstractHistoryEntry |
172 { public: |
175 { public: |
173 IMPLEMENT_HISTORY_TYPE (Swap) |
176 IMPLEMENT_HISTORY_TYPE (Swap) |
174 int a, b; |
177 int a, b; |
175 |
178 |
176 SwapHistory (int a, int b) : |
179 SwapHistory (int a, int b) : |
177 a (a), |
180 a (a), |
178 b (b) {} |
181 b (b) {} |
179 }; |
182 }; |
180 |
183 |
181 #endif // HISTORY_H |
184 #endif // LDFORGE_HISTORY_H |