summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 74ba6bb)
raw | patch | inline | side by side (parent: 74ba6bb)
author | mental <mental@users.sourceforge.net> | |
Wed, 15 Mar 2006 03:22:23 +0000 (03:22 +0000) | ||
committer | mental <mental@users.sourceforge.net> | |
Wed, 15 Mar 2006 03:22:23 +0000 (03:22 +0000) |
31 files changed:
diff --git a/ChangeLog b/ChangeLog
index 5c7519736f95c6dbbdaefb976b72c4b61f8cf7e7..dbebc8778c12ed0c330de0c65d0f49708251142a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2006-03-14 MenTaLguY <mental@rydia.net>
+
+ * src/debug/event.h, src/debug/gc-heap.h, src/debug/heap.h,
+ src/debug/logger.cpp, src/debug/simple-event.h,
+ src/debug/sysv-heap.h, src/jabber_whiteboard/deserializer.cpp,
+ src/jabber_whiteboard/message-utilities.cpp,
+ src/jabber_whiteboard/message-utilities.h,
+ src/jabber_whiteboard/node-tracker-observer.h,
+ src/jabber_whiteboard/serializer.cpp,
+ src/jabber_whiteboard/serializer.h,
+ src/sp-object.cpp, src/util/share.cpp, src/util/share.h,
+ src/xml/attribute-record.h, src/xml/comment-node.h,
+ src/xml/composite-node-observer.cpp, src/xml/composite-node-observer.h,
+ src/xml/event.cpp, src/xml/event.h, src/xml/log-builder.cpp,
+ src/xml/log-builder.h, src/xml/node-observer.h, src/xml/repr-io.cpp,
+ src/xml/simple-node.cpp, src/xml/simple-node.h,
+ src/xml/simple-session.cpp, src/xml/simple-session.h,
+ src/xml/text-node.h:
+
+ shared_ptr -> ptr_shared
+
2006-03-13 Peter Moulder <pmoulder@mail.csse.monash.edu.au>
* src/svg/svg-color.cpp (sp_svg_write_color): More readable colour
diff --git a/src/debug/event.h b/src/debug/event.h
index 8232f890df9250b6414cf94a7406d03e8410ab91..fdc50f225a00f9aad069fb2272344cf9af86e34a 100644 (file)
--- a/src/debug/event.h
+++ b/src/debug/event.h
struct PropertyPair {
public:
PropertyPair() {}
- PropertyPair(Util::shared_ptr<char> n, Util::shared_ptr<char> v)
+ PropertyPair(Util::ptr_shared<char> n, Util::ptr_shared<char> v)
: name(n), value(v) {}
- PropertyPair(char const *n, Util::shared_ptr<char> v)
+ PropertyPair(char const *n, Util::ptr_shared<char> v)
: name(Util::share_string(n)), value(v) {}
- PropertyPair(Util::shared_ptr<char> n, char const *v)
+ PropertyPair(Util::ptr_shared<char> 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::shared_ptr<char> name;
- Util::shared_ptr<char> value;
+ Util::ptr_shared<char> name;
+ Util::ptr_shared<char> value;
};
static Category category() { return OTHER; }
- virtual Util::shared_ptr<char> name() const=0;
+ virtual Util::ptr_shared<char> 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 75a60158ee3f066232152280c68ede961c06fd0f..4d0343f12ce77753aa030db9c0839bd0d6d70d0e 100644 (file)
--- a/src/debug/gc-heap.h
+++ b/src/debug/gc-heap.h
int features() const {
return SIZE_AVAILABLE | USED_AVAILABLE | GARBAGE_COLLECTED;
}
- Util::shared_ptr<char> name() const {
+ Util::ptr_shared<char> 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 ef563030fe150699e0da86f0c7ac0009eed9442b..f3cc250a5a643bef50c6a6b3284b347a08499249 100644 (file)
--- a/src/debug/heap.h
+++ b/src/debug/heap.h
virtual int features() const=0;
- virtual Util::shared_ptr<char> name() const=0;
+ virtual Util::ptr_shared<char> 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 3acd95ff523e6a78588d3bb1a9293b3a619e38d0..a3f6899ef9ae0d8a2d1e0408fbb2957360bf1156 100644 (file)
--- a/src/debug/logger.cpp
+++ b/src/debug/logger.cpp
namespace {
-static void write_escaped_value(std::ostream &os, Util::shared_ptr<char> value) {
+static void write_escaped_value(std::ostream &os, Util::ptr_shared<char> value) {
for ( char const *current=value ; *current ; ++current ) {
switch (*current) {
case '&':
static std::ofstream log_stream;
static bool empty_tag=false;
-typedef std::vector<Util::shared_ptr<char>, GC::Alloc<Util::shared_ptr<char>, GC::MANUAL> > TagStack;
+typedef std::vector<Util::ptr_shared<char>, GC::Alloc<Util::ptr_shared<char>, GC::MANUAL> > TagStack;
static TagStack &tag_stack() {
static TagStack stack;
return stack;
}
void Logger::_start(Event const &event) {
- Util::shared_ptr<char> name=event.name();
+ Util::ptr_shared<char> name=event.name();
if (empty_tag) {
log_stream << ">\n";
}
void Logger::_skip() {
- tag_stack().push_back(Util::shared_ptr<char>());
+ tag_stack().push_back(Util::ptr_shared<char>());
}
void Logger::_finish() {
index 90eed3a0ef04241220caaf00dea48262a0f376b2..3695eaa6a921edaaa405f42367c0a62d9c26f20a 100644 (file)
--- a/src/debug/simple-event.h
+++ b/src/debug/simple-event.h
template <Event::Category C=Event::OTHER>
class SimpleEvent : public Event {
public:
- SimpleEvent(Util::shared_ptr<char> name) : _name(name) {}
+ SimpleEvent(Util::ptr_shared<char> name) : _name(name) {}
SimpleEvent(char const *name) : _name(Util::share_string(name)) {}
static Category category() { return C; }
- Util::shared_ptr<char> name() const { return _name; }
+ Util::ptr_shared<char> name() const { return _name; }
unsigned propertyCount() const { return 0; }
PropertyPair property(unsigned property) const { return PropertyPair(); }
private:
- Util::shared_ptr<char> _name;
+ Util::ptr_shared<char> _name;
};
}
diff --git a/src/debug/sysv-heap.h b/src/debug/sysv-heap.h
index 840afac3261b687b7f2c40a2103f895027f6d5e9..82fe9b7696edc62a213fc26c2fcba3833169a860 100644 (file)
--- a/src/debug/sysv-heap.h
+++ b/src/debug/sysv-heap.h
int features() const;
- Util::shared_ptr<char> name() const {
+ Util::ptr_shared<char> name() const {
return Util::share_static_string("standard malloc()");
}
Stats stats() const;
index 2df35e8abf2115a3eb127c9af449b445b4e9897d..0e207122fda4e9fcc3c33f48009a4f02288485f0 100644 (file)
{
// 1. Extract required attributes: node ID. If we do not know these, return.
std::string id;
- Util::shared_ptr<char> oldval, newval;
+ Util::ptr_shared<char> oldval, newval;
Node buf;
buf.tag = MESSAGE_ID;
// 2. Extract optional attributes: new value. If we do not find it in the message,
// assume there is no new value.
buf.tag = MESSAGE_NEWVAL;
- Util::shared_ptr<char> newval;
+ Util::ptr_shared<char> newval;
if (MessageUtilities::findTag(buf, msg)) {
newval = Util::share_string(buf.data.c_str());
} else {
// 3. Extract optional attributes: old value. If we do not find it in the message,
// assume that there is no old value.
buf.tag = MESSAGE_OLDVAL;
- Util::shared_ptr<char> oldval;
+ Util::ptr_shared<char> oldval;
if (MessageUtilities::findTag(buf, msg)) {
oldval = Util::share_string(buf.data.c_str());
} else {
diff --git a/src/jabber_whiteboard/message-utilities.cpp b/src/jabber_whiteboard/message-utilities.cpp
index 2812e303b8ef9cb97510357697bf5e93ae720597..c10521b61db945709839ae428b73bdc583007e8e 100644 (file)
@@ -297,7 +297,7 @@ MessageUtilities::objectDeleteMessage(Glib::ustring* msgbuf, XMLNodeTracker* xmt
}
void
-MessageUtilities::contentChangeMessage(Glib::ustring& msgbuf, std::string const nodeid, Util::shared_ptr<char> old_value, Util::shared_ptr<char> new_value)
+MessageUtilities::contentChangeMessage(Glib::ustring& msgbuf, std::string const nodeid, Util::ptr_shared<char> old_value, Util::ptr_shared<char> new_value)
{
if (!nodeid.empty()) {
// <MESSAGE_NODECONTENT>
index 8fbefac181787815e3b4f5a0c0e7827386448d17..c6d464f0861b57490450d916b52e379631445b2d 100644 (file)
namespace Util {
template <typename T>
-class shared_ptr;
+class ptr_shared;
}
static void newObjectMessage(ustring* msgbuf, KeyToNodeMap& newidsbuf, NodeToKeyMap& newnodesbuf, NewChildObjectMessageList& childmsgbuf, XMLNodeTracker* xmt, Inkscape::XML::Node const* node, bool only_collect_nodes = false, bool collect_children = true);
static void objectChangeMessage(ustring* msgbuf, XMLNodeTracker* xmt, std::string const id, gchar const* key, gchar const* oldval, gchar const* newval, bool is_interactive);
static void objectDeleteMessage(ustring* msgbuf, XMLNodeTracker* xmt, Inkscape::XML::Node const& parent, Inkscape::XML::Node const& child, Inkscape::XML::Node const* prev);
- static void contentChangeMessage(ustring& msgbuf, std::string const nodeid, Util::shared_ptr<char> old_value, Util::shared_ptr<char> new_value);
+ static void contentChangeMessage(ustring& msgbuf, std::string const nodeid, Util::ptr_shared<char> old_value, Util::ptr_shared<char> new_value);
static void childOrderChangeMessage(ustring& msgbuf, std::string const childid, std::string const oldprevid, std::string const newprevid);
// Message parsing utilities
diff --git a/src/jabber_whiteboard/node-tracker-observer.h b/src/jabber_whiteboard/node-tracker-observer.h
index a3260d8a0240800a91597217eeecfa37fb826bb1..86aa5c3046f7305468e9a4157f0ef4d2f627747b 100644 (file)
XML::Node *old_prev, XML::Node *new_prev)=0;
virtual void notifyContentChanged(XML::Node &node,
- Util::shared_ptr<char> old_content,
- Util::shared_ptr<char> new_content)=0;
+ Util::ptr_shared<char> old_content,
+ Util::ptr_shared<char> new_content)=0;
virtual void notifyAttributeChanged(XML::Node &node, GQuark name,
- Util::shared_ptr<char> old_value,
- Util::shared_ptr<char> new_value)=0;
+ Util::ptr_shared<char> old_value,
+ Util::ptr_shared<char> new_value)=0;
// ...but we do provide node tracking facilities
index eb52780472a5a92fb0f048ef6dacf93211cdc7b4..094944257338f1430830608e50ac91b9bf4c2698 100644 (file)
Inkscape::Util::List<Inkscape::XML::AttributeRecord const> attrlist = child.attributeList();
for(; attrlist; attrlist++) {
- this->notifyAttributeChanged(child, attrlist->key, Util::shared_ptr<char>(), attrlist->value);
+ this->notifyAttributeChanged(child, attrlist->key, Util::ptr_shared<char>(), attrlist->value);
}
if (child.content()) {
- this->notifyContentChanged(child, Util::shared_ptr<char>(), Util::share_string(child.content()));
+ this->notifyContentChanged(child, Util::ptr_shared<char>(), Util::share_string(child.content()));
}
this->_attributes_scanned.insert(childid);
@@ -188,7 +188,7 @@ Serializer::notifyChildOrderChanged(XML::Node& node, XML::Node& child, XML::Node
}
void
-Serializer::notifyContentChanged(XML::Node& node, Util::shared_ptr<char> old_content, Util::shared_ptr<char> new_content)
+Serializer::notifyContentChanged(XML::Node& node, Util::ptr_shared<char> old_content, Util::ptr_shared<char> new_content)
{
// 1. Find the ID of the node, or generate it if it does not exist.
std::string nodeid = this->_findOrGenerateNodeID(node);
@@ -221,7 +221,7 @@ Serializer::notifyContentChanged(XML::Node& node, Util::shared_ptr<char> old_con
}
void
-Serializer::notifyAttributeChanged(XML::Node& node, GQuark name, Util::shared_ptr<char> old_value, Util::shared_ptr<char> new_value)
+Serializer::notifyAttributeChanged(XML::Node& node, GQuark name, Util::ptr_shared<char> old_value, Util::ptr_shared<char> new_value)
{
// 1. Find the ID of the node that has had an attribute modified, or generate it if it
// does not exist.
index 16889c571f15119352b6feec2c1d378cec0ee62b..2884d43d3219f1d7ac4c4639db2f5f3096cc829d 100644 (file)
XML::Node *old_prev, XML::Node *new_prev);
void notifyContentChanged(XML::Node &node,
- Util::shared_ptr<char> old_content,
- Util::shared_ptr<char> new_content);
+ Util::ptr_shared<char> old_content,
+ Util::ptr_shared<char> new_content);
void notifyAttributeChanged(XML::Node &node, GQuark name,
- Util::shared_ptr<char> old_value,
- Util::shared_ptr<char> new_value);
+ Util::ptr_shared<char> old_value,
+ Util::ptr_shared<char> new_value);
void synthesizeChildNodeAddEvents();
diff --git a/src/sp-object.cpp b/src/sp-object.cpp
index 5f6bf779fabc2d90c011ce32469ee5ddf736a517..9068c4ba2ae0e0b2bdf19f6e65739df32077db58 100644 (file)
--- a/src/sp-object.cpp
+++ b/src/sp-object.cpp
namespace {
-Inkscape::Util::shared_ptr<char> stringify(SPObject *obj) {
+Inkscape::Util::ptr_shared<char> stringify(SPObject *obj) {
char *temp=g_strdup_printf("%p", obj);
- Inkscape::Util::shared_ptr<char> result=Inkscape::Util::share_string(temp);
+ Inkscape::Util::ptr_shared<char> result=Inkscape::Util::share_string(temp);
g_free(temp);
return result;
}
-Inkscape::Util::shared_ptr<char> stringify(unsigned n) {
+Inkscape::Util::ptr_shared<char> stringify(unsigned n) {
char *temp=g_strdup_printf("%u", n);
- Inkscape::Util::shared_ptr<char> result=Inkscape::Util::share_string(temp);
+ Inkscape::Util::ptr_shared<char> result=Inkscape::Util::share_string(temp);
g_free(temp);
return result;
}
static Category category() { return REFCOUNT; }
- Inkscape::Util::shared_ptr<char> name() const {
+ Inkscape::Util::ptr_shared<char> name() const {
if ( _type == REF) {
return Inkscape::Util::share_static_string("sp-object-ref");
} else {
}
private:
- Inkscape::Util::shared_ptr<char> _object;
+ Inkscape::Util::ptr_shared<char> _object;
unsigned _refcount;
Type _type;
};
diff --git a/src/util/share.cpp b/src/util/share.cpp
index 7f2d09bf67089467f59a8b59c69509313359e03a..2f693fac93204e54f191de09789db98fee5ab50d 100644 (file)
--- a/src/util/share.cpp
+++ b/src/util/share.cpp
/*
- * Inkscape::Util::shared_ptr<T> - like T const *, but stronger
+ * Inkscape::Util::ptr_shared<T> - like T const *, but stronger
*
* Authors:
* MenTaLguY <mental@rydia.net>
namespace Inkscape {
namespace Util {
-shared_ptr<char> share_string(char const *string) {
+ptr_shared<char> share_string(char const *string) {
g_return_val_if_fail(string != NULL, share_unsafe<char>(NULL));
return share_string(string, std::strlen(string));
}
-shared_ptr<char> share_string(char const *string, std::size_t length) {
+ptr_shared<char> share_string(char const *string, std::size_t length) {
g_return_val_if_fail(string != NULL, share_unsafe<char>(NULL));
char *new_string=new (GC::ATOMIC) char[length+1];
std::memcpy(new_string, string, length);
diff --git a/src/util/share.h b/src/util/share.h
index 93cef7a028598a910330694651b0a3be95a35cf7..3a2b73561434210e39279de914cc0a441728baa3 100644 (file)
--- a/src/util/share.h
+++ b/src/util/share.h
/*
- * Inkscape::Util::shared_ptr<T> - like T const *, but stronger
+ * Inkscape::Util::ptr_shared<T> - like T const *, but stronger
*
* Authors:
* MenTaLguY <mental@rydia.net>
namespace Util {
template <typename T>
-class shared_ptr {
+class ptr_shared {
public:
- shared_ptr() : _obj(NULL) {}
+ ptr_shared() : _obj(NULL) {}
template <typename T1>
- shared_ptr(shared_ptr<T1> const &other) : _obj(other._obj) {}
+ ptr_shared(ptr_shared<T1> const &other) : _obj(other._obj) {}
T const *pointer() const { return _obj; }
T const *operator->() const { return _obj; }
T const &operator[](int i) const { return _obj[i]; }
- shared_ptr<T> operator+(int i) const {
+ ptr_shared<T> operator+(int i) const {
return share_unsafe(_obj+i);
}
- shared_ptr<T> operator-(int i) const {
+ ptr_shared<T> operator-(int i) const {
return share_unsafe(_obj-i);
}
- shared_ptr<T> &operator+=(int i) const {
+ ptr_shared<T> &operator+=(int i) const {
_obj += i;
return *this;
}
- shared_ptr<T> &operator-=(int i) const {
+ ptr_shared<T> &operator-=(int i) const {
_obj -= i;
return *this;
}
template <typename T1>
- std::ptrdiff_t operator-(shared_ptr<T1> const &other) {
+ std::ptrdiff_t operator-(ptr_shared<T1> const &other) {
return _obj - other._obj;
}
template <typename T1>
- shared_ptr<T> &operator=(shared_ptr<T1> const &other) {
+ ptr_shared<T> &operator=(ptr_shared<T1> const &other) {
_obj = other._obj;
return *this;
}
template <typename T1>
- bool operator==(shared_ptr<T1> const &other) const {
+ bool operator==(ptr_shared<T1> const &other) const {
return _obj == other._obj;
}
template <typename T1>
- bool operator!=(shared_ptr<T1> const &other) const {
+ bool operator!=(ptr_shared<T1> const &other) const {
return _obj != other._obj;
}
template <typename T1>
- bool operator>(shared_ptr<T1> const &other) const {
+ bool operator>(ptr_shared<T1> const &other) const {
return _obj > other._obj;
}
template <typename T1>
- bool operator<(shared_ptr<T1> const &other) const {
+ bool operator<(ptr_shared<T1> const &other) const {
return _obj < other._obj;
}
- static shared_ptr<T> share_unsafe(T const *obj) {
- return shared_ptr<T>(obj);
+ static ptr_shared<T> share_unsafe(T const *obj) {
+ return ptr_shared<T>(obj);
}
protected:
- explicit shared_ptr(T const *obj) : _obj(obj) {}
+ explicit ptr_shared(T const *obj) : _obj(obj) {}
private:
T const *_obj;
};
template <typename T>
-inline shared_ptr<T> share(T const *obj) {
+inline ptr_shared<T> share(T const *obj) {
return share_unsafe(obj ? new T(*obj) : NULL);
}
-shared_ptr<char> share_string(char const *string);
-shared_ptr<char> share_string(char const *string, std::size_t length);
+ptr_shared<char> share_string(char const *string);
+ptr_shared<char> share_string(char const *string, std::size_t length);
template <typename T>
-inline shared_ptr<T> reshare(T const *obj) {
- return shared_ptr<T>::share_unsafe(obj);
+inline ptr_shared<T> reshare(T const *obj) {
+ return ptr_shared<T>::share_unsafe(obj);
}
template <typename T>
-inline shared_ptr<T> share_unsafe(T const *obj) {
- return shared_ptr<T>::share_unsafe(obj);
+inline ptr_shared<T> share_unsafe(T const *obj) {
+ return ptr_shared<T>::share_unsafe(obj);
}
-inline shared_ptr<char> share_static_string(char const *string) {
+inline ptr_shared<char> share_static_string(char const *string) {
return share_unsafe(string);
}
template <typename T1, typename T2>
-inline shared_ptr<T1> static_cast_shared(shared_ptr<T2> const &ref) {
+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 shared_ptr<T1> dynamic_cast_shared(shared_ptr<T2> const &ref) {
+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 shared_ptr<T1> reinterpret_cast_shared(shared_ptr<T2> const &ref) {
+inline ptr_shared<T1> reinterpret_cast_shared(ptr_shared<T2> const &ref) {
return reshare(reinterpret_cast<T1 const *>(ref.pointer()));
}
index 30d8576d07dbad764a9505bc24fe7a60bb5dc5c0..bfae19e21cb9f714f6119f0c6bf6895e8d239d55 100644 (file)
namespace XML {
struct AttributeRecord : public Inkscape::GC::Managed<> {
- AttributeRecord(GQuark k, Inkscape::Util::shared_ptr<char> v)
+ AttributeRecord(GQuark k, Inkscape::Util::ptr_shared<char> v)
: key(k), value(v) {}
GQuark key;
- Inkscape::Util::shared_ptr<char> value;
+ Inkscape::Util::ptr_shared<char> value;
// accept default copy constructor and assignment operator
};
diff --git a/src/xml/comment-node.h b/src/xml/comment-node.h
index e41a36b59da2983f6c41df1fb29ff4be6103709c..c439d0d541345afee87f1f177a2a675c42ab345f 100644 (file)
--- a/src/xml/comment-node.h
+++ b/src/xml/comment-node.h
namespace XML {
struct CommentNode : public SimpleNode {
- explicit CommentNode(Util::shared_ptr<char> content)
+ explicit CommentNode(Util::ptr_shared<char> content)
: SimpleNode(g_quark_from_static_string("comment"))
{
setContent(content);
index b564da78da431d16e0e7e1489690745a40f9a3a6..bb68ba9c4ac7ba06d26aeb744b1c2c11af04b3f4 100644 (file)
void CompositeNodeObserver::notifyContentChanged(
Node &node,
- Util::shared_ptr<char> old_content, Util::shared_ptr<char> new_content
+ Util::ptr_shared<char> old_content, Util::ptr_shared<char> new_content
) {
_startIteration();
for ( ObserverRecordList::iterator iter=_active.begin() ;
void CompositeNodeObserver::notifyAttributeChanged(
Node &node, GQuark name,
- Util::shared_ptr<char> old_value, Util::shared_ptr<char> new_value
+ Util::ptr_shared<char> old_value, Util::ptr_shared<char> new_value
) {
_startIteration();
for ( ObserverRecordList::iterator iter=_active.begin() ;
}
}
- void notifyContentChanged(Node &node, Util::shared_ptr<char> old_content, Util::shared_ptr<char> new_content) {
+ void notifyContentChanged(Node &node, Util::ptr_shared<char> old_content, Util::ptr_shared<char> new_content) {
if (vector.content_changed) {
vector.content_changed(&node, old_content, new_content, data);
}
}
- void notifyAttributeChanged(Node &node, GQuark name, Util::shared_ptr<char> old_value, Util::shared_ptr<char> new_value) {
+ void notifyAttributeChanged(Node &node, GQuark name, Util::ptr_shared<char> old_value, Util::ptr_shared<char> new_value) {
if (vector.attr_changed) {
vector.attr_changed(&node, g_quark_to_string(name), old_value, new_value, false, data);
}
index 4acde0b4ce08e1c18c455f3c3bed97fe9addcdee..7b5a24d538da89a342898f6535613d92aa2353e2 100644 (file)
Node *old_prev, Node *new_prev);
void notifyContentChanged(Node &node,
- Util::shared_ptr<char> old_content,
- Util::shared_ptr<char> new_content);
+ Util::ptr_shared<char> old_content,
+ Util::ptr_shared<char> new_content);
void notifyAttributeChanged(Node &node, GQuark name,
- Util::shared_ptr<char> old_value,
- Util::shared_ptr<char> new_value);
+ Util::ptr_shared<char> old_value,
+ Util::ptr_shared<char> new_value);
private:
unsigned _iterating;
diff --git a/src/xml/event.cpp b/src/xml/event.cpp
index dd71678743749b5c6572a9bfc17e7a4bbb16e0a0..d91dd681fb5ae912cb7f3909952d82b874cc5b7d 100644 (file)
--- a/src/xml/event.cpp
+++ b/src/xml/event.cpp
}
void notifyAttributeChanged(Node &node, GQuark name,
- Inkscape::Util::shared_ptr<char> old_value,
- Inkscape::Util::shared_ptr<char> new_value)
+ Inkscape::Util::ptr_shared<char> old_value,
+ Inkscape::Util::ptr_shared<char> new_value)
{
node.setAttribute(g_quark_to_string(name), new_value);
}
void notifyContentChanged(Node &node,
- Inkscape::Util::shared_ptr<char> old_value,
- Inkscape::Util::shared_ptr<char> new_value)
+ Inkscape::Util::ptr_shared<char> old_value,
+ Inkscape::Util::ptr_shared<char> new_value)
{
node.setContent(new_value);
}
}
void notifyAttributeChanged(Node &node, GQuark name,
- Inkscape::Util::shared_ptr<char> old_value,
- Inkscape::Util::shared_ptr<char> new_value)
+ Inkscape::Util::ptr_shared<char> old_value,
+ Inkscape::Util::ptr_shared<char> 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());
}
void notifyContentChanged(Node &node,
- Inkscape::Util::shared_ptr<char> old_value,
- Inkscape::Util::shared_ptr<char> new_value)
+ Inkscape::Util::ptr_shared<char> old_value,
+ Inkscape::Util::ptr_shared<char> 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 56fdb8bb60d43e6c7b507ce0597e51553b83c63a..59dbe7c7bc5ab4f2b561d7b733af89e133870f2a 100644 (file)
--- a/src/xml/event.h
+++ b/src/xml/event.h
class EventChgAttr : public Event {
public:
EventChgAttr(Node *repr, GQuark k,
- Inkscape::Util::shared_ptr<char> ov,
- Inkscape::Util::shared_ptr<char> nv,
+ Inkscape::Util::ptr_shared<char> ov,
+ Inkscape::Util::ptr_shared<char> nv,
Event *next)
: Event(repr, next), key(k),
oldval(ov), newval(nv) {}
GQuark key;
- Inkscape::Util::shared_ptr<char> oldval;
- Inkscape::Util::shared_ptr<char> newval;
+ Inkscape::Util::ptr_shared<char> oldval;
+ Inkscape::Util::ptr_shared<char> newval;
private:
Event *_optimizeOne();
class EventChgContent : public Event {
public:
EventChgContent(Node *repr,
- Inkscape::Util::shared_ptr<char> ov,
- Inkscape::Util::shared_ptr<char> nv,
+ Inkscape::Util::ptr_shared<char> ov,
+ Inkscape::Util::ptr_shared<char> nv,
Event *next)
: Event(repr, next), oldval(ov), newval(nv) {}
- Inkscape::Util::shared_ptr<char> oldval;
- Inkscape::Util::shared_ptr<char> newval;
+ Inkscape::Util::ptr_shared<char> oldval;
+ Inkscape::Util::ptr_shared<char> newval;
private:
Event *_optimizeOne();
index 97451075ae00f91d92e7a7bf48813ed8048ddfa6..e8b7c707e121a0dc1b6511d9e8f89be6846da19b 100644 (file)
--- a/src/xml/log-builder.cpp
+++ b/src/xml/log-builder.cpp
}
void LogBuilder::setContent(Node &node,
- Util::shared_ptr<char> old_content,
- Util::shared_ptr<char> new_content)
+ Util::ptr_shared<char> old_content,
+ Util::ptr_shared<char> new_content)
{
_log = new Inkscape::XML::EventChgContent(&node, old_content, new_content, _log);
_log = _log->optimizeOne();
}
void LogBuilder::setAttribute(Node &node, GQuark name,
- Util::shared_ptr<char> old_value,
- Util::shared_ptr<char> new_value)
+ Util::ptr_shared<char> old_value,
+ Util::ptr_shared<char> 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 dc68a4f4a7f4f0bef140b93b081a39d11afbd483..478bf295fd1b9a8de33837706e9e30cb21fb5904 100644 (file)
--- a/src/xml/log-builder.h
+++ b/src/xml/log-builder.h
Node *old_prev, Node *new_prev);
void setContent(Node &node,
- Util::shared_ptr<char> old_content,
- Util::shared_ptr<char> new_content);
+ Util::ptr_shared<char> old_content,
+ Util::ptr_shared<char> new_content);
void setAttribute(Node &node, GQuark name,
- Util::shared_ptr<char> old_value,
- Util::shared_ptr<char> new_value);
+ Util::ptr_shared<char> old_value,
+ Util::ptr_shared<char> new_value);
private:
Event *_log;
index e50a41dd83caa78ba72c74530dc252487ca578e8..584505e4e273ef5ab49f321b2793611d95588468 100644 (file)
--- a/src/xml/node-observer.h
+++ b/src/xml/node-observer.h
Node *old_prev, Node *new_prev)=0;
virtual void notifyContentChanged(Node &node,
- Util::shared_ptr<char> old_content,
- Util::shared_ptr<char> new_content)=0;
+ Util::ptr_shared<char> old_content,
+ Util::ptr_shared<char> new_content)=0;
virtual void notifyAttributeChanged(Node &node, GQuark name,
- Util::shared_ptr<char> old_value,
- Util::shared_ptr<char> new_value)=0;
+ Util::ptr_shared<char> old_value,
+ Util::ptr_shared<char> new_value)=0;
};
}
diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp
index 884bb3360847a0a54eb91d0302fc4cd3f2ecf446..c3222e4ae3d6d93f7ae39e5def55d775b6fb1c1c 100644 (file)
--- a/src/xml/repr-io.cpp
+++ b/src/xml/repr-io.cpp
namespace {
typedef std::map<Glib::QueryQuark, gchar const *, Inkscape::compare_quark_ids> LocalNameMap;
-typedef std::map<Glib::QueryQuark, Inkscape::Util::shared_ptr<char>, Inkscape::compare_quark_ids> NSMap;
+typedef std::map<Glib::QueryQuark, Inkscape::Util::ptr_shared<char>, Inkscape::compare_quark_ids> NSMap;
gchar const *qname_local_name(Glib::QueryQuark qname) {
static LocalNameMap local_name_map;
}
void add_ns_map_entry(NSMap &ns_map, Glib::QueryQuark prefix) {
- using Inkscape::Util::shared_ptr;
+ using Inkscape::Util::ptr_shared;
using Inkscape::Util::share_unsafe;
static const Glib::QueryQuark xml_prefix("xml");
g_warning("No namespace known for normalized prefix %s", g_quark_to_string(prefix));
}
} else {
- ns_map.insert(NSMap::value_type(prefix, shared_ptr<char>()));
+ ns_map.insert(NSMap::value_type(prefix, ptr_shared<char>()));
}
}
}
void
sp_repr_write_stream_root_element (Node *repr, Writer &out, gboolean add_whitespace, gchar const *default_ns)
{
- using Inkscape::Util::shared_ptr;
+ using Inkscape::Util::ptr_shared;
g_assert(repr != NULL);
Glib::QueryQuark xml_prefix=g_quark_from_static_string("xml");
@@ -664,7 +664,7 @@ sp_repr_write_stream_root_element (Node *repr, Writer &out, gboolean add_whitesp
for ( NSMap::iterator iter=ns_map.begin() ; iter != ns_map.end() ; ++iter )
{
Glib::QueryQuark prefix=(*iter).first;
- shared_ptr<char> ns_uri=(*iter).second;
+ ptr_shared<char> ns_uri=(*iter).second;
if (prefix.id()) {
if ( prefix != xml_prefix ) {
index d83e5d54bac2cc72519392543fa5282a75bc876b..17339271fc0549135bbf3e97d70bc32332a4e108 100644 (file)
--- a/src/xml/simple-node.cpp
+++ b/src/xml/simple-node.cpp
namespace {
-Util::shared_ptr<char> stringify_node(Node const &node) {
+Util::ptr_shared<char> stringify_node(Node const &node) {
gchar *string;
switch (node.type()) {
case ELEMENT_NODE: {
default:
string = g_strdup_printf("unknown(%p)", &node);
}
- Util::shared_ptr<char> result=Util::share_string(string);
+ Util::ptr_shared<char> result=Util::share_string(string);
g_free(string);
return result;
}
-Util::shared_ptr<char> stringify_unsigned(unsigned n) {
+Util::ptr_shared<char> stringify_unsigned(unsigned n) {
gchar *string = g_strdup_printf("%u", n);
- Util::shared_ptr<char> result=Util::share_string(string);
+ Util::ptr_shared<char> result=Util::share_string(string);
g_free(string);
return result;
}
static Category category() { return XML; }
- Util::shared_ptr<char> name() const {
+ Util::ptr_shared<char> name() const {
return Util::share_static_string("add-child");
}
unsigned propertyCount() const { return 3; }
}
}
private:
- Util::shared_ptr<char> _parent;
- Util::shared_ptr<char> _child;
+ Util::ptr_shared<char> _parent;
+ Util::ptr_shared<char> _child;
unsigned _position;
};
static Category category() { return XML; }
- Util::shared_ptr<char> name() const {
+ Util::ptr_shared<char> name() const {
return Util::share_static_string("remove-child");
}
unsigned propertyCount() const { return 2; }
}
}
private:
- Util::shared_ptr<char> _parent;
- Util::shared_ptr<char> _child;
+ Util::ptr_shared<char> _parent;
+ Util::ptr_shared<char> _child;
};
class DebugSetChildPosition : public Debug::Event {
static Category category() { return XML; }
- Util::shared_ptr<char> name() const {
+ Util::ptr_shared<char> name() const {
return Util::share_static_string("set-child-position");
}
unsigned propertyCount() const { return 3; }
}
}
private:
- Util::shared_ptr<char> _parent;
- Util::shared_ptr<char> _child;
+ Util::ptr_shared<char> _parent;
+ Util::ptr_shared<char> _child;
unsigned _position;
};
class DebugSetContent : public Debug::Event {
public:
DebugSetContent(Node const &node,
- Util::shared_ptr<char> old_content,
- Util::shared_ptr<char> new_content)
+ Util::ptr_shared<char> old_content,
+ Util::ptr_shared<char> new_content)
: _node(stringify_node(node)), _content(new_content) {}
static Category category() { return XML; }
- Util::shared_ptr<char> name() const {
+ Util::ptr_shared<char> name() const {
if (_content) {
return Util::share_static_string("set-content");
} else {
}
}
private:
- Util::shared_ptr<char> _node;
- Util::shared_ptr<char> _content;
+ Util::ptr_shared<char> _node;
+ Util::ptr_shared<char> _content;
};
class DebugSetAttribute : public Debug::Event {
public:
DebugSetAttribute(Node const &node, GQuark name,
- Util::shared_ptr<char> old_value,
- Util::shared_ptr<char> new_value)
+ Util::ptr_shared<char> old_value,
+ Util::ptr_shared<char> new_value)
: _node(stringify_node(node)),
_name(Util::share_unsafe(g_quark_to_string(name))),
_value(new_value) {}
static Category category() { return XML; }
- Util::shared_ptr<char> name() const {
+ Util::ptr_shared<char> name() const {
if (_value) {
return Util::share_static_string("set-attribute");
} else {
}
private:
- Util::shared_ptr<char> _node;
- Util::shared_ptr<char> _name;
- Util::shared_ptr<char> _value;
+ Util::ptr_shared<char> _node;
+ Util::ptr_shared<char> _name;
+ Util::ptr_shared<char> _value;
};
-using Inkscape::Util::shared_ptr;
+using Inkscape::Util::ptr_shared;
using Inkscape::Util::share_string;
using Inkscape::Util::share_unsafe;
using Inkscape::Util::share_static_string;
}
void SimpleNode::setContent(gchar const *content) {
- shared_ptr<char> old_content=_content;
- shared_ptr<char> new_content = ( content ? share_string(content) : shared_ptr<char>() );
+ ptr_shared<char> old_content=_content;
+ ptr_shared<char> new_content = ( content ? share_string(content) : ptr_shared<char>() );
Debug::EventTracker<DebugSetContent> tracker(
*this, old_content, new_content
@@ -402,9 +402,9 @@ SimpleNode::setAttribute(gchar const *name, gchar const *value, bool const is_in
Debug::EventTracker<> tracker;
- shared_ptr<char> old_value=( existing ? existing->value : shared_ptr<char>() );
+ ptr_shared<char> old_value=( existing ? existing->value : ptr_shared<char>() );
- shared_ptr<char> new_value=shared_ptr<char>();
+ ptr_shared<char> new_value=ptr_shared<char>();
if (value) {
new_value = share_string(value);
tracker.set<DebugSetAttribute>(*this, key, old_value, new_value);
diff --git a/src/xml/simple-node.h b/src/xml/simple-node.h
index f1cf786805cda2ec9d6538e45e85595f4b3f0c17..367516ee797fbbf93f3ee5d68af855fe64aaf45f 100644 (file)
--- a/src/xml/simple-node.h
+++ b/src/xml/simple-node.h
Inkscape::Util::MutableList<AttributeRecord> _attributes;
- Inkscape::Util::shared_ptr<char> _content;
+ Inkscape::Util::ptr_shared<char> _content;
unsigned _child_count;
mutable bool _cached_positions_valid;
index c8d873fd262c5dbdfb9a460032076a71b7b38ca6..d5c17a540381296ed5b8c5c43667492d3cb1d579 100644 (file)
}
void SimpleSession::notifyContentChanged(Node &node,
- Util::shared_ptr<char> old_content,
- Util::shared_ptr<char> new_content)
+ Util::ptr_shared<char> old_content,
+ Util::ptr_shared<char> new_content)
{
if (_in_transaction) {
_log_builder.setContent(node, old_content, new_content);
void SimpleSession::notifyAttributeChanged(Node &node,
GQuark name,
- Util::shared_ptr<char> old_value,
- Util::shared_ptr<char> new_value)
+ Util::ptr_shared<char> old_value,
+ Util::ptr_shared<char> new_value)
{
if (_in_transaction) {
_log_builder.setAttribute(node, name, old_value, new_value);
index 9e3693d9a4b1be3a149d7151eeb06d7d7c359f78..ecd61ba080c85c72b8fdee037ee562eab0fda55c 100644 (file)
--- a/src/xml/simple-session.h
+++ b/src/xml/simple-session.h
Inkscape::XML::Node *old_prev, Inkscape::XML::Node *new_prev);
void notifyContentChanged(Inkscape::XML::Node &node,
- Util::shared_ptr<char> old_content,
- Util::shared_ptr<char> new_content);
+ Util::ptr_shared<char> old_content,
+ Util::ptr_shared<char> new_content);
void notifyAttributeChanged(Inkscape::XML::Node &node, GQuark name,
- Util::shared_ptr<char> old_value,
- Util::shared_ptr<char> new_value);
+ Util::ptr_shared<char> old_value,
+ Util::ptr_shared<char> new_value);
private:
SimpleSession(SimpleSession const &); // no copy
diff --git a/src/xml/text-node.h b/src/xml/text-node.h
index bcd1c3e4f0d3727a7deaa75098956a1a403b4cf1..bd6095f3b1658ea86f6c27f9a8f81b906efc2067 100644 (file)
--- a/src/xml/text-node.h
+++ b/src/xml/text-node.h
namespace XML {
struct TextNode : public SimpleNode {
- TextNode(Util::shared_ptr<char> content)
+ TextNode(Util::ptr_shared<char> content)
: SimpleNode(g_quark_from_static_string("string"))
{
setContent(content);