summaryrefslogtreecommitdiffstats
path: root/src/uri.h
diff options
context:
space:
mode:
authorMartin Owens <doctormo@gmail.com>2014-02-26 15:31:28 +0000
committerMartin Owens <doctormo@gmail.com>2014-02-26 15:31:28 +0000
commit6f844ef457690c841b0be91d70b1e54b61c04812 (patch)
tree27cdbafb97c10e43b051f0d1c12fb2a14193907f /src/uri.h
parentMerge from trunk (diff)
downloadinkscape-6f844ef457690c841b0be91d70b1e54b61c04812.tar.gz
inkscape-6f844ef457690c841b0be91d70b1e54b61c04812.zip
Remove DOM directory and reduce size of inkscape. Use Inkscape::URI and save ziptool to utils.
(bzr r13047.1.5)
Diffstat (limited to 'src/uri.h')
-rw-r--r--src/uri.h33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/uri.h b/src/uri.h
index 11b091928..4a08ad8f6 100644
--- a/src/uri.h
+++ b/src/uri.h
@@ -16,6 +16,7 @@
#include <libxml/uri.h>
#include "bad-uri-exception.h"
#include <string>
+#include <vector>
namespace Inkscape {
@@ -25,6 +26,9 @@ namespace Inkscape {
class URI {
public:
+ /* Blank constructor */
+ URI();
+
/**
* Copy constructor.
*/
@@ -115,6 +119,27 @@ public:
*/
gchar *toString() const { return _impl->toString(); }
+
+ /**
+ * Data URI public get methods.
+ */
+ bool isDataUri() { return not data.empty(); }
+ const std::string getData() const { return data; }
+
+ const std::string getMimeType() const {
+ if (data_mimetype.empty())
+ return "text/plain";
+ return data_mimetype;
+ }
+
+ const std::string getCharset() const {
+ if (data_charset.empty())
+ return "US-ASCII";
+ return data_mimetype;
+ }
+ // Return decoded bytes if requested.
+ std::vector<char> getDataBytes() const;
+
/**
* Assignment operator.
*/
@@ -123,10 +148,10 @@ public:
private:
bool parseDataUri(const std::string &uri);
- std::string data_mimetype;
- std::string data_charset;
- bool data_base64;
- std::string data;
+ std::string data_mimetype; // Defaults to test/plain (we expect image/jpeg)
+ std::string data_charset; // Defaults to US-ASCII
+ bool data_base64; // true: base64, false: safe-url octets
+ std::string data; // Base64/Octet stored image.
class Impl {
public: