Code

Extensions. Barcode extension refactoring (see https://code.launchpad.net/~doctormo...
[inkscape.git] / src / xml / simple-document.cpp
index e8c652b2deaa45eeb2098e6443bfa96ed1fc273b..2807133affe68a5bc4951ca352dba6be3d816cc7 100644 (file)
@@ -1,7 +1,7 @@
-/*
- * Inkscape::XML::SimpleDocument - generic XML document implementation
- *
- * Copyright 2004-2005 MenTaLguY <mental@rydia.net>
+/** @file
+ * @brief Garbage collected XML document 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
  *
  */
 
+#include <glib.h> // g_assert()
+
 #include "xml/simple-document.h"
 #include "xml/event-fns.h"
 #include "xml/element-node.h"
 #include "xml/text-node.h"
 #include "xml/comment-node.h"
+#include "xml/pi-node.h"
 
 namespace Inkscape {
 
 namespace XML {
 
-void SimpleDocument::_initBindings() {
-    _bindDocument(*this);
-}
-
 void SimpleDocument::beginTransaction() {
     g_assert(!_in_transaction);
     _in_transaction = true;
@@ -51,16 +50,20 @@ Inkscape::XML::Event *SimpleDocument::commitUndoable() {
     return _log_builder.detach();
 }
 
-Node *SimpleDocument::createElementNode(char const *name) {
-    return new ElementNode(g_quark_from_string(name));
+Node *SimpleDocument::createElement(char const *name) {
+    return new ElementNode(g_quark_from_string(name), this);
 }
 
 Node *SimpleDocument::createTextNode(char const *content) {
-    return new TextNode(Util::share_string(content));
+    return new TextNode(Util::share_string(content), this);
+}
+
+Node *SimpleDocument::createComment(char const *content) {
+    return new CommentNode(Util::share_string(content), this);
 }
 
-Node *SimpleDocument::createCommentNode(char const *content) {
-    return new CommentNode(Util::share_string(content));
+Node *SimpleDocument::createPI(char const *target, char const *content) {
+    return new PINode(g_quark_from_string(target), Util::share_string(content), this);
 }
 
 void SimpleDocument::notifyChildAdded(Node &parent,
@@ -123,4 +126,4 @@ void SimpleDocument::notifyAttributeChanged(Node &node,
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :