diff options
| author | Martin Owens <doctormo@gmail.com> | 2018-09-22 13:36:52 +0000 |
|---|---|---|
| committer | Martin Owens <doctormo@gmail.com> | 2018-09-24 20:03:10 +0000 |
| commit | 977773633d537abd02f1c52e80bb8ff8b112229f (patch) | |
| tree | e5d294dcc611385463eb52d62a0d2bab67a16f6c /src/object | |
| parent | Remove most write overrides and replace to get_value plus one generic write m... (diff) | |
| download | inkscape-977773633d537abd02f1c52e80bb8ff8b112229f.tar.gz inkscape-977773633d537abd02f1c52e80bb8ff8b112229f.zip | |
Move URL toString to a more useful place and some minor fixes
Diffstat (limited to 'src/object')
| -rw-r--r-- | src/object/uri.h | 20 |
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); |
