[kad-general] [PATCH] Removes-some-qcad-style-rtti |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/kad-general Archives
]
From 1a394e703334ba0dc952090ae3afe699b520e1e9 Mon Sep 17 00:00:00 2001
From: Riccardo Gori <goric@xxxxxxxxxxx>
Date: Mon, 31 Mar 2008 17:56:13 +0200
Subject: [PATCH] Removes some qcad style rtti
---
qcadlib/src/engine/rs_document.h | 2 +-
qcadlib/src/engine/rs_undoable.h | 9 ---------
qcadlib/src/engine/rs_undocycle.h | 20 ++++++++++----------
3 files changed, 11 insertions(+), 20 deletions(-)
diff --git a/qcadlib/src/engine/rs_document.h b/qcadlib/src/engine/rs_document.h
index 04ec9f3..0a7d9d9 100644
--- a/qcadlib/src/engine/rs_document.h
+++ b/qcadlib/src/engine/rs_document.h
@@ -69,7 +69,7 @@ public:
* from RS_Undo.
*/
virtual void removeUndoable(RS_Undoable* u) {
- if (u!=NULL && u->undoRtti()==RS2::UndoableEntity) {
+ if (u!=NULL && typeid(u)==typeid(RS_Entity*)) {
removeEntity((RS_Entity*)u);
}
}
diff --git a/qcadlib/src/engine/rs_undoable.h b/qcadlib/src/engine/rs_undoable.h
index 436e9e0..dd81c4f 100644
--- a/qcadlib/src/engine/rs_undoable.h
+++ b/qcadlib/src/engine/rs_undoable.h
@@ -46,15 +46,6 @@ public:
RS_Undoable();
virtual ~RS_Undoable();
- /**
- * Runtime type identification for undoables.
- * Note that this is voluntarily. The default implementation
- * returns RS2::UndoableUnknown.
- */
- virtual RS2::UndoableType undoRtti() {
- return RS2::UndoableUnknown;
- }
-
virtual void setUndoCycle(RS_UndoCycle* cycle);
virtual void changeUndoState();
virtual void setUndoState(bool undone);
diff --git a/qcadlib/src/engine/rs_undocycle.h b/qcadlib/src/engine/rs_undocycle.h
index 2b7fb87..b848535 100644
--- a/qcadlib/src/engine/rs_undocycle.h
+++ b/qcadlib/src/engine/rs_undocycle.h
@@ -59,7 +59,7 @@ public:
* Adds an Undoable to this Undo Cycle. Every Cycle can contain one or
* more Undoables.
*/
- void addUndoable(const RS_Undoable* u) {
+ void addUndoable(RS_Undoable* u) {
undoables.append(u);
}
@@ -78,20 +78,20 @@ public:
}
/**
- * Iteration through undoable elements in this item.
+ * Return the undoable list size
*/
- RS_Undoable* getNextUndoable() {
- return undoables.next();
+ int size() const {
+ return undoables.size();
}
friend std::ostream& operator << (std::ostream& os,
- RS_UndoCycle& i) {
+ RS_UndoCycle& cycle) {
os << " Undo item: " << "\n";
os << " Undoable ids: ";
- for (RS_Undoable* u=i.getFirstUndoable();
- u!=NULL; u=i.getNextUndoable()) {
-
- if (u->undoRtti()==RS2::UndoableEntity) {
+ const RS_Undoable* u = 0;
+ for (int i = 0; i < cycle.size(); ++i) {
+ u = cycle.undoables.at(i);
+ if (typeid(u)==typeid(RS_Entity*)) {
RS_Entity* e = (RS_Entity*)u;
os << e->getId() << (u->isUndone() ? "*" : "") << " ";
} else {
@@ -106,7 +106,7 @@ public:
private:
//! List of entity id's that were affected by this action
- QList<const RS_Undoable*> undoables;
+ QList<RS_Undoable*> undoables;
};
#endif
--
1.5.3.7