diff options
| author | Jan Lingscheid <jan.linscheid@auticon.de> | 2017-10-18 14:03:34 +0000 |
|---|---|---|
| committer | Jan Lingscheid <jan.linscheid@auticon.de> | 2017-10-18 14:03:34 +0000 |
| commit | 41b862f1c4eaea48bdd0d546e2bb31907f15857b (patch) | |
| tree | e667c91439f0f04aa1f2cec1d3eafddf80bc4ecc | |
| parent | Replace boost::shared_ptr (diff) | |
| download | inkscape-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.
44 files changed, 188 insertions, 222 deletions
diff --git a/src/debug/demangle.cpp b/src/debug/demangle.cpp index 1d94f0eb9..04fe80d9b 100644 --- a/src/debug/demangle.cpp +++ b/src/debug/demangle.cpp @@ -50,7 +50,7 @@ MangleCache mangle_cache; } -Util::ptr_shared<char> demangle(char const *name) { +Util::ptr_shared demangle(char const *name) { MangleCache::iterator found=mangle_cache.find(name); char const *result; diff --git a/src/debug/demangle.h b/src/debug/demangle.h index 7505d9550..c5e160caa 100644 --- a/src/debug/demangle.h +++ b/src/debug/demangle.h @@ -18,7 +18,7 @@ namespace Inkscape { namespace Debug { -Util::ptr_shared<char> demangle(char const *name); +Util::ptr_shared demangle(char const *name); } diff --git a/src/debug/event.h b/src/debug/event.h index 1cdd4f7e2..2d3751ff5 100644 --- a/src/debug/event.h +++ b/src/debug/event.h @@ -40,23 +40,23 @@ public: struct PropertyPair { public: PropertyPair() {} - PropertyPair(Util::ptr_shared<char> n, Util::ptr_shared<char> v) + PropertyPair(Util::ptr_shared n, Util::ptr_shared v) : name(n), value(v) {} - PropertyPair(char const *n, Util::ptr_shared<char> v) + PropertyPair(char const *n, Util::ptr_shared v) : name(Util::share_string(n)), value(v) {} - PropertyPair(Util::ptr_shared<char> n, char const *v) + PropertyPair(Util::ptr_shared n, char const *v) : name(n), value(Util::share_string(v)) {} PropertyPair(char const *n, char const *v) : name(Util::share_string(n)), value(Util::share_string(v)) {} - Util::ptr_shared<char> name; - Util::ptr_shared<char> value; + Util::ptr_shared name; + Util::ptr_shared value; }; static Category category() { return OTHER; } - virtual Util::ptr_shared<char> name() const=0; + virtual Util::ptr_shared name() const=0; virtual unsigned propertyCount() const=0; virtual PropertyPair property(unsigned property) const=0; diff --git a/src/debug/gc-heap.h b/src/debug/gc-heap.h index d120ddba9..0daf39487 100644 --- a/src/debug/gc-heap.h +++ b/src/debug/gc-heap.h @@ -23,7 +23,7 @@ public: int features() const { return SIZE_AVAILABLE | USED_AVAILABLE | GARBAGE_COLLECTED; } - Util::ptr_shared<char> name() const { + Util::ptr_shared name() const { return Util::share_static_string("libgc"); } Heap::Stats stats() const { diff --git a/src/debug/heap.h b/src/debug/heap.h index e1e01f022..d7d39efb9 100644 --- a/src/debug/heap.h +++ b/src/debug/heap.h @@ -36,7 +36,7 @@ public: virtual int features() const=0; - virtual Util::ptr_shared<char> name() const=0; + virtual Util::ptr_shared name() const=0; virtual Stats stats() const=0; virtual void force_collect()=0; }; diff --git a/src/debug/logger.cpp b/src/debug/logger.cpp index 2eb81a0ba..d422b8e72 100644 --- a/src/debug/logger.cpp +++ b/src/debug/logger.cpp @@ -26,7 +26,7 @@ bool Logger::_category_mask[Event::N_CATEGORIES]; namespace { -static void write_escaped_value(std::ostream &os, Util::ptr_shared<char> value) { +static void write_escaped_value(std::ostream &os, Util::ptr_shared value) { for ( char const *current=value ; *current ; ++current ) { switch (*current) { case '&': @@ -58,7 +58,7 @@ static void write_indent(std::ostream &os, unsigned depth) { static std::ofstream log_stream; static bool empty_tag=false; -typedef std::vector<Util::ptr_shared<char>, GC::Alloc<Util::ptr_shared<char>, GC::MANUAL> > TagStack; +typedef std::vector<Util::ptr_shared, GC::Alloc<Util::ptr_shared, GC::MANUAL> > TagStack; static TagStack &tag_stack() { static TagStack stack; return stack; @@ -158,7 +158,7 @@ void Logger::init() { } void Logger::_start(Event const &event) { - Util::ptr_shared<char> name=event.name(); + Util::ptr_shared name=event.name(); if (empty_tag) { log_stream << ">\n"; @@ -185,7 +185,7 @@ void Logger::_start(Event const &event) { } void Logger::_skip() { - tag_stack().push_back(Util::ptr_shared<char>()); + tag_stack().push_back(Util::ptr_shared()); } void Logger::_finish() { diff --git a/src/debug/simple-event.h b/src/debug/simple-event.h index 03ce5d326..076b9b4b5 100644 --- a/src/debug/simple-event.h +++ b/src/debug/simple-event.h @@ -26,7 +26,7 @@ namespace Debug { template <Event::Category C=Event::OTHER> class SimpleEvent : public Event { public: - explicit SimpleEvent(Util::ptr_shared<char> name) : _name(name) {} + explicit SimpleEvent(Util::ptr_shared name) : _name(name) {} explicit SimpleEvent(char const *name) : _name(Util::share_string(name)) {} // default copy @@ -34,7 +34,7 @@ public: static Category category() { return C; } - Util::ptr_shared<char> name() const { return _name; } + Util::ptr_shared name() const { return _name; } unsigned propertyCount() const { return _properties.size(); } PropertyPair property(unsigned property) const { return _properties[property]; @@ -43,21 +43,21 @@ public: void generateChildEvents() const {} protected: - void _addProperty(Util::ptr_shared<char> name, - Util::ptr_shared<char> value) + void _addProperty(Util::ptr_shared name, + Util::ptr_shared value) { _properties.push_back(PropertyPair(name, value)); } - void _addProperty(Util::ptr_shared<char> name, char const *value) { + void _addProperty(Util::ptr_shared name, char const *value) { _addProperty(name, Util::share_string(value)); } - void _addProperty(char const *name, Util::ptr_shared<char> value) { + void _addProperty(char const *name, Util::ptr_shared value) { _addProperty(Util::share_string(name), value); } void _addProperty(char const *name, char const *value) { _addProperty(Util::share_string(name), Util::share_string(value)); } - void _addProperty(Util::ptr_shared<char> name, long value) { + void _addProperty(Util::ptr_shared name, long value) { _addFormattedProperty(name, "%ld", value); } void _addProperty(char const *name, long value) { @@ -65,10 +65,10 @@ protected: } private: - Util::ptr_shared<char> _name; + Util::ptr_shared _name; std::vector<PropertyPair, GC::Alloc<PropertyPair, GC::AUTO> > _properties; - void _addFormattedProperty(Util::ptr_shared<char> name, char const *format, ...) + void _addFormattedProperty(Util::ptr_shared name, char const *format, ...) { va_list args; va_start(args, format); diff --git a/src/debug/sysv-heap.h b/src/debug/sysv-heap.h index ba8f5db83..4bde77cd8 100644 --- a/src/debug/sysv-heap.h +++ b/src/debug/sysv-heap.h @@ -23,7 +23,7 @@ public: int features() const; - Util::ptr_shared<char> name() const { + Util::ptr_shared name() const { return Util::share_static_string("standard malloc()"); } Stats stats() const; diff --git a/src/debug/timestamp.cpp b/src/debug/timestamp.cpp index 6de03a463..cdd47e881 100644 --- a/src/debug/timestamp.cpp +++ b/src/debug/timestamp.cpp @@ -19,8 +19,8 @@ namespace Inkscape { namespace Debug { -Util::ptr_shared<char> timestamp() { - Util::ptr_shared<char> result; +Util::ptr_shared timestamp() { + Util::ptr_shared result; GTimeVal timestamp; g_get_current_time(×tamp); gchar *value = g_strdup_printf( "%d.%06d", static_cast<gint>(timestamp.tv_sec), static_cast<gint>(timestamp.tv_usec) ); diff --git a/src/debug/timestamp.h b/src/debug/timestamp.h index 336ed5d0f..c145ffbc9 100644 --- a/src/debug/timestamp.h +++ b/src/debug/timestamp.h @@ -18,7 +18,7 @@ namespace Inkscape { namespace Debug { -Util::ptr_shared<char> timestamp(); +Util::ptr_shared timestamp(); } diff --git a/src/gc-anchored.cpp b/src/gc-anchored.cpp index 4abd44b57..3ce6eff7b 100644 --- a/src/gc-anchored.cpp +++ b/src/gc-anchored.cpp @@ -27,7 +27,7 @@ typedef Debug::SimpleEvent<Debug::Event::REFCOUNT> RefCountEvent; class BaseAnchorEvent : public RefCountEvent { public: BaseAnchorEvent(Anchored const *object, int bias, - Util::ptr_shared<char> name) + Util::ptr_shared name) : RefCountEvent(name) { _addProperty("base", Util::format("%p", Core::base(const_cast<Anchored *>(object)))); diff --git a/src/io/resource.cpp b/src/io/resource.cpp index bc6c9f7b0..c3cd9e403 100644 --- a/src/io/resource.cpp +++ b/src/io/resource.cpp @@ -113,10 +113,10 @@ gchar *_get_path(Domain domain, Type type, char const *filename) return path; } -Util::ptr_shared<char> get_path(Domain domain, Type type, char const *filename) +Util::ptr_shared get_path(Domain domain, Type type, char const *filename) { char *path = _get_path(domain, type, filename); - Util::ptr_shared<char> result=Util::share_string(path); + Util::ptr_shared result=Util::share_string(path); g_free(path); return result; } diff --git a/src/io/resource.h b/src/io/resource.h index d12372024..d7dd506ad 100644 --- a/src/io/resource.h +++ b/src/io/resource.h @@ -56,7 +56,7 @@ enum Domain { USER }; -Util::ptr_shared<char> get_path(Domain domain, Type type, +Util::ptr_shared get_path(Domain domain, Type type, char const *filename=NULL); Glib::ustring get_path_ustring(Domain domain, Type type, diff --git a/src/layer-manager.cpp b/src/layer-manager.cpp index 3a6cce99c..f68175055 100644 --- a/src/layer-manager.cpp +++ b/src/layer-manager.cpp @@ -40,8 +40,8 @@ public: virtual void notifyChildAdded( Node &/*node*/, Node &/*child*/, Node */*prev*/ ) {} virtual void notifyChildRemoved( Node &/*node*/, Node &/*child*/, Node */*prev*/ ) {} virtual void notifyChildOrderChanged( Node &/*node*/, Node &/*child*/, Node */*old_prev*/, Node */*new_prev*/ ) {} - virtual void notifyContentChanged( Node &/*node*/, Util::ptr_shared<char> /*old_content*/, Util::ptr_shared<char> /*new_content*/ ) {} - virtual void notifyAttributeChanged( Node &/*node*/, GQuark name, Util::ptr_shared<char> /*old_value*/, Util::ptr_shared<char> /*new_value*/ ) { + virtual void notifyContentChanged( Node &/*node*/, Util::ptr_shared /*old_content*/, Util::ptr_shared /*new_content*/ ) {} + virtual void notifyAttributeChanged( Node &/*node*/, GQuark name, Util::ptr_shared /*old_value*/, Util::ptr_shared /*new_value*/ ) { if ( name == _lockedAttr || name == _labelAttr ) { if ( _mgr && _obj ) { _mgr->_objectModified( _obj, 0 ); @@ -59,9 +59,9 @@ public: /* namespace { -Util::ptr_shared<char> stringify_node(Node const &node); +Util::ptr_shared stringify_node(Node const &node); -Util::ptr_shared<char> stringify_obj(SPObject const &obj) { +Util::ptr_shared stringify_obj(SPObject const &obj) { gchar *string; if (obj.id) { @@ -70,7 +70,7 @@ Util::ptr_shared<char> stringify_obj(SPObject const &obj) { string = g_strdup_printf("SPObject(%p) repr(%p)", &obj, obj.repr); } - Util::ptr_shared<char> result=Util::share_string(string); + Util::ptr_shared result=Util::share_string(string); g_free(string); return result; @@ -80,7 +80,7 @@ typedef Debug::SimpleEvent<Debug::Event::OTHER> DebugLayer; class DebugLayerNote : public DebugLayer { public: - DebugLayerNote(Util::ptr_shared<char> descr) + DebugLayerNote(Util::ptr_shared descr) : DebugLayer(Util::share_static_string("layer-note")) { _addProperty("descr", descr); @@ -97,7 +97,7 @@ public: class DebugLayerObj : public DebugLayer { public: - DebugLayerObj(SPObject const& obj, Util::ptr_shared<char> name) + DebugLayerObj(SPObject const& obj, Util::ptr_shared name) : DebugLayer(name) { _addProperty("layer", stringify_obj(obj)); diff --git a/src/preferences.cpp b/src/preferences.cpp index 4d14afa93..9d5fb0639 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -76,7 +76,7 @@ public: _filter(filter) {} virtual ~PrefNodeObserver() {} - virtual void notifyAttributeChanged(XML::Node &node, GQuark name, Util::ptr_shared<char>, Util::ptr_shared<char>); + virtual void notifyAttributeChanged(XML::Node &node, GQuark name, Util::ptr_shared, Util::ptr_shared); private: Observer &_observer; Glib::ustring const _filter; @@ -561,7 +561,7 @@ Preferences::Observer::~Observer() prefs->removeObserver(*this); } -void Preferences::PrefNodeObserver::notifyAttributeChanged(XML::Node &node, GQuark name, Util::ptr_shared<char>, Util::ptr_shared<char> new_value) +void Preferences::PrefNodeObserver::notifyAttributeChanged(XML::Node &node, GQuark name, Util::ptr_shared, Util::ptr_shared new_value) { // filter out attributes we don't watch gchar const *attr_name = g_quark_to_string(name); diff --git a/src/sp-object.cpp b/src/sp-object.cpp index fc222f701..bc930a430 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -199,7 +199,7 @@ typedef Debug::SimpleEvent<Debug::Event::REFCOUNT> BaseRefCountEvent; class RefCountEvent : public BaseRefCountEvent { public: - RefCountEvent(SPObject *object, int bias, Util::ptr_shared<char> name) + RefCountEvent(SPObject *object, int bias, Util::ptr_shared name) : BaseRefCountEvent(name) { _addProperty("object", Util::format("%p", object)); diff --git a/src/sp-tref-reference.cpp b/src/sp-tref-reference.cpp index dfb8dd60b..d683e34ed 100644 --- a/src/sp-tref-reference.cpp +++ b/src/sp-tref-reference.cpp @@ -75,8 +75,8 @@ void SPTRefReference::notifyChildOrderChanged(Inkscape::XML::Node &/*node*/, Ink void SPTRefReference::notifyContentChanged(Inkscape::XML::Node &/*node*/, - Inkscape::Util::ptr_shared<char> /*old_content*/, - Inkscape::Util::ptr_shared<char> /*new_content*/) + Inkscape::Util::ptr_shared /*old_content*/, + Inkscape::Util::ptr_shared /*new_content*/) { SPObject *owner = getOwner(); @@ -87,8 +87,8 @@ void SPTRefReference::notifyContentChanged(Inkscape::XML::Node &/*node*/, void SPTRefReference::notifyAttributeChanged(Inkscape::XML::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*/) { // Do nothing - tref only cares about textual content } diff --git a/src/sp-tref-reference.h b/src/sp-tref-reference.h index b555ace2d..516e125c1 100644 --- a/src/sp-tref-reference.h +++ b/src/sp-tref-reference.h @@ -52,11 +52,11 @@ public: virtual void notifyChildOrderChanged(Inkscape::XML::Node &node, Inkscape::XML::Node &child, Inkscape::XML::Node *old_prev, Inkscape::XML::Node *new_prev); virtual void notifyContentChanged(Inkscape::XML::Node &node, - Inkscape::Util::ptr_shared<char> old_content, - Inkscape::Util::ptr_shared<char> new_content); + Inkscape::Util::ptr_shared old_content, + Inkscape::Util::ptr_shared new_content); virtual void notifyAttributeChanged(Inkscape::XML::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); ///////////////////////////////////////////////////////////////////// protected: diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 49ffa38f5..b50d68239 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -148,8 +148,8 @@ public: _pnl->_objectsChanged( _obj ); } } - virtual void notifyContentChanged( Node &/*node*/, Util::ptr_shared<char> /*old_content*/, Util::ptr_shared<char> /*new_content*/ ) {} - virtual void notifyAttributeChanged( Node &/*node*/, GQuark name, Util::ptr_shared<char> /*old_value*/, Util::ptr_shared<char> /*new_value*/ ) { + virtual void notifyContentChanged( Node &/*node*/, Util::ptr_shared /*old_content*/, Util::ptr_shared /*new_content*/ ) {} + virtual void notifyAttributeChanged( Node &/*node*/, GQuark name, Util::ptr_shared /*old_value*/, Util::ptr_shared /*new_value*/ ) { if ( _pnl && _obj ) { if ( name == _lockedAttr || name == _labelAttr || name == _highlightAttr || name == _groupAttr || name == _styleAttr || name == _clipAttr || name == _maskAttr ) { _pnl->_updateObject(_obj, name == _highlightAttr); diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index aa453e8e8..60138fa89 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -56,8 +56,8 @@ public: }; virtual void notifyContentChanged(Inkscape::XML::Node &node, - Inkscape::Util::ptr_shared<char> old_content, - Inkscape::Util::ptr_shared<char> new_content); + Inkscape::Util::ptr_shared old_content, + Inkscape::Util::ptr_shared new_content); StyleDialog * _styleDialog; }; @@ -66,8 +66,8 @@ public: void StyleDialog::NodeObserver::notifyContentChanged( Inkscape::XML::Node &/*node*/, - Inkscape::Util::ptr_shared<char> /*old_content*/, - Inkscape::Util::ptr_shared<char> /*new_content*/ ) { + Inkscape::Util::ptr_shared /*old_content*/, + Inkscape::Util::ptr_shared /*new_content*/ ) { #ifdef DEBUG_STYLEDIALOG std::cout << "StyleDialog::NodeObserver::notifyContentChanged" << std::endl; @@ -111,8 +111,8 @@ public: virtual void notifyAttributeChanged( Inkscape::XML::Node &node, GQuark qname, - Util::ptr_shared<char> /*old_value*/, - Util::ptr_shared<char> /*new_value*/ ) { + Util::ptr_shared /*old_value*/, + Util::ptr_shared /*new_value*/ ) { if ( _styleDialog && _repr ) { // For the moment only care about attributes that are directly used in selectors. diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp index d804e1f68..ae45654a7 100644 --- a/src/ui/dialog/tags.cpp +++ b/src/ui/dialog/tags.cpp @@ -106,8 +106,8 @@ public: _pnl->_objectsChanged( _obj ); } } - virtual void notifyContentChanged( Node &/*node*/, Util::ptr_shared<char> /*old_content*/, Util::ptr_shared<char> /*new_content*/ ) {} - virtual void notifyAttributeChanged( Node &/*node*/, GQuark name, Util::ptr_shared<char> /*old_value*/, Util::ptr_shared<char> /*new_value*/ ) { + virtual void notifyContentChanged( Node &/*node*/, Util::ptr_shared /*old_content*/, Util::ptr_shared /*new_content*/ ) {} + virtual void notifyAttributeChanged( Node &/*node*/, GQuark name, Util::ptr_shared /*old_value*/, Util::ptr_shared /*new_value*/ ) { if ( _pnl && _obj ) { if ( name == _labelAttr ) { _pnl->_updateObject( _obj); diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index f2899dd01..2c99e7fc8 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -68,7 +68,7 @@ public: } virtual void notifyAttributeChanged(Inkscape::XML::Node &/*node*/, GQuark attr, - Util::ptr_shared<char>, Util::ptr_shared<char>) + Util::ptr_shared, Util::ptr_shared) { // do nothing if blocked if (_blocked) return; diff --git a/src/util/format.h b/src/util/format.h index 690121254..d2fe2d0ef 100644 --- a/src/util/format.h +++ b/src/util/format.h @@ -20,20 +20,20 @@ namespace Inkscape { namespace Util { -inline ptr_shared<char> vformat(char const *format, va_list args) { +inline ptr_shared vformat(char const *format, va_list args) { char *temp=g_strdup_vprintf(format, args); - ptr_shared<char> result=share_string(temp); + ptr_shared result=share_string(temp); g_free(temp); return result; } // needed since G_GNUC_PRINTF can only be used on a declaration - ptr_shared<char> format(char const *format, ...) G_GNUC_PRINTF(1,2); -inline ptr_shared<char> format(char const *format, ...) { + ptr_shared format(char const *format, ...) G_GNUC_PRINTF(1,2); +inline ptr_shared format(char const *format, ...) { va_list args; va_start(args, format); - ptr_shared<char> result=vformat(format, args); + ptr_shared result=vformat(format, args); va_end(args); return result; diff --git a/src/util/share.cpp b/src/util/share.cpp index 3cb289b10..d5d93fc75 100644 --- a/src/util/share.cpp +++ b/src/util/share.cpp @@ -1,5 +1,6 @@ /* - * Inkscape::Util::ptr_shared<T> - like T const *, but stronger + * Inkscape::Util::ptr_shared<T> - like T const *, but stronger. + * Used to hold c-style strings for objects that are managed by the gc. * * Authors: * MenTaLguY <mental@rydia.net> @@ -15,13 +16,13 @@ namespace Inkscape { namespace Util { -ptr_shared<char> share_string(char const *string) { - g_return_val_if_fail(string != NULL, share_unsafe<char>(NULL)); +ptr_shared share_string(char const *string) { + g_return_val_if_fail(string != NULL, share_unsafe(NULL)); return share_string(string, std::strlen(string)); } -ptr_shared<char> share_string(char const *string, std::size_t length) { - g_return_val_if_fail(string != NULL, share_unsafe<char>(NULL)); +ptr_shared share_string(char const *string, std::size_t length) { + g_return_val_if_fail(string != NULL, share_unsafe(NULL)); char *new_string=new (GC::ATOMIC) char[length+1]; std::memcpy(new_string, string, length); new_string[length] = 0; diff --git a/src/util/share.h b/src/util/share.h index 8f1e7045a..6e5a24d71 100644 --- a/src/util/share.h +++ b/src/util/share.h @@ -1,5 +1,6 @@ /* - * Inkscape::Util::ptr_shared<T> - like T const *, but stronger + * Inkscape::Util::ptr_shared<T> - like T const *, but stronger. + * Used to hold c-style strings for objects that are managed by the gc. * * Authors: * MenTaLguY <mental@rydia.net> @@ -19,120 +20,84 @@ namespace Inkscape { namespace Util { -template <typename T> class ptr_shared { public: - ptr_shared() : _obj(NULL) {} - template <typename T1> - ptr_shared(ptr_shared<T1> const &other) : _obj(other._obj) {} + ptr_shared() : _string(NULL) {} + ptr_shared(ptr_shared const &other) : _string(other._string) {} - T const *pointer() const { return _obj; } + operator char const *() const { return _string; } + operator bool() const { return _string; } - template <typename T1> - operator T1 const *() const { return _obj; } + char const *pointer() const { return _string; } + char const &operator[](int i) const { return _string[i]; } - operator bool() const { return _obj; } - - T const &operator*() const { return *_obj; } - T const *operator->() const { return _obj; } - T const &operator[](int i) const { return _obj[i]; } - - ptr_shared<T> operator+(int i) const { - return share_unsafe(_obj+i); + ptr_shared operator+(int i) const { + return share_unsafe(_string+i); } - ptr_shared<T> operator-(int i) const { - return share_unsafe(_obj-i); + ptr_shared operator-(int i) const { + return share_unsafe(_string-i); } - - ptr_shared<T> &operator+=(int i) const { - _obj += i; + //WARNING: No bounds checking in += and -= functions. Moving the pointer + //past the end of the string and then back could probably cause the garbage + //collector to deallocate the string inbetween, as there's temporary no + //valid reference pointing into the allocated space. + ptr_shared &operator+=(int i) { + _string += i; return *this; } - ptr_shared<T> &operator-=(int i) const { - _obj -= i; + ptr_shared &operator-=(int i) { + _string -= i; return *this; } - - template <typename T1> - std::ptrdiff_t operator-(ptr_shared<T1> const &other) { - return _obj - other._obj; + std::ptrdiff_t operator-(ptr_shared const &other) { + return _string - other._string; } - template <typename T1> - ptr_shared<T> &operator=(ptr_shared<T1> const &other) { - _obj = other._obj; + ptr_shared &operator=(ptr_shared const &other) { + _string = other._string; return *this; } - template <typename T1> - bool operator==(ptr_shared<T1> const &other) const { - return _obj == other._obj; + bool operator==(ptr_shared const &other) const { + return _string == other._string; } - - template <typename T1> - bool operator!=(ptr_shared<T1> const &other) const { - return _obj != other._obj; + bool operator!=(ptr_shared const &other) const { + return _string != other._string; } - - template <typename T1> - bool operator>(ptr_shared<T1> const &other) const { - return _obj > other._obj; + bool operator>(ptr_shared const &other) const { + return _string > other._string; } - - template <typename T1> - bool operator<(ptr_shared<T1> const &other) const { - return _obj < other._obj; - } - - static ptr_shared<T> share_unsafe(T const *obj) { - return ptr_shared<T>(obj); + bool operator<(ptr_shared const &other) const { + return _string < other._string; } -protected: - explicit ptr_shared(T const *obj) : _obj(obj) {} + friend ptr_shared share_unsafe(char const *string); private: - T const *_obj; -}; - -template <typename T> -inline ptr_shared<T> share(T const *obj) { - return share_unsafe(obj ? new T(*obj) : NULL); -} + ptr_shared(char const *string) : _string(string) {} + static ptr_shared share_unsafe(char const *string) { + return ptr_shared(string); + } -ptr_shared<char> share_string(char const *string); -ptr_shared<char> share_string(char const *string, std::size_t length); + //This class (and code usign it) assumes that it never has to free this + //pointer, and that the memory it points to will not be freed as long as a + //ptr_shared pointing to it exists. + char const *_string; +}; -template <typename T> -inline ptr_shared<T> reshare(T const *obj) { - return ptr_shared<T>::share_unsafe(obj); -} +ptr_shared share_string(char const *string); +ptr_shared share_string(char const *string, std::size_t length); -template <typename T> -inline ptr_shared<T> share_unsafe(T const *obj) { - return ptr_shared<T>::share_unsafe(obj); +inline ptr_shared share_unsafe(char const *string) { + return ptr_shared::share_unsafe(string); } -inline ptr_shared<char> share_static_string(char const *string) { +//TODO: Do we need this function? +inline ptr_shared share_static_string(char const *string) { return share_unsafe(string); } -template <typename T1, typename T2> -inline ptr_shared<T1> static_cast_shared(ptr_shared<T2> const &ref) { - return reshare(static_cast<T1 const *>(ref.pointer())); -} - -template <typename T1, typename T2> -inline ptr_shared<T1> dynamic_cast_shared(ptr_shared<T2> const &ref) { - return reshare(dynamic_cast<T1 const *>(ref.pointer())); -} - -template <typename T1, typename T2> -inline ptr_shared<T1> reinterpret_cast_shared(ptr_shared<T2> const &ref) { - return reshare(reinterpret_cast<T1 const *>(ref.pointer())); -} - } } 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. <!-- Some comment --> */ 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. <?xml version="1.0" encoding="utf-8" standalone="no"?> */ 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 <group>Some text</group> */ 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); |
