comparison Plugins/Samples/ModalityWorklists/Plugin.cpp @ 1814:7c5ea3e51839

fix msvc build
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 24 Nov 2015 11:03:09 +0100
parents 5fc11b79b406
children 74dc6b764ff0
comparison
equal deleted inserted replaced
1813:5fc11b79b406 1814:7c5ea3e51839
22 22
23 #include <boost/filesystem.hpp> 23 #include <boost/filesystem.hpp>
24 #include <json/value.h> 24 #include <json/value.h>
25 #include <json/reader.h> 25 #include <json/reader.h>
26 #include <string.h> 26 #include <string.h>
27 #include <strings.h>
28 #include <iostream> 27 #include <iostream>
28 #include <algorithm>
29 29
30 static OrthancPluginContext* context_ = NULL; 30 static OrthancPluginContext* context_ = NULL;
31 static std::string folder_; 31 static std::string folder_;
32 32
33 33
92 return success; 92 return success;
93 } 93 }
94 } 94 }
95 95
96 96
97
98 static bool GetQueryDicom(Json::Value& value, 97 static bool GetQueryDicom(Json::Value& value,
99 const OrthancPluginWorklistQuery* query) 98 const OrthancPluginWorklistQuery* query)
100 { 99 {
101 OrthancPluginMemoryBuffer dicom; 100 OrthancPluginMemoryBuffer dicom;
102 if (OrthancPluginWorklistGetDicomQuery(context_, &dicom, query)) 101 if (OrthancPluginWorklistGetDicomQuery(context_, &dicom, query))
112 111
113 return ConvertToJson(value, json); 112 return ConvertToJson(value, json);
114 } 113 }
115 114
116 115
116 static void ToLowerCase(std::string& s)
117 {
118 std::transform(s.begin(), s.end(), s.begin(), tolower);
119 }
120
121
117 OrthancPluginErrorCode Callback(OrthancPluginWorklistAnswers* answers, 122 OrthancPluginErrorCode Callback(OrthancPluginWorklistAnswers* answers,
118 const OrthancPluginWorklistQuery* query, 123 const OrthancPluginWorklistQuery* query,
119 const char* remoteAet, 124 const char* remoteAet,
120 const char* calledAet) 125 const char* calledAet)
121 { 126 {
137 for (boost::filesystem::directory_iterator it(source); it != end; ++it) 142 for (boost::filesystem::directory_iterator it(source); it != end; ++it)
138 { 143 {
139 if (is_regular_file(it->status())) 144 if (is_regular_file(it->status()))
140 { 145 {
141 std::string extension = boost::filesystem::extension(it->path()); 146 std::string extension = boost::filesystem::extension(it->path());
142 if (!strcasecmp(".wl", extension.c_str())) 147 ToLowerCase(extension);
148
149 if (extension == ".wl")
143 { 150 {
144 OrthancPluginErrorCode error = MatchWorklist(answers, query, it->path().string()); 151 OrthancPluginErrorCode error = MatchWorklist(answers, query, it->path().string());
145 if (error) 152 if (error)
146 { 153 {
147 OrthancPluginLogError(context_, "Error while adding an answer to a worklist request"); 154 OrthancPluginLogError(context_, "Error while adding an answer to a worklist request");