Mercurial > hg > orthanc
diff Core/Toolbox.cpp @ 971:509e146c3cb3 plugins
integration mainline->plugins
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 30 Jun 2014 13:36:01 +0200 |
parents | 743a75b14bef 886652370ff2 |
children | 0bfeeb6d340f |
line wrap: on
line diff
--- a/Core/Toolbox.cpp Wed Jun 25 15:37:48 2014 +0200 +++ b/Core/Toolbox.cpp Mon Jun 30 13:36:01 2014 +0200 @@ -284,6 +284,28 @@ } + void Toolbox::TruncateUri(UriComponents& target, + const UriComponents& source, + size_t fromLevel) + { + target.clear(); + + if (source.size() > fromLevel) + { + target.resize(source.size() - fromLevel); + + size_t j = 0; + for (size_t i = fromLevel; i < source.size(); i++, j++) + { + target[j] = source[i]; + } + + assert(j == target.size()); + } + } + + + bool Toolbox::IsChildUri(const UriComponents& baseUri, const UriComponents& testedUri) { @@ -505,12 +527,15 @@ // Already in UTF-8: No conversion is required return source; + case Encoding_Ascii: + return ConvertToAscii(source);; + case Encoding_Latin1: encoding = "ISO-8859-1"; break; default: - throw OrthancException(ErrorCode_ParameterOutOfRange); + throw OrthancException(ErrorCode_NotImplemented); } try