summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4ea7496)
raw | patch | inline | side by side (parent: 4ea7496)
author | mental <mental@users.sourceforge.net> | |
Tue, 1 Jul 2008 23:08:09 +0000 (23:08 +0000) | ||
committer | mental <mental@users.sourceforge.net> | |
Tue, 1 Jul 2008 23:08:09 +0000 (23:08 +0000) |
src/xml/node.h | patch | blob | history | |
src/xml/simple-node.cpp | patch | blob | history | |
src/xml/simple-node.h | patch | blob | history |
diff --git a/src/xml/node.h b/src/xml/node.h
index 1b3f18a91746b983f46255281abd91ddb0e9a062..aac2db191fcf4beb31cf827a4c1d414532cfe486 100644 (file)
--- a/src/xml/node.h
+++ b/src/xml/node.h
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;
};
}
index 3d82eed01068140216fc8a4a8a37dd88a543eef9..a229c33fe124be7917efafbb690c2c8aab439b80 100644 (file)
--- a/src/xml/simple-node.cpp
+++ b/src/xml/simple-node.cpp
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) {
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 1d87c6db1adfbc877c674eba42e440c869e23ee2..98d363f3487269ead181fda29094162ecf212056 100644 (file)
--- a/src/xml/simple-node.h
+++ b/src/xml/simple-node.h
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;