summaryrefslogtreecommitdiffstats
path: root/src/xml
diff options
context:
space:
mode:
authorJan Lingscheid <jan.linscheid@auticon.de>2017-10-18 14:03:34 +0000
committerJan Lingscheid <jan.linscheid@auticon.de>2017-10-18 14:03:34 +0000
commit41b862f1c4eaea48bdd0d546e2bb31907f15857b (patch)
treee667c91439f0f04aa1f2cec1d3eafddf80bc4ecc /src/xml
parentReplace boost::shared_ptr (diff)
downloadinkscape-41b862f1c4eaea48bdd0d546e2bb31907f15857b.tar.gz
inkscape-41b862f1c4eaea48bdd0d546e2bb31907f15857b.zip
Refactor Util::ptr_shared
Util::ptr_shared<T> was only used in its <char> specialization, so it is now refactored into a non-template class. Using it with arbitary classes was dangerous anyway.
Diffstat (limited to 'src/xml')
-rw-r--r--src/xml/attribute-record.h4
-rw-r--r--src/xml/comment-node.h2
-rw-r--r--src/xml/composite-node-observer.cpp8
-rw-r--r--src/xml/composite-node-observer.h8
-rw-r--r--src/xml/event.cpp16
-rw-r--r--src/xml/event.h16
-rw-r--r--src/xml/helper-observer.cpp4
-rw-r--r--src/xml/helper-observer.h4
-rw-r--r--src/xml/log-builder.cpp8
-rw-r--r--src/xml/log-builder.h8
-rw-r--r--src/xml/node-observer.h8
-rw-r--r--src/xml/pi-node.h2
-rw-r--r--src/xml/rebase-hrefs.cpp4
-rw-r--r--src/xml/repr-io.cpp6
-rw-r--r--src/xml/simple-document.cpp8
-rw-r--r--src/xml/simple-document.h8
-rw-r--r--src/xml/simple-node.cpp18
-rw-r--r--src/xml/simple-node.h2
-rw-r--r--src/xml/text-node.h4
19 files changed, 69 insertions, 69 deletions
diff --git a/src/xml/attribute-record.h b/src/xml/attribute-record.h
index 7caeab6b6..91118c8a0 100644
--- a/src/xml/attribute-record.h
+++ b/src/xml/attribute-record.h
@@ -22,13 +22,13 @@ namespace XML {
* represented by this structure.
*/
struct AttributeRecord : public Inkscape::GC::Managed<> {
- AttributeRecord(GQuark k, Inkscape::Util::ptr_shared<char> v)
+ AttributeRecord(GQuark k, Inkscape::Util::ptr_shared v)
: key(k), value(v) {}
/** @brief GQuark corresponding to the name of the attribute */
GQuark key;
/** @brief Shared pointer to the value of the attribute */
- Inkscape::Util::ptr_shared<char> value;
+ Inkscape::Util::ptr_shared value;
// accept default copy constructor and assignment operator
};
diff --git a/src/xml/comment-node.h b/src/xml/comment-node.h
index 56b8ad476..7c37a0d24 100644
--- a/src/xml/comment-node.h
+++ b/src/xml/comment-node.h
@@ -26,7 +26,7 @@ namespace XML {
* @brief Comment node, e.g. &lt;!-- Some comment --&gt;
*/
struct CommentNode : public SimpleNode {
- CommentNode(Util::ptr_shared<char> content, Document *doc)
+ CommentNode(Util::ptr_shared content, Document *doc)
: SimpleNode(g_quark_from_static_string("comment"), doc)
{
setContent(content);
diff --git a/src/xml/composite-node-observer.cpp b/src/xml/composite-node-observer.cpp
index 7343ab1a8..581a4c226 100644
--- a/src/xml/composite-node-observer.cpp
+++ b/src/xml/composite-node-observer.cpp
@@ -69,7 +69,7 @@ void CompositeNodeObserver::notifyChildOrderChanged(Node &node, Node &child,
void CompositeNodeObserver::notifyContentChanged(
Node &node,
- Util::ptr_shared<char> old_content, Util::ptr_shared<char> new_content
+ Util::ptr_shared old_content, Util::ptr_shared new_content
) {
_startIteration();
for ( ObserverRecordList::iterator iter=_active.begin() ;
@@ -84,7 +84,7 @@ void CompositeNodeObserver::notifyContentChanged(
void CompositeNodeObserver::notifyAttributeChanged(
Node &node, GQuark name,
- Util::ptr_shared<char> old_value, Util::ptr_shared<char> new_value
+ Util::ptr_shared old_value, Util::ptr_shared new_value
) {
_startIteration();
for ( ObserverRecordList::iterator iter=_active.begin() ;
@@ -133,13 +133,13 @@ public:
}
}
- void notifyContentChanged(Node &node, Util::ptr_shared<char> old_content, Util::ptr_shared<char> new_content) {
+ void notifyContentChanged(Node &node, Util::ptr_shared old_content, Util::ptr_shared new_content) {
if (vector.content_changed) {
vector.content_changed(&node, old_content, new_content, data);
}
}
- void notifyAttributeChanged(Node &node, GQuark name, Util::ptr_shared<char> old_value, Util::ptr_shared<char> new_value) {
+ void notifyAttributeChanged(Node &node, GQuark name, Util::ptr_shared old_value, Util::ptr_shared new_value) {
if (vector.attr_changed) {
vector.attr_changed(&node, g_quark_to_string(name), old_value, new_value, false, data);
}
diff --git a/src/xml/composite-node-observer.h b/src/xml/composite-node-observer.h
index 6e93a57da..1004617bf 100644
--- a/src/xml/composite-node-observer.h
+++ b/src/xml/composite-node-observer.h
@@ -75,12 +75,12 @@ public:
Node *old_prev, Node *new_prev);
void notifyContentChanged(Node &node,
- Util::ptr_shared<char> old_content,
- Util::ptr_shared<char> new_content);
+ Util::ptr_shared old_content,
+ Util::ptr_shared new_content);
void notifyAttributeChanged(Node &node, GQuark name,
- Util::ptr_shared<char> old_value,
- Util::ptr_shared<char> new_value);
+ Util::ptr_shared old_value,
+ Util::ptr_shared new_value);
private:
unsigned _iterating;
diff --git a/src/xml/event.cpp b/src/xml/event.cpp
index 9a760ccc5..54f55d5c3 100644
--- a/src/xml/event.cpp
+++ b/src/xml/event.cpp
@@ -107,15 +107,15 @@ public:
}
void notifyAttributeChanged(Node &node, GQuark name,
- Inkscape::Util::ptr_shared<char> /*old_value*/,
- Inkscape::Util::ptr_shared<char> new_value)
+ Inkscape::Util::ptr_shared /*old_value*/,
+ Inkscape::Util::ptr_shared new_value)
{
node.setAttribute(g_quark_to_string(name), new_value);
}
void notifyContentChanged(Node &node,
- Inkscape::Util::ptr_shared<char> /*old_value*/,
- Inkscape::Util::ptr_shared<char> new_value)
+ Inkscape::Util::ptr_shared /*old_value*/,
+ Inkscape::Util::ptr_shared new_value)
{
node.setContent(new_value);
}
@@ -461,8 +461,8 @@ public:
}
void notifyAttributeChanged(Node &node, GQuark name,
- Inkscape::Util::ptr_shared<char> /*old_value*/,
- Inkscape::Util::ptr_shared<char> new_value)
+ Inkscape::Util::ptr_shared /*old_value*/,
+ Inkscape::Util::ptr_shared new_value)
{
if (new_value) {
g_warning("Event: Set attribute %s to \"%s\" on %s", g_quark_to_string(name), new_value.pointer(), node_to_string(node).c_str());
@@ -472,8 +472,8 @@ public:
}
void notifyContentChanged(Node &node,
- Inkscape::Util::ptr_shared<char> /*old_value*/,
- Inkscape::Util::ptr_shared<char> new_value)
+ Inkscape::Util::ptr_shared /*old_value*/,
+ Inkscape::Util::ptr_shared new_value)
{
if (new_value) {
g_warning("Event: Set content of %s to \"%s\"", node_to_string(node).c_str(), new_value.pointer());
diff --git a/src/xml/event.h b/src/xml/event.h
index f6b734c29..ca79983ba 100644
--- a/src/xml/event.h
+++ b/src/xml/event.h
@@ -167,8 +167,8 @@ private:
class EventChgAttr : public Event {
public:
EventChgAttr(Node *repr, GQuark k,
- Inkscape::Util::ptr_shared<char> ov,
- Inkscape::Util::ptr_shared<char> nv,
+ Inkscape::Util::ptr_shared ov,
+ Inkscape::Util::ptr_shared nv,
Event *next)
: Event(repr, next), key(k),
oldval(ov), newval(nv) {}
@@ -176,9 +176,9 @@ public:
/// GQuark corresponding to the changed attribute's name
GQuark key;
/// Value of the attribute before the change
- Inkscape::Util::ptr_shared<char> oldval;
+ Inkscape::Util::ptr_shared oldval;
/// Value of the attribute after the change
- Inkscape::Util::ptr_shared<char> newval;
+ Inkscape::Util::ptr_shared newval;
private:
Event *_optimizeOne();
@@ -192,15 +192,15 @@ private:
class EventChgContent : public Event {
public:
EventChgContent(Node *repr,
- Inkscape::Util::ptr_shared<char> ov,
- Inkscape::Util::ptr_shared<char> nv,
+ Inkscape::Util::ptr_shared ov,
+ Inkscape::Util::ptr_shared nv,
Event *next)
: Event(repr, next), oldval(ov), newval(nv) {}
/// Content of the node before the change
- Inkscape::Util::ptr_shared<char> oldval;
+ Inkscape::Util::ptr_shared oldval;
/// Content of the node after the change
- Inkscape::Util::ptr_shared<char> newval;
+ Inkscape::Util::ptr_shared newval;
private:
Event *_optimizeOne();
diff --git a/src/xml/helper-observer.cpp b/src/xml/helper-observer.cpp
index 957f3df0a..6f1094e53 100644
--- a/src/xml/helper-observer.cpp
+++ b/src/xml/helper-observer.cpp
@@ -44,10 +44,10 @@ void SignalObserver::notifyChildRemoved(XML::Node&, XML::Node&, XML::Node*)
void SignalObserver::notifyChildOrderChanged(XML::Node&, XML::Node&, XML::Node*, XML::Node*)
{ signal_changed()(); }
-void SignalObserver::notifyContentChanged(XML::Node&, Util::ptr_shared<char>, Util::ptr_shared<char>)
+void SignalObserver::notifyContentChanged(XML::Node&, Util::ptr_shared, Util::ptr_shared)
{}
-void SignalObserver::notifyAttributeChanged(XML::Node&, GQuark, Util::ptr_shared<char>, Util::ptr_shared<char>)
+void SignalObserver::notifyAttributeChanged(XML::Node&, GQuark, Util::ptr_shared, Util::ptr_shared)
{ signal_changed()(); }
sigc::signal<void>& SignalObserver::signal_changed()
diff --git a/src/xml/helper-observer.h b/src/xml/helper-observer.h
index b4c0aba41..b06b61e9c 100644
--- a/src/xml/helper-observer.h
+++ b/src/xml/helper-observer.h
@@ -24,8 +24,8 @@ public:
void notifyChildAdded(Node&, Node&, Node*);
void notifyChildRemoved(Node&, Node&, Node*);
void notifyChildOrderChanged(Node&, Node&, Node*, Node*);
- void notifyContentChanged(Node&, Util::ptr_shared<char>, Util::ptr_shared<char>);
- void notifyAttributeChanged(Node&, GQuark, Util::ptr_shared<char>, Util::ptr_shared<char>);
+ void notifyContentChanged(Node&, Util::ptr_shared, Util::ptr_shared);
+ void notifyAttributeChanged(Node&, GQuark, Util::ptr_shared, Util::ptr_shared);
sigc::signal<void>& signal_changed();
private:
sigc::signal<void> _signal_changed;
diff --git a/src/xml/log-builder.cpp b/src/xml/log-builder.cpp
index 2cbdcfacf..12577cf69 100644
--- a/src/xml/log-builder.cpp
+++ b/src/xml/log-builder.cpp
@@ -49,16 +49,16 @@ void LogBuilder::setChildOrder(Node &node, Node &child,
}
void LogBuilder::setContent(Node &node,
- Util::ptr_shared<char> old_content,
- Util::ptr_shared<char> new_content)
+ Util::ptr_shared old_content,
+ Util::ptr_shared new_content)
{
_log = new Inkscape::XML::EventChgContent(&node, old_content, new_content, _log);
_log = _log->optimizeOne();
}
void LogBuilder::setAttribute(Node &node, GQuark name,
- Util::ptr_shared<char> old_value,
- Util::ptr_shared<char> new_value)
+ Util::ptr_shared old_value,
+ Util::ptr_shared new_value)
{
_log = new Inkscape::XML::EventChgAttr(&node, name, old_value, new_value, _log);
_log = _log->optimizeOne();
diff --git a/src/xml/log-builder.h b/src/xml/log-builder.h
index e94dd1daa..8b0f6662d 100644
--- a/src/xml/log-builder.h
+++ b/src/xml/log-builder.h
@@ -58,12 +58,12 @@ public:
Node *old_prev, Node *new_prev);
void setContent(Node &node,
- Util::ptr_shared<char> old_content,
- Util::ptr_shared<char> new_content);
+ Util::ptr_shared old_content,
+ Util::ptr_shared new_content);
void setAttribute(Node &node, GQuark name,
- Util::ptr_shared<char> old_value,
- Util::ptr_shared<char> new_value);
+ Util::ptr_shared old_value,
+ Util::ptr_shared new_value);
/*@}*/
private:
diff --git a/src/xml/node-observer.h b/src/xml/node-observer.h
index 9c7e096e5..28c492d66 100644
--- a/src/xml/node-observer.h
+++ b/src/xml/node-observer.h
@@ -123,8 +123,8 @@ public:
* @param new_content New content of @c node
*/
virtual void notifyContentChanged(Node &node,
- Util::ptr_shared<char> old_content,
- Util::ptr_shared<char> new_content) {
+ Util::ptr_shared old_content,
+ Util::ptr_shared new_content) {
INK_UNUSED(node);
INK_UNUSED(old_content);
INK_UNUSED(new_content);
@@ -141,8 +141,8 @@ public:
* @param new_value New value of the modified attribute
*/
virtual void notifyAttributeChanged(Node &node, GQuark name,
- Util::ptr_shared<char> old_value,
- Util::ptr_shared<char> new_value) {
+ Util::ptr_shared old_value,
+ Util::ptr_shared new_value) {
INK_UNUSED(node);
INK_UNUSED(name);
INK_UNUSED(old_value);
diff --git a/src/xml/pi-node.h b/src/xml/pi-node.h
index 76a3dc741..eeed1632d 100644
--- a/src/xml/pi-node.h
+++ b/src/xml/pi-node.h
@@ -24,7 +24,7 @@ namespace XML {
* @brief Processing instruction node, e.g. &lt;?xml version="1.0" encoding="utf-8" standalone="no"?&gt;
*/
struct PINode : public SimpleNode {
- PINode(GQuark target, Util::ptr_shared<char> content, Document *doc)
+ PINode(GQuark target, Util::ptr_shared content, Document *doc)
: SimpleNode(target, doc)
{
setContent(content);
diff --git a/src/xml/rebase-hrefs.cpp b/src/xml/rebase-hrefs.cpp
index a34df09a5..c023dc670 100644
--- a/src/xml/rebase-hrefs.cpp
+++ b/src/xml/rebase-hrefs.cpp
@@ -112,8 +112,8 @@ Inkscape::XML::rebase_href_attrs(gchar const *const old_abs_base,
*
* However, if we find that xlink:href doesn't need rebasing, then return immediately
* with no change to attributes. */
- ptr_shared<char> old_href;
- ptr_shared<char> sp_absref;
+ ptr_shared old_href;
+ ptr_shared sp_absref;
List<AttributeRecord const> ret;
{
for (List<AttributeRecord const> ai(attributes); ai; ++ai) {
diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp
index d8e0f5418..b5ce18887 100644
--- a/src/xml/repr-io.cpp
+++ b/src/xml/repr-io.cpp
@@ -812,7 +812,7 @@ static void repr_write_comment( Writer &out, const gchar * val, bool addWhitespa
namespace {
typedef std::map<Glib::QueryQuark, gchar const *, Inkscape::compare_quark_ids> LocalNameMap;
-typedef std::map<Glib::QueryQuark, Inkscape::Util::ptr_shared<char>, Inkscape::compare_quark_ids> NSMap;
+typedef std::map<Glib::QueryQuark, Inkscape::Util::ptr_shared, Inkscape::compare_quark_ids> NSMap;
gchar const *qname_local_name(Glib::QueryQuark qname) {
static LocalNameMap local_name_map;
@@ -846,7 +846,7 @@ void add_ns_map_entry(NSMap &ns_map, Glib::QueryQuark prefix) {
g_warning("No namespace known for normalized prefix %s", g_quark_to_string(prefix));
}
} else {
- ns_map.insert(NSMap::value_type(prefix, ptr_shared<char>()));
+ ns_map.insert(NSMap::value_type(prefix, ptr_shared()));
}
}
}
@@ -905,7 +905,7 @@ static void sp_repr_write_stream_root_element(Node *repr, Writer &out,
for ( NSMap::iterator iter=ns_map.begin() ; iter != ns_map.end() ; ++iter )
{
Glib::QueryQuark prefix=(*iter).first;
- ptr_shared<char> ns_uri=(*iter).second;
+ ptr_shared ns_uri=(*iter).second;
if (prefix.id()) {
if ( prefix != xml_prefix ) {
diff --git a/src/xml/simple-document.cpp b/src/xml/simple-document.cpp
index bae28e4b4..cf7851897 100644
--- a/src/xml/simple-document.cpp
+++ b/src/xml/simple-document.cpp
@@ -100,8 +100,8 @@ void SimpleDocument::notifyChildOrderChanged(Node &parent,
}
void SimpleDocument::notifyContentChanged(Node &node,
- Util::ptr_shared<char> old_content,
- Util::ptr_shared<char> new_content)
+ Util::ptr_shared old_content,
+ Util::ptr_shared new_content)
{
if (_in_transaction) {
_log_builder.setContent(node, old_content, new_content);
@@ -110,8 +110,8 @@ void SimpleDocument::notifyContentChanged(Node &node,
void SimpleDocument::notifyAttributeChanged(Node &node,
GQuark name,
- Util::ptr_shared<char> old_value,
- Util::ptr_shared<char> new_value)
+ Util::ptr_shared old_value,
+ Util::ptr_shared new_value)
{
if (_in_transaction) {
_log_builder.setAttribute(node, name, old_value, new_value);
diff --git a/src/xml/simple-document.h b/src/xml/simple-document.h
index 7cbe50dda..01933076f 100644
--- a/src/xml/simple-document.h
+++ b/src/xml/simple-document.h
@@ -56,12 +56,12 @@ public:
Node *old_prev, Node *new_prev);
void notifyContentChanged(Node &node,
- Util::ptr_shared<char> old_content,
- Util::ptr_shared<char> new_content);
+ Util::ptr_shared old_content,
+ Util::ptr_shared new_content);
void notifyAttributeChanged(Node &node, GQuark name,
- Util::ptr_shared<char> old_value,
- Util::ptr_shared<char> new_value);
+ Util::ptr_shared old_value,
+ Util::ptr_shared new_value);
protected:
SimpleDocument(SimpleDocument const &doc)
diff --git a/src/xml/simple-node.cpp b/src/xml/simple-node.cpp
index 6bd47fd22..78fc52a27 100644
--- a/src/xml/simple-node.cpp
+++ b/src/xml/simple-node.cpp
@@ -36,7 +36,7 @@ namespace XML {
namespace {
-Util::ptr_shared<char> stringify_node(Node const &node) {
+Util::ptr_shared stringify_node(Node const &node) {
gchar *string;
switch (node.type()) {
case ELEMENT_NODE: {
@@ -59,7 +59,7 @@ Util::ptr_shared<char> stringify_node(Node const &node) {
default:
string = g_strdup_printf("unknown(%p)", &node);
}
- Util::ptr_shared<char> result=Util::share_string(string);
+ Util::ptr_shared result=Util::share_string(string);
g_free(string);
return result;
}
@@ -68,7 +68,7 @@ typedef Debug::SimpleEvent<Debug::Event::XML> DebugXML;
class DebugXMLNode : public DebugXML {
public:
- DebugXMLNode(Node const &node, Util::ptr_shared<char> name)
+ DebugXMLNode(Node const &node, Util::ptr_shared name)
: DebugXML(name)
{
_addProperty("node", stringify_node(node));
@@ -115,7 +115,7 @@ public:
class DebugSetContent : public DebugXMLNode {
public:
DebugSetContent(Node const &node,
- Util::ptr_shared<char> content)
+ Util::ptr_shared content)
: DebugXMLNode(node, Util::share_static_string("set-content"))
{
_addProperty("content", content);
@@ -133,7 +133,7 @@ class DebugSetAttribute : public DebugXMLNode {
public:
DebugSetAttribute(Node const &node,
GQuark name,
- Util::ptr_shared<char> value)
+ Util::ptr_shared value)
: DebugXMLNode(node, Util::share_static_string("set-attribute"))
{
_addProperty("name", Util::share_static_string(g_quark_to_string(name)));
@@ -290,8 +290,8 @@ void SimpleNode::_setParent(SimpleNode *parent) {
}
void SimpleNode::setContent(gchar const *content) {
- ptr_shared<char> old_content=_content;
- ptr_shared<char> new_content = ( content ? share_string(content) : ptr_shared<char>() );
+ ptr_shared old_content=_content;
+ ptr_shared new_content = ( content ? share_string(content) : ptr_shared() );
Debug::EventTracker<> tracker;
if (new_content) {
@@ -365,9 +365,9 @@ SimpleNode::setAttribute(gchar const *name, gchar const *value, bool const /*is_
}
Debug::EventTracker<> tracker;
- ptr_shared<char> old_value=( existing ? existing->value : ptr_shared<char>() );
+ ptr_shared old_value=( existing ? existing->value : ptr_shared() );
- ptr_shared<char> new_value=ptr_shared<char>();
+ ptr_shared new_value=ptr_shared();
if (cleaned_value) {
new_value = share_string(cleaned_value);
tracker.set<DebugSetAttribute>(*this, key, new_value);
diff --git a/src/xml/simple-node.h b/src/xml/simple-node.h
index d09392249..f2cfa953c 100644
--- a/src/xml/simple-node.h
+++ b/src/xml/simple-node.h
@@ -144,7 +144,7 @@ private:
Inkscape::Util::MutableList<AttributeRecord> _attributes;
- Inkscape::Util::ptr_shared<char> _content;
+ Inkscape::Util::ptr_shared _content;
unsigned _child_count;
mutable bool _cached_positions_valid;
diff --git a/src/xml/text-node.h b/src/xml/text-node.h
index 53798b822..4d71203a5 100644
--- a/src/xml/text-node.h
+++ b/src/xml/text-node.h
@@ -26,13 +26,13 @@ namespace XML {
* @brief Text node, e.g. "Some text" in &lt;group&gt;Some text&lt;/group&gt;
*/
struct TextNode : public SimpleNode {
- TextNode(Util::ptr_shared<char> content, Document *doc)
+ TextNode(Util::ptr_shared content, Document *doc)
: SimpleNode(g_quark_from_static_string("string"), doc)
{
setContent(content);
_is_CData = false;
}
- TextNode(Util::ptr_shared<char> content, Document *doc, bool is_CData)
+ TextNode(Util::ptr_shared content, Document *doc, bool is_CData)
: SimpleNode(g_quark_from_static_string("string"), doc)
{
setContent(content);