summaryrefslogtreecommitdiffstats
path: root/src/uri.cpp
diff options
context:
space:
mode:
authorMartin Owens <doctormo@gmail.com>2014-02-20 20:48:07 +0000
committerMartin Owens <doctormo@gmail.com>2014-02-20 20:48:07 +0000
commit7f9907d4fa5836d20555343dfe5e13649cad1f30 (patch)
tree95e26768ce0d21916294f1cf29790e7fb6fb2efe /src/uri.cpp
parentAdd data uri checking back into the code (diff)
downloadinkscape-7f9907d4fa5836d20555343dfe5e13649cad1f30.tar.gz
inkscape-7f9907d4fa5836d20555343dfe5e13649cad1f30.zip
Not finished by improved data uri support
(bzr r13047.1.2)
Diffstat (limited to 'src/uri.cpp')
-rw-r--r--src/uri.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/uri.cpp b/src/uri.cpp
index 219bc1c96..33a2fd13d 100644
--- a/src/uri.cpp
+++ b/src/uri.cpp
@@ -14,6 +14,8 @@
#include <glibmm/ustring.h>
#include <glibmm/miscutils.h>
+#include <iostream>
+
namespace Inkscape {
URI::URI(const URI &uri) {
@@ -151,6 +153,22 @@ gchar *URI::to_native_filename(gchar const* uri) throw(BadURIException)
* and two // as appended and the data is stored in the path of the uri.
*/
bool URI::parseDataUri(const std::string &uri) {
+ unsigned int track = 5; // Ignore start of uri 'data:'
+
+ unsigned int head_end = uri.find(",", track);
+ if (head_end < uri.length()) {
+ std::string head = uri.substr(track, head_end);
+ // Head split by ';' for mime-type, charset and base64 bool
+ track = head_end + 1;
+ } else {
+ head = "No Head";
+ }
+ data = uri.substr(track, uri.length()-track);
+ if(data_base64) {
+ // Parse data here
+ } else {
+ // Fill data here
+ }
return true;
}