Mercurial > hg > orthanc
diff Core/Toolbox.cpp @ 966:886652370ff2
accelerating REST API matching
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 27 Jun 2014 15:33:22 +0200 |
parents | 63973b76a51f |
children | 509e146c3cb3 |
line wrap: on
line diff
--- a/Core/Toolbox.cpp Fri Jun 27 13:58:02 2014 +0200 +++ b/Core/Toolbox.cpp Fri Jun 27 15:33:22 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) {