summaryrefslogtreecommitdiffstats
path: root/src/object/uri.cpp
diff options
context:
space:
mode:
authorThomas Holder <thomas@thomas-holder.de>2018-12-16 10:10:13 +0000
committerThomas Holder <thomas@thomas-holder.de>2018-12-16 10:10:13 +0000
commit44a3c91e7eafa402acfd551ee4bf41ed36dfa8f8 (patch)
tree6e6b39ba25ea264787772458b6c1e2c7b7f84675 /src/object/uri.cpp
parentadd some Inkscape::URI tests (diff)
downloadinkscape-44a3c91e7eafa402acfd551ee4bf41ed36dfa8f8.tar.gz
inkscape-44a3c91e7eafa402acfd551ee4bf41ed36dfa8f8.zip
Inkscape::URI::Impl -> shared_ptr
Diffstat (limited to 'src/object/uri.cpp')
-rw-r--r--src/object/uri.cpp45
1 files changed, 2 insertions, 43 deletions
diff --git a/src/object/uri.cpp b/src/object/uri.cpp
index 2604ee640..df55508da 100644
--- a/src/object/uri.cpp
+++ b/src/object/uri.cpp
@@ -43,12 +43,7 @@ static bool uri_needs_escaping(char const *uri)
}
URI::URI() {
- _impl = Impl::create(xmlCreateURI());
-}
-
-URI::URI(const URI &uri) {
- uri._impl->reference();
- _impl = uri._impl;
+ init(xmlCreateURI());
}
URI::URI(gchar const *preformed, char const *baseuri)
@@ -96,7 +91,7 @@ URI::URI(gchar const *preformed, char const *baseuri)
if (!uri) {
throw MalformedURIException();
}
- _impl = Impl::create(uri);
+ init(uri);
}
URI::URI(char const *preformed, URI const &baseuri)
@@ -104,42 +99,6 @@ URI::URI(char const *preformed, URI const &baseuri)
{
}
-URI::~URI() {
- _impl->unreference();
-}
-
-URI &URI::operator=(URI const &uri) {
-// No check for self-assignment needed, as _impl refcounting increments first.
- uri._impl->reference();
- _impl->unreference();
- _impl = uri._impl;
- return *this;
-}
-
-URI::Impl *URI::Impl::create(xmlURIPtr uri) {
- return new Impl(uri);
-}
-
-URI::Impl::Impl(xmlURIPtr uri)
-: _refcount(1), _uri(uri) {}
-
-URI::Impl::~Impl() {
- if (_uri) {
- xmlFreeURI(_uri);
- _uri = nullptr;
- }
-}
-
-void URI::Impl::reference() {
- _refcount++;
-}
-
-void URI::Impl::unreference() {
- if (!--_refcount) {
- delete this;
- }
-}
-
// From RFC 2396:
//
// URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]