Mercurial > hg > orthanc
comparison Plugins/Samples/Common/OrthancPluginCppWrapper.h @ 2264:8e5e0de75839
primitives for HTTP client in plugin C++ wrapper
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 13 Feb 2017 10:39:14 +0100 |
parents | b9775db0fd9b |
children | e46b0ee6c19d |
comparison
equal
deleted
inserted
replaced
2263:b9775db0fd9b | 2264:8e5e0de75839 |
---|---|
65 OrthancPluginContext* context_; | 65 OrthancPluginContext* context_; |
66 OrthancPluginMemoryBuffer buffer_; | 66 OrthancPluginMemoryBuffer buffer_; |
67 | 67 |
68 void Check(OrthancPluginErrorCode code); | 68 void Check(OrthancPluginErrorCode code); |
69 | 69 |
70 bool CheckHttp(OrthancPluginErrorCode code); | |
71 | |
70 public: | 72 public: |
71 MemoryBuffer(OrthancPluginContext* context); | 73 MemoryBuffer(OrthancPluginContext* context); |
72 | 74 |
73 ~MemoryBuffer() | 75 ~MemoryBuffer() |
74 { | 76 { |
150 | 152 |
151 void DicomToJson(Json::Value& target, | 153 void DicomToJson(Json::Value& target, |
152 OrthancPluginDicomToJsonFormat format, | 154 OrthancPluginDicomToJsonFormat format, |
153 OrthancPluginDicomToJsonFlags flags, | 155 OrthancPluginDicomToJsonFlags flags, |
154 uint32_t maxStringLength); | 156 uint32_t maxStringLength); |
157 | |
158 bool HttpGet(const std::string& url, | |
159 const std::string& username, | |
160 const std::string& password); | |
161 | |
162 bool HttpPost(const std::string& url, | |
163 const std::string& body, | |
164 const std::string& username, | |
165 const std::string& password); | |
166 | |
167 bool HttpPut(const std::string& url, | |
168 const std::string& body, | |
169 const std::string& username, | |
170 const std::string& password); | |
155 }; | 171 }; |
156 | 172 |
157 | 173 |
158 class OrthancString : public boost::noncopyable | 174 class OrthancString : public boost::noncopyable |
159 { | 175 { |
404 } | 420 } |
405 | 421 |
406 bool RestApiDelete(OrthancPluginContext* context, | 422 bool RestApiDelete(OrthancPluginContext* context, |
407 const std::string& uri, | 423 const std::string& uri, |
408 bool applyPlugins); | 424 bool applyPlugins); |
425 | |
426 bool HttpDelete(OrthancPluginContext* context, | |
427 const std::string& url, | |
428 const std::string& username, | |
429 const std::string& password); | |
409 | 430 |
410 inline void LogError(OrthancPluginContext* context, | 431 inline void LogError(OrthancPluginContext* context, |
411 const std::string& message) | 432 const std::string& message) |
412 { | 433 { |
413 if (context != NULL) | 434 if (context != NULL) |