summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMenTaLguY <mental@rydia.net>2008-07-01 23:08:09 +0000
committermental <mental@users.sourceforge.net>2008-07-01 23:08:09 +0000
commita4581c7c3ab44b2fee82e71c1b0d2c3daaef51d6 (patch)
treee8ab52400a3dd17de07b8717edf95660caf030df /src
parentremove additional unnecessary indirection in tree operations (diff)
downloadinkscape-a4581c7c3ab44b2fee82e71c1b0d2c3daaef51d6.tar.gz
inkscape-a4581c7c3ab44b2fee82e71c1b0d2c3daaef51d6.zip
remove "public private" virtual methods from XML::Node
(bzr r6110)
Diffstat (limited to 'src')
-rw-r--r--src/xml/node.h9
-rw-r--r--src/xml/simple-node.cpp11
-rw-r--r--src/xml/simple-node.h14
3 files changed, 8 insertions, 26 deletions
diff --git a/src/xml/node.h b/src/xml/node.h
index 1b3f18a91..aac2db191 100644
--- a/src/xml/node.h
+++ b/src/xml/node.h
@@ -103,15 +103,6 @@ public:
protected:
Node(Node const &) : Anchored() {}
-
-public: // ideally these should be protected too somehow...
- virtual NodeObserver &_subtreeObservers()=0;
- virtual void _setParent(Node *parent)=0;
- virtual void _setNext(Node *next)=0;
-
- virtual unsigned _childPosition(Node const &child) const=0;
- virtual unsigned _cachedPosition() const=0;
- virtual void _setCachedPosition(unsigned position) const=0;
};
}
diff --git a/src/xml/simple-node.cpp b/src/xml/simple-node.cpp
index 3d82eed01..a229c33fe 100644
--- a/src/xml/simple-node.cpp
+++ b/src/xml/simple-node.cpp
@@ -240,18 +240,18 @@ unsigned SimpleNode::position() const {
return _parent->_childPosition(*this);
}
-unsigned SimpleNode::_childPosition(Node const &child) const {
+unsigned SimpleNode::_childPosition(SimpleNode const &child) const {
if (!_cached_positions_valid) {
unsigned position=0;
for ( SimpleNode *sibling = _first_child ;
sibling ; sibling = sibling->_next )
{
- sibling->_setCachedPosition(position);
+ sibling->_cached_position = position;
position++;
}
_cached_positions_valid = true;
}
- return child._cachedPosition();
+ return child._cached_position;
}
Node *SimpleNode::nthChild(unsigned index) {
@@ -277,10 +277,9 @@ bool SimpleNode::matchAttributeName(gchar const *partial_name) const {
return false;
}
-void SimpleNode::_setParent(Node *generic_parent) {
- SimpleNode *parent = dynamic_cast<SimpleNode *>(generic_parent);
+void SimpleNode::_setParent(SimpleNode *parent) {
if (_parent) {
- _subtree_observers.remove(dynamic_cast<SimpleNode *>(_parent)->_subtree_observers);
+ _subtree_observers.remove(_parent->_subtree_observers);
}
_parent = parent;
if (parent) {
diff --git a/src/xml/simple-node.h b/src/xml/simple-node.h
index 1d87c6db1..98d363f34 100644
--- a/src/xml/simple-node.h
+++ b/src/xml/simple-node.h
@@ -118,20 +118,12 @@ protected:
virtual SimpleNode *_duplicate(Document *doc) const=0;
-public: // ideally these should be protected somehow...
- NodeObserver &_subtreeObservers() { return _subtree_observers; }
- void _setParent(Node *parent);
- void _setNext(Node *next) { _next = dynamic_cast<SimpleNode *>(next); }
-
- unsigned _childPosition(Node const &child) const;
- unsigned _cachedPosition() const { return _cached_position; }
- void _setCachedPosition(unsigned position) const {
- _cached_position = position;
- }
-
private:
void operator=(Node const &); // no assign
+ void _setParent(SimpleNode *parent);
+ unsigned _childPosition(SimpleNode const &child) const;
+
SimpleNode *_parent;
SimpleNode *_next;
Document *_document;