diff options
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); |
