From 7f9907d4fa5836d20555343dfe5e13649cad1f30 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Thu, 20 Feb 2014 15:48:07 -0500 Subject: Not finished by improved data uri support (bzr r13047.1.2) --- src/uri.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/uri.cpp') 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 #include +#include + 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; } -- cgit v1.2.3