summaryrefslogtreecommitdiffstats
path: root/src/object
diff options
context:
space:
mode:
authorMartin Owens <doctormo@gmail.com>2018-09-22 13:36:52 +0000
committerMartin Owens <doctormo@gmail.com>2018-09-22 13:36:52 +0000
commita38c853203992fd6cf987fa6aeb088924656fb08 (patch)
tree260360822aba681c90610589a2141d999de9a908 /src/object
parentRemove most write overrides and replace to get_value plus one generic write m... (diff)
downloadinkscape-a38c853203992fd6cf987fa6aeb088924656fb08.tar.gz
inkscape-a38c853203992fd6cf987fa6aeb088924656fb08.zip
Move URL toString to a more useful place and some minor fixes
Diffstat (limited to 'src/object')
-rw-r--r--src/object/uri.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/object/uri.h b/src/object/uri.h
index f0b59780e..b2cdcf778 100644
--- a/src/object/uri.h
+++ b/src/object/uri.h
@@ -117,6 +117,26 @@ public:
char *toString() const { return _impl->toString(); }
/**
+ * Return a more useful std::string with optional url(...)
+ * useful for css printing.
+ */
+ std::string toStdString(bool with_braces=false) const {
+ char *uri = this->toString();
+ auto ret = std::string("");
+ if(uri) {
+ if(with_braces) {
+ ret += "url(";
+ ret += uri;
+ ret += ")";
+ } else {
+ ret += uri;
+ }
+ free((void *) uri);
+ }
+ return ret;
+ }
+
+ /**
* Assignment operator.
*/
URI &operator=(URI const &uri);