Mercurial > hg > orthanc
diff OrthancServer/ServerContext.cpp @ 2304:563bf878407a
Argument "Since" in URI "/tools/find" (related to issue #53)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 11 Jul 2017 17:24:31 +0200 |
parents | a3a65de1840f |
children | 96b3ec054b69 |
line wrap: on
line diff
--- a/OrthancServer/ServerContext.cpp Mon Jul 10 11:31:48 2017 +0200 +++ b/OrthancServer/ServerContext.cpp Tue Jul 11 17:24:31 2017 +0200 @@ -601,9 +601,10 @@ } - bool ServerContext::Apply(std::list<std::string>& result, + void ServerContext::Apply(std::list<std::string>& result, const ::Orthanc::LookupResource& lookup, - size_t maxResults) + size_t since, + size_t limit) { result.clear(); @@ -612,6 +613,7 @@ assert(resources.size() == instances.size()); + size_t skipped = 0; for (size_t i = 0; i < instances.size(); i++) { Json::Value dicom; @@ -619,10 +621,14 @@ if (lookup.IsMatch(dicom)) { - if (maxResults != 0 && - result.size() >= maxResults) + if (skipped < since) { - return false; // too many results + skipped++; + } + else if (limit != 0 && + result.size() >= limit) + { + return; // too many results } else { @@ -630,8 +636,6 @@ } } } - - return true; // finished } }