changeset 610:5ba825b87b21 find-move-scp

fix static build
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 18 Oct 2013 10:32:12 +0200
parents 0bedf8ff9288
children 9924aec1d694
files OrthancServer/OrthancFindRequestHandler.cpp Resources/CMake/BoostConfiguration.cmake
diffstat 2 files changed, 35 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/OrthancFindRequestHandler.cpp	Thu Oct 17 18:07:55 2013 +0200
+++ b/OrthancServer/OrthancFindRequestHandler.cpp	Fri Oct 18 10:32:12 2013 +0200
@@ -39,11 +39,37 @@
 
 namespace Orthanc
 {
+  static std::string ToLowerCase(const std::string& s)
+  {
+    std::string result = s;
+    Toolbox::ToLowerCase(result);
+    return result;
+  }
+
   static bool ApplyRangeConstraint(const std::string& value,
                                    const std::string& constraint)
   {
-    // TODO
-    return false;
+    size_t separator = constraint.find('-');
+    std::string lower = ToLowerCase(constraint.substr(0, separator));
+    std::string upper = ToLowerCase(constraint.substr(separator + 1));
+    std::string v = ToLowerCase(value);
+
+    if (lower.size() == 0 && upper.size() == 0)
+    {
+      return false;
+    }
+
+    if (lower.size() == 0)
+    {
+      return v <= upper;
+    }
+
+    if (upper.size() == 0)
+    {
+      return v >= lower;
+    }
+    
+    return (v >= lower && v <= upper);
   }
 
 
@@ -52,8 +78,7 @@
   {
     std::cout << value << std::endl;
 
-    std::string v1 = value;
-    Toolbox::ToLowerCase(v1);
+    std::string v1 = ToLowerCase(value);
 
     std::vector<std::string> items;
     Toolbox::TokenizeString(items, constraint, '\\');
@@ -97,13 +122,7 @@
     }
     else
     {
-      std::string v1 = value;
-      std::string v2 = constraint;
-
-      Toolbox::ToLowerCase(v1);
-      Toolbox::ToLowerCase(v2);
-
-      return v1 == v2;
+      return ToLowerCase(value) == ToLowerCase(constraint);
     }
   }
 
@@ -150,14 +169,14 @@
       }
 
       std::string tag = query.GetElement(i).GetTag().Format();
-      std::cout << tag << std::endl;
-
       std::string value;
       if (resource.isMember(tag))
       {
         value = resource.get(tag, Json::arrayValue).get("Value", "").asString();
       }
 
+      std::cout << tag << " " << value << std::endl;
+
       if (!Matches(value, query.GetElement(i).GetValue().AsString()))
       {
         return false;
--- a/Resources/CMake/BoostConfiguration.cmake	Thu Oct 17 18:07:55 2013 +0200
+++ b/Resources/CMake/BoostConfiguration.cmake	Fri Oct 18 10:32:12 2013 +0200
@@ -80,18 +80,16 @@
     message(FATAL_ERROR "Support your platform here")
   endif()
 
+  aux_source_directory(${BOOST_SOURCES_DIR}/libs/regex/src BOOST_REGEX_SOURCES)
+
   list(APPEND BOOST_SOURCES
+    ${BOOST_REGEX_SOURCES}
     ${BOOST_SOURCES_DIR}/libs/date_time/src/gregorian/greg_month.cpp
     ${BOOST_FILESYSTEM_SOURCES_DIR}/codecvt_error_category.cpp
     ${BOOST_FILESYSTEM_SOURCES_DIR}/operations.cpp
     ${BOOST_FILESYSTEM_SOURCES_DIR}/path.cpp
     ${BOOST_FILESYSTEM_SOURCES_DIR}/path_traits.cpp
     ${BOOST_SOURCES_DIR}/libs/locale/src/encoding/codepage.cpp
-    ${BOOST_SOURCES_DIR}/libs/regex/src/cpp_regex_traits.cpp
-    ${BOOST_SOURCES_DIR}/libs/regex/src/regex.cpp
-    ${BOOST_SOURCES_DIR}/libs/regex/src/regex_raw_buffer.cpp
-    ${BOOST_SOURCES_DIR}/libs/regex/src/regex_traits_defaults.cpp
-    ${BOOST_SOURCES_DIR}/libs/regex/src/static_mutex.cpp
     ${BOOST_SOURCES_DIR}/libs/system/src/error_code.cpp
     )