3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
10 // JLH = James L. Hammons <jlhamm@acm.org>
13 // --- ---------- -----------------------------------------------------------
14 // JLH 05/05/2010 Moved implementation from header to this file. :-)
17 #include "undocycle.h"
23 * @param type Type of undo item.
25 UndoCycle::UndoCycle(/*RS2::UndoType type*/): undoableIterator(undoables)
28 // Good, we don't have to worry about this...
29 // undoables.setAutoDelete(false);
33 * Adds an Undoable to this Undo Cycle. Every Cycle can contain one or
36 void UndoCycle::addUndoable(Undoable * u)
42 * Removes an undoable from the list.
44 void UndoCycle::removeUndoable(Undoable * u)
46 // undoables.remove(u);
47 int i = undoables.indexOf(u);
52 * Iteration through undoable elements in this item.
54 Undoable * UndoCycle::getFirstUndoable()
56 // return undoables.first();
57 undoableIterator.toFront();
58 return undoableIterator.next();
62 * Iteration through undoable elements in this item.
64 Undoable * UndoCycle::getNextUndoable()
66 // return undoables.next();
67 return undoableIterator.next();
70 /*friend*/ std::ostream & operator<<(std::ostream & os, UndoCycle & i)
72 os << " Undo item: " << "\n";
82 os << " Undoable ids: ";
84 for(Undoable * u=i.getFirstUndoable(); u!=NULL; u=i.getNextUndoable())
86 if (u->undoRtti() == RS2::UndoableEntity)
88 Entity * e = (Entity *)u;
89 os << e->getId() << (u->isUndone() ? "*" : "") << " ";