Code

Fix variable name legibility.
[inkscape.git] / src / xml / simple-node.h
index 3bd2f58b4f9aa3d2d134f6f529145525e99c9792..67070d0fceb05db834f1639f4b3ee01d4d2b26ee 100644 (file)
@@ -1,7 +1,7 @@
-/*
- * SimpleNode - generic XML node implementation
- *
- * Copyright 2004-2005 MenTaLguY <mental@rydia.net>
+/** @file
+ * @brief GC-managed XML node implementation
+ */
+/* Copyright 2004-2005 MenTaLguY <mental@rydia.net>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -9,13 +9,16 @@
  * of the License, or (at your option) any later version.
  *
  * See the file COPYING for details.
- *
  */
 
+#ifndef SEEN_INKSCAPE_XML_NODE_H
+#error  You have included xml/simple-node.h in your document, which is an implementation.  Chances are that you want xml/node.h.  Please fix that.
+#endif
+
 #ifndef SEEN_INKSCAPE_XML_SIMPLE_NODE_H
 #define SEEN_INKSCAPE_XML_SIMPLE_NODE_H
 
-#include <glib/gtestutils.h>
+#include <glib.h> // g_assert()
 
 #include "xml/node.h"
 #include "xml/attribute-record.h"
@@ -26,6 +29,11 @@ namespace Inkscape {
 
 namespace XML {
 
+/**
+ * @brief Default implementation of the XML node stored in memory.
+ *
+ * @see Inkscape::XML::Node
+ */
 class SimpleNode
 : virtual public Node, public Inkscape::GC::Managed<>
 {
@@ -113,28 +121,19 @@ public:
     }
 
 protected:
-    SimpleNode(int code);
-    SimpleNode(SimpleNode const &repr);
+    SimpleNode(int code, Document *document);
+    SimpleNode(SimpleNode const &repr, Document *document);
 
     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 = next; }
-    void _bindDocument(Document &document);
-
-    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
 
-    Node *_parent;
-    Node *_next;
+    void _setParent(SimpleNode *parent);
+    unsigned _childPosition(SimpleNode const &child) const;
+
+    SimpleNode *_parent;
+    SimpleNode *_next;
     Document *_document;
     mutable unsigned _cached_position;
 
@@ -146,8 +145,8 @@ private:
 
     unsigned _child_count;
     mutable bool _cached_positions_valid;
-    Node *_first_child;
-    Node *_last_child;
+    SimpleNode *_first_child;
+    SimpleNode *_last_child;
 
     CompositeNodeObserver _observers;
     CompositeNodeObserver _subtree_observers;