summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3266678)
raw | patch | inline | side by side (parent: 3266678)
author | mental <mental@users.sourceforge.net> | |
Sun, 8 Jun 2008 19:44:26 +0000 (19:44 +0000) | ||
committer | mental <mental@users.sourceforge.net> | |
Sun, 8 Jun 2008 19:44:26 +0000 (19:44 +0000) |
diff --git a/src/jabber_whiteboard/inkboard-document.cpp b/src/jabber_whiteboard/inkboard-document.cpp
index dd039ab6fd1b08bbdfa8b062f6da7ee1569c2738..7e4afff8d0ed9cada79135d468b4e063cc0f9aca 100644 (file)
InkboardDocument::InkboardDocument(int code, State::SessionType sessionType,
Glib::ustring const& to)
-: XML::SimpleNode(code), sessionType(sessionType), recipient(to),
+: XML::SimpleNode(code, NULL), sessionType(sessionType), recipient(to),
_in_transaction(false)
{
_initBindings();
XML::Node*
InkboardDocument::createElement(char const* name)
{
- return new XML::ElementNode(g_quark_from_string(name));
+ return new XML::ElementNode(g_quark_from_string(name), this);
}
XML::Node*
InkboardDocument::createTextNode(char const* content)
{
- return new XML::TextNode(Util::share_string(content));
+ return new XML::TextNode(Util::share_string(content), this);
}
XML::Node*
InkboardDocument::createComment(char const* content)
{
- return new XML::CommentNode(Util::share_string(content));
+ return new XML::CommentNode(Util::share_string(content), this);
}
XML::Node*
InkboardDocument::createPI(char const *target, char const* content)
{
- return new XML::PINode(g_quark_from_string(target), Util::share_string(content));
+ return new XML::PINode(g_quark_from_string(target), Util::share_string(content), this);
}
index d3d5685513b577c27da6fa778a4de4c547de6e77..e6eee7304eab1739c682fecbca4286912eb5ac7f 100644 (file)
if(name == "text")
{
XML::Node *parent = this->tracker->get(parentid);
- XML::Node *node = new XML::TextNode(Util::share_string(data->getValue().c_str()));
+ XML::Node *node = new XML::TextNode(Util::share_string(data->getValue().c_str()), this);
if(parent && node)
{
}
}else
{
- XML::Node *node = new XML::ElementNode(g_quark_from_string(name.c_str()));
+ XML::Node *node = new XML::ElementNode(g_quark_from_string(name.c_str()), this);
this->tracker->put(id,node);
XML::Node *parent = (parentid != "ROOT")
diff --git a/src/xml/comment-node.h b/src/xml/comment-node.h
index 4be09ec858fd0fc82295224898b07b58ff4dfe92..5cff9caf6f218e28faee4fe3233f6cc916fa61ee 100644 (file)
--- a/src/xml/comment-node.h
+++ b/src/xml/comment-node.h
namespace XML {
struct CommentNode : public SimpleNode {
- explicit CommentNode(Util::ptr_shared<char> content)
- : SimpleNode(g_quark_from_static_string("comment"))
+ CommentNode(Util::ptr_shared<char> content, Document *doc)
+ : SimpleNode(g_quark_from_static_string("comment"), doc)
{
setContent(content);
}
+ CommentNode(CommentNode const &other, Document *doc)
+ : SimpleNode(other, doc) {}
+
Inkscape::XML::NodeType type() const { return Inkscape::XML::COMMENT_NODE; }
protected:
- SimpleNode *_duplicate(Document* /*doc*/) const { return new CommentNode(*this); }
+ SimpleNode *_duplicate(Document* doc) const { return new CommentNode(*this, doc); }
};
}
diff --git a/src/xml/element-node.h b/src/xml/element-node.h
index 1b79910a83e21051ca142b463e32bcb0d5c3b1bb..11bc8e03a34eb59bf29eb53a46b74c03b3f999f3 100644 (file)
--- a/src/xml/element-node.h
+++ b/src/xml/element-node.h
class ElementNode : public SimpleNode {
public:
- explicit ElementNode(int code)
- : SimpleNode(code) {}
+ ElementNode(int code, Document *doc)
+ : SimpleNode(code, doc) {}
+ ElementNode(ElementNode const &other, Document *doc)
+ : SimpleNode(other, doc) {}
Inkscape::XML::NodeType type() const { return Inkscape::XML::ELEMENT_NODE; }
protected:
- SimpleNode *_duplicate(Document* /*doc*/) const { return new ElementNode(*this); }
+ SimpleNode *_duplicate(Document* doc) const { return new ElementNode(*this, doc); }
};
}
diff --git a/src/xml/pi-node.h b/src/xml/pi-node.h
index b89ef25a03169f4b60a086d283cc5a5764bd7d11..502c5cd714e388cb19ec92dfe30fe68f0194f8d6 100644 (file)
--- a/src/xml/pi-node.h
+++ b/src/xml/pi-node.h
namespace XML {
struct PINode : public SimpleNode {
- explicit PINode(GQuark target, Util::ptr_shared<char> content)
- : SimpleNode(target)
+ PINode(GQuark target, Util::ptr_shared<char> content, Document *doc)
+ : SimpleNode(target, doc)
{
setContent(content);
}
+ PINode(PINode const &other, Document *doc)
+ : SimpleNode(other, doc) {}
Inkscape::XML::NodeType type() const { return Inkscape::XML::PI_NODE; }
protected:
- SimpleNode *_duplicate(Document* /*doc*/) const { return new PINode(*this); }
+ SimpleNode *_duplicate(Document* doc) const { return new PINode(*this, doc); }
};
}
diff --git a/src/xml/repr-css.cpp b/src/xml/repr-css.cpp
index 888250c4024597cde3330800dcc9351bbb72de2c..be125f45358481f40259bb75bbc6ad297897872f 100644 (file)
--- a/src/xml/repr-css.cpp
+++ b/src/xml/repr-css.cpp
#include <glibmm/ustring.h>
#include "xml/repr.h"
+#include "xml/simple-document.h"
#include "xml/simple-node.h"
#include "style.h"
#include "libcroco/cr-sel-eng.h"
struct SPCSSAttrImpl : public SimpleNode, public SPCSSAttr {
public:
- SPCSSAttrImpl() : SimpleNode(g_quark_from_static_string("css")) {}
+ SPCSSAttrImpl(Document *doc)
+ : SimpleNode(g_quark_from_static_string("css"), doc) {}
+ SPCSSAttrImpl(SPCSSAttrImpl const &other, Document *doc)
+ : SimpleNode(other, doc) {}
NodeType type() const { return Inkscape::XML::ELEMENT_NODE; }
protected:
- SimpleNode *_duplicate(Document* /*doc*/) const { return new SPCSSAttrImpl(*this); }
+ SimpleNode *_duplicate(Document* doc) const { return new SPCSSAttrImpl(*this, doc); }
};
static void sp_repr_css_add_components(SPCSSAttr *css, Node *repr, gchar const *attr);
+
SPCSSAttr *
sp_repr_css_attr_new()
{
- return new SPCSSAttrImpl();
+ static Inkscape::XML::Document *attr_doc=NULL;
+ if (!attr_doc) {
+ attr_doc = new Inkscape::XML::SimpleDocument();
+ }
+ return new SPCSSAttrImpl(attr_doc);
}
void
index d0aa319390f09661bbf8ab1bc09f94afafb37dcb..0a2cb15fb67b79716e8bd8944cc13ea7fec56931 100644 (file)
}
Node *SimpleDocument::createElement(char const *name) {
- return new ElementNode(g_quark_from_string(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));
+ return new CommentNode(Util::share_string(content), this);
}
Node *SimpleDocument::createPI(char const *target, char const *content) {
- return new PINode(g_quark_from_string(target), Util::share_string(content));
+ return new PINode(g_quark_from_string(target), Util::share_string(content), this);
}
void SimpleDocument::notifyChildAdded(Node &parent,
index cadda36cbf24634c47e83a62d6667ad6d634afa8..9b3157add52873b326d28561c6ae9ce7660e5164 100644 (file)
{
public:
explicit SimpleDocument()
- : SimpleNode(g_quark_from_static_string("xml")), _in_transaction(false)
+ : SimpleNode(g_quark_from_static_string("xml"), NULL),
+ _in_transaction(false)
{
_initBindings();
}
index 084547a5907c3cb1f9bf0f598de9c0782b85fb3b..8ddc5b167ef5c0f2c8e8017aaa394be03d45a321 100644 (file)
--- a/src/xml/simple-node.cpp
+++ b/src/xml/simple-node.cpp
using Util::rest;
using Util::set_rest;
-SimpleNode::SimpleNode(int code)
+SimpleNode::SimpleNode(int code, Document *document)
: Node(), _name(code), _attributes(), _child_count(0),
_cached_positions_valid(false)
{
- this->_document = NULL;
- this->_document = NULL;
+ this->_document = document;
this->_parent = this->_next = NULL;
this->_first_child = this->_last_child = NULL;
_observers.add(_subtree_observers);
}
-SimpleNode::SimpleNode(SimpleNode const &node)
+SimpleNode::SimpleNode(SimpleNode const &node, Document *document)
: Node(),
_cached_position(node._cached_position),
_name(node._name), _attributes(), _content(node._content),
_child_count(node._child_count),
_cached_positions_valid(node._cached_positions_valid)
{
- _document = NULL;
+ _document = document;
_parent = _next = NULL;
_first_child = _last_child = NULL;
for ( Node *child = node._first_child ;
child != NULL ; child = child->next() )
{
- Node *child_copy=child->duplicate(NULL); // FIXME
+ Node *child_copy=child->duplicate(document);
child_copy->_setParent(this);
if (_last_child) {
diff --git a/src/xml/simple-node.h b/src/xml/simple-node.h
index 60bb534549e80e6f14c391dc534e823398ea7cba..7c5556f27466e6a4c2de73fc41f8db569bd1d1f2 100644 (file)
--- a/src/xml/simple-node.h
+++ b/src/xml/simple-node.h
}
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;
diff --git a/src/xml/text-node.h b/src/xml/text-node.h
index adcacb604fc8dedbd9d602784588bdfdbcf00545..8fb79727617aeddf653ea33313fcbec325597639 100644 (file)
--- a/src/xml/text-node.h
+++ b/src/xml/text-node.h
namespace XML {
struct TextNode : public SimpleNode {
- TextNode(Util::ptr_shared<char> content)
- : SimpleNode(g_quark_from_static_string("string"))
+ TextNode(Util::ptr_shared<char> content, Document *doc)
+ : SimpleNode(g_quark_from_static_string("string"), doc)
{
setContent(content);
}
+ TextNode(TextNode const &other, Document *doc)
+ : SimpleNode(other, doc) {}
Inkscape::XML::NodeType type() const { return Inkscape::XML::TEXT_NODE; }
protected:
- SimpleNode *_duplicate(Document* /*doc*/) const { return new TextNode(*this); }
+ SimpleNode *_duplicate(Document* doc) const { return new TextNode(*this, doc); }
};
}