# HG changeset patch # User Sebastien Jodogne # Date 1443173635 -7200 # Node ID a0a4fa28624c0ecc20fb2ba5a2b8bd000ca1db86 # Parent fe458dde986ecb8dd21c46dd07edbb8cad9fd063 fix diff -r fe458dde986e -r a0a4fa28624c Core/Toolbox.cpp --- a/Core/Toolbox.cpp Fri Sep 25 11:02:26 2015 +0200 +++ b/Core/Toolbox.cpp Fri Sep 25 11:33:55 2015 +0200 @@ -527,6 +527,29 @@ { result = base64_decode(data); } + + +# if BOOST_HAS_REGEX == 1 + void Toolbox::DecodeDataUriScheme(std::string& mime, + std::string& content, + const std::string& source) + { + boost::regex pattern("data:([^;]+);base64,([a-zA-Z0-9=+/]*)", + boost::regex::icase /* case insensitive search */); + + boost::cmatch what; + if (regex_match(source.c_str(), what, pattern)) + { + mime = what[1]; + DecodeBase64(content, what[2]); + } + else + { + throw OrthancException(ErrorCode_BadFileFormat); + } + } +# endif + #endif @@ -1009,28 +1032,6 @@ } -#if BOOST_HAS_REGEX == 1 - void Toolbox::DecodeDataUriScheme(std::string& mime, - std::string& content, - const std::string& source) - { - boost::regex pattern("data:([^;]+);base64,([a-zA-Z0-9=+/]*)", - boost::regex::icase /* case insensitive search */); - - boost::cmatch what; - if (regex_match(source.c_str(), what, pattern)) - { - mime = what[1]; - DecodeBase64(content, what[2]); - } - else - { - throw OrthancException(ErrorCode_BadFileFormat); - } - } -#endif - - void Toolbox::MakeDirectory(const std::string& path) { if (boost::filesystem::exists(path)) diff -r fe458dde986e -r a0a4fa28624c Core/Toolbox.h --- a/Core/Toolbox.h Fri Sep 25 11:02:26 2015 +0200 +++ b/Core/Toolbox.h Fri Sep 25 11:33:55 2015 +0200 @@ -117,6 +117,12 @@ void EncodeBase64(std::string& result, const std::string& data); + +# if BOOST_HAS_REGEX == 1 + void DecodeDataUriScheme(std::string& mime, + std::string& content, + const std::string& source); +# endif #endif std::string GetPathToExecutable(); @@ -153,12 +159,6 @@ const std::string& source, char separator); -#if BOOST_HAS_REGEX == 1 - void DecodeDataUriScheme(std::string& mime, - std::string& content, - const std::string& source); -#endif - void MakeDirectory(const std::string& path); bool IsExistingFile(const std::string& path);