Mercurial > hg > orthanc
diff Core/Toolbox.cpp @ 1648:a0a4fa28624c
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 25 Sep 2015 11:33:55 +0200 |
parents | 4e56b5a206b7 |
children | 3727a09e7b53 |
line wrap: on
line diff
--- 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))