# HG changeset patch # User Sebastien Jodogne # Date 1787040237 -7200 # Node ID 72c735f56b688f52d98ff02c9c76e41ae8227d35 # Parent c5fa14f3bd7acf63005eb2f91759c5b3c078e91d uniformizing macro names in OrthancPluginCppWrapper.h diff -r c5fa14f3bd7a -r 72c735f56b68 OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp --- a/OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Mon Aug 17 09:31:18 2026 +0200 +++ b/OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Tue Aug 18 10:03:57 2026 +0200 @@ -61,6 +61,13 @@ #endif +#ifdef _MSC_VER +# define ORTHANC_SCANF sscanf_s +#else +# define ORTHANC_SCANF sscanf +#endif + + namespace OrthancPlugins { static OrthancPluginContext* globalContext_ = NULL; @@ -117,7 +124,7 @@ } -#if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1 +#if HAS_ORTHANC_PLUGINS_LOG_MESSAGE == 1 void LogMessage(OrthancPluginLogLevel level, const char* file, uint32_t line, @@ -125,7 +132,7 @@ { if (HasGlobalContext()) { -#if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1 +#if HAS_ORTHANC_PLUGINS_LOG_MESSAGE == 1 const char* pluginName = (pluginName_.empty() ? NULL : pluginName_.c_str()); OrthancPluginLogMessage(GetGlobalContext(), message.c_str(), pluginName, file, line, OrthancPluginLogCategory_Generic, level); #else @@ -184,7 +191,7 @@ // Prevent using garbage information buffer_.data = NULL; buffer_.size = 0; - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code); + ORTHANC_PLUGINS_THROW_ERROR_CODE(code); } } @@ -209,7 +216,7 @@ } else { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code); + ORTHANC_PLUGINS_THROW_ERROR_CODE(code); } } @@ -365,7 +372,7 @@ } -#if (HAS_ORTHANC_PLUGIN_PEERS == 1) || (HAS_ORTHANC_PLUGIN_HTTP_CLIENT == 1) || (HAS_ORTHANC_PLUGIN_GENERIC_CALL_REST_API == 1) +#if (HAS_ORTHANC_PLUGINS_PEERS == 1) || (HAS_ORTHANC_PLUGINS_HTTP_CLIENT == 1) || (HAS_ORTHANC_PLUGINS_GENERIC_CALL_REST_API == 1) static void DecodeHttpHeaders(HttpHeaders& target, const MemoryBuffer& source) { @@ -465,7 +472,7 @@ } } -#if HAS_ORTHANC_PLUGIN_GENERIC_CALL_REST_API == 1 +#if HAS_ORTHANC_PLUGINS_GENERIC_CALL_REST_API == 1 bool MemoryBuffer::RestApiPost(const std::string& uri, const void* body, @@ -839,7 +846,7 @@ } else { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(error); + ORTHANC_PLUGINS_THROW_ERROR_CODE(error); } } @@ -1481,7 +1488,7 @@ } -#if HAS_ORTHANC_PLUGIN_FIND_MATCHER == 1 +#if HAS_ORTHANC_PLUGINS_FIND_MATCHER == 1 FindMatcher::FindMatcher(const OrthancPluginWorklistQuery* worklist) : matcher_(NULL), worklist_(worklist) @@ -1550,18 +1557,18 @@ } } -#endif /* HAS_ORTHANC_PLUGIN_FIND_MATCHER == 1 */ +#endif /* HAS_ORTHANC_PLUGINS_FIND_MATCHER == 1 */ static void CheckAnswerSizeIsLessThan4GB(const std::string& answer) { if (answer.size() > static_cast(std::numeric_limits::max())) { - #if HAS_ORTHANC_EXCEPTION == 1 +#if HAS_ORTHANC_EXCEPTION == 1 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange, "Cannot send HTTP response larger than 4GB"); - #else +#else ORTHANC_PLUGINS_LOG_ERROR("Cannot send HTTP response larger than 4GB"); - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); - #endif + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); +#endif } } @@ -1734,7 +1741,7 @@ } } -#if HAS_ORTHANC_PLUGIN_GENERIC_CALL_REST_API == 1 +#if HAS_ORTHANC_PLUGINS_GENERIC_CALL_REST_API == 1 bool RestApiPost(Json::Value& result, const std::string& uri, const Json::Value& body, @@ -1829,7 +1836,7 @@ } else { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(error); + ORTHANC_PLUGINS_THROW_ERROR_CODE(error); } } @@ -1858,12 +1865,6 @@ return true; } -#ifdef _MSC_VER -#define ORTHANC_SCANF sscanf_s -#else -#define ORTHANC_SCANF sscanf -#endif - // Parse the version int aa, bb, cc = 0; if ((ORTHANC_SCANF(version, "%4d.%4d.%4d", &aa, &bb, &cc) != 3 && @@ -1951,7 +1952,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_PEERS == 1 +#if HAS_ORTHANC_PLUGINS_PEERS == 1 size_t OrthancPeers::GetPeerIndex(const std::string& name) const { size_t index; @@ -1975,7 +1976,7 @@ if (peers_ == NULL) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_Plugin); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_Plugin); } uint32_t count = OrthancPluginGetPeersCount(GetGlobalContext(), peers_); @@ -1986,7 +1987,7 @@ if (name == NULL) { OrthancPluginFreePeers(GetGlobalContext(), peers_); - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_Plugin); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_Plugin); } index_[name] = i; @@ -2024,14 +2025,14 @@ { if (index >= index_.size()) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); } else { const char* s = OrthancPluginGetPeerName(GetGlobalContext(), peers_, static_cast(index)); if (s == NULL) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_Plugin); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_Plugin); } else { @@ -2045,14 +2046,14 @@ { if (index >= index_.size()) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); } else { const char* s = OrthancPluginGetPeerUrl(GetGlobalContext(), peers_, static_cast(index)); if (s == NULL) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_Plugin); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_Plugin); } else { @@ -2074,7 +2075,7 @@ { if (index >= index_.size()) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); } else { @@ -2107,7 +2108,7 @@ { if (index >= index_.size()) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); } OrthancPlugins::MemoryBuffer answer; @@ -2305,7 +2306,7 @@ { if (index >= index_.size()) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); } if (body.size() > 0xffffffffu) @@ -2345,7 +2346,7 @@ { if (index >= index_.size()) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); } if (body.size() > 0xffffffffu) @@ -2391,7 +2392,7 @@ { if (index >= index_.size()) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); } OrthancPlugins::MemoryBuffer answer; @@ -2432,7 +2433,7 @@ ** JOBS ******************************************************************/ -#if HAS_ORTHANC_PLUGIN_JOB == 1 +#if HAS_ORTHANC_PLUGINS_JOB == 1 void OrthancJob::CallbackFinalize(void* job) { if (job != NULL) @@ -2630,7 +2631,7 @@ if (content.type() != Json::objectValue) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_BadFileFormat); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_BadFileFormat); } else { @@ -2650,7 +2651,7 @@ { if (serialized.type() != Json::objectValue) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_BadFileFormat); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_BadFileFormat); } else { @@ -2665,7 +2666,7 @@ if (progress < 0 || progress > 1) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange); } progress_ = progress; @@ -2685,7 +2686,7 @@ { if (job == NULL) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_NullPointer); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_NullPointer); } OrthancPluginJob* orthanc = @@ -2700,7 +2701,7 @@ if (orthanc == NULL) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_Plugin); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_Plugin); } else { @@ -2714,7 +2715,7 @@ { if (job == NULL) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_NullPointer); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_NullPointer); } OrthancPluginJob* orthanc = Create(job); @@ -2725,7 +2726,7 @@ { ORTHANC_PLUGINS_LOG_ERROR("Plugin cannot submit job"); OrthancPluginFreeJob(GetGlobalContext(), orthanc); - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_Plugin); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_Plugin); } else { @@ -2753,7 +2754,7 @@ !status.isMember("State") || status["State"].type() != Json::stringValue) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_InexistentItem); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_InexistentItem); } const std::string state = status["State"].asString(); @@ -2782,30 +2783,30 @@ if (!status.isMember("ErrorCode") || status["ErrorCode"].type() != Json::intValue) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_InternalError); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_InternalError); } else { if (!status.isMember("ErrorDescription") || status["ErrorDescription"].type() != Json::stringValue) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(status["ErrorCode"].asInt()); + ORTHANC_PLUGINS_THROW_ERROR_CODE(status["ErrorCode"].asInt()); } else { - #if HAS_ORTHANC_EXCEPTION == 1 +#if HAS_ORTHANC_EXCEPTION == 1 throw Orthanc::OrthancException(static_cast(status["ErrorCode"].asInt()), status["ErrorDescription"].asString()); - #else +#else ORTHANC_PLUGINS_LOG_ERROR("Exception while executing the job: " + status["ErrorDescription"].asString()); - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(status["ErrorCode"].asInt()); - #endif + ORTHANC_PLUGINS_THROW_ERROR_CODE(status["ErrorCode"].asInt()); +#endif } } } else { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_InternalError); + ORTHANC_PLUGINS_THROW_ERROR_CODE(OrthancPluginErrorCode_InternalError); } } } @@ -2922,7 +2923,7 @@ ** METRICS ******************************************************************/ -#if HAS_ORTHANC_PLUGIN_METRICS == 1 +#if HAS_ORTHANC_PLUGINS_METRICS == 1 MetricsTimer::MetricsTimer(const char* name) : name_(name) { @@ -2945,7 +2946,7 @@ ** HTTP CLIENT ******************************************************************/ -#if HAS_ORTHANC_PLUGIN_HTTP_CLIENT == 1 +#if HAS_ORTHANC_PLUGINS_HTTP_CLIENT == 1 class HttpClient::RequestBodyWrapper : public boost::noncopyable { private: @@ -3009,7 +3010,7 @@ }; -#if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT == 1 +#if HAS_ORTHANC_PLUGINS_CHUNKED_HTTP_CLIENT == 1 static OrthancPluginErrorCode AnswerAddHeaderCallback(void* answer, const char* key, const char* value) @@ -3033,7 +3034,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT == 1 +#if HAS_ORTHANC_PLUGINS_CHUNKED_HTTP_CLIENT == 1 static OrthancPluginErrorCode AnswerAddChunkCallback(void* answer, const void* data, uint32_t size) @@ -3297,7 +3298,7 @@ }; -#if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT == 1 +#if HAS_ORTHANC_PLUGINS_CHUNKED_HTTP_CLIENT == 1 class MemoryAnswer : public HttpClient::IAnswer { private: @@ -3331,7 +3332,7 @@ } -#if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT == 1 +#if HAS_ORTHANC_PLUGINS_CHUNKED_HTTP_CLIENT == 1 void HttpClient::ExecuteWithStream(uint16_t& httpStatus, IAnswer& answer, IRequestBody& body) const @@ -3387,7 +3388,7 @@ if (error != OrthancPluginErrorCode_Success) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(error); + ORTHANC_PLUGINS_THROW_ERROR_CODE(error); } } #endif @@ -3429,7 +3430,7 @@ if (error != OrthancPluginErrorCode_Success) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(error); + ORTHANC_PLUGINS_THROW_ERROR_CODE(error); } DecodeHttpHeaders(answerHeaders, answerHeadersBuffer); @@ -3439,7 +3440,7 @@ void HttpClient::Execute(IAnswer& answer) { -#if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT == 1 +#if HAS_ORTHANC_PLUGINS_CHUNKED_HTTP_CLIENT == 1 if (allowChunkedTransfers_) { if (chunkedBody_ != NULL) @@ -3480,7 +3481,7 @@ void HttpClient::Execute(HttpHeaders& answerHeaders /* out */, std::string& answerBody /* out */) { -#if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT == 1 +#if HAS_ORTHANC_PLUGINS_CHUNKED_HTTP_CLIENT == 1 if (allowChunkedTransfers_) { MemoryAnswer answer; @@ -3538,7 +3539,7 @@ Execute(answerHeaders, body); } -#endif /* HAS_ORTHANC_PLUGIN_HTTP_CLIENT == 1 */ +#endif /* HAS_ORTHANC_PLUGINS_HTTP_CLIENT == 1 */ @@ -3563,7 +3564,7 @@ } -#if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_SERVER == 1 +#if HAS_ORTHANC_PLUGINS_CHUNKED_HTTP_SERVER == 1 OrthancPluginErrorCode ChunkedRequestReaderAddChunk( OrthancPluginServerChunkedRequestReader* reader, @@ -3758,7 +3759,7 @@ } catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e) { -#if HAS_ORTHANC_EXCEPTION == 1 && HAS_ORTHANC_PLUGIN_EXCEPTION_DETAILS == 1 +#if HAS_ORTHANC_EXCEPTION == 1 && HAS_ORTHANC_PLUGINS_EXCEPTION_DETAILS == 1 if (HasGlobalContext() && e.HasDetails()) { @@ -3785,7 +3786,7 @@ } -#if HAS_ORTHANC_PLUGIN_STORAGE_COMMITMENT_SCP == 1 +#if HAS_ORTHANC_PLUGINS_STORAGE_COMMITMENT_SCP == 1 OrthancPluginErrorCode IStorageCommitmentScpHandler::Lookup( OrthancPluginStorageCommitmentFailureReason* target, void* rawHandler, @@ -3813,7 +3814,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_STORAGE_COMMITMENT_SCP == 1 +#if HAS_ORTHANC_PLUGINS_STORAGE_COMMITMENT_SCP == 1 void IStorageCommitmentScpHandler::Destructor(void* rawHandler) { assert(rawHandler != NULL); @@ -3937,7 +3938,7 @@ } else { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code); + ORTHANC_PLUGINS_THROW_ERROR_CODE(code); } } #endif @@ -3974,7 +3975,7 @@ } else { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code); + ORTHANC_PLUGINS_THROW_ERROR_CODE(code); } } #endif @@ -4023,7 +4024,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_WEBDAV == 1 +#if HAS_ORTHANC_PLUGINS_WEBDAV == 1 static std::vector WebDavConvertPath(uint32_t pathSize, const char* const* pathItems) { @@ -4039,7 +4040,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_WEBDAV == 1 +#if HAS_ORTHANC_PLUGINS_WEBDAV == 1 static OrthancPluginErrorCode WebDavIsExistingFolder(uint8_t* isExisting, uint32_t pathSize, const char* const* pathItems, @@ -4064,7 +4065,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_WEBDAV == 1 +#if HAS_ORTHANC_PLUGINS_WEBDAV == 1 static OrthancPluginErrorCode WebDavListFolder(uint8_t* isExisting, OrthancPluginWebDavCollection* collection, OrthancPluginWebDavAddFile addFile, @@ -4128,7 +4129,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_WEBDAV == 1 +#if HAS_ORTHANC_PLUGINS_WEBDAV == 1 static OrthancPluginErrorCode WebDavRetrieveFile(OrthancPluginWebDavCollection* collection, OrthancPluginWebDavRetrieveFile retrieveFile, uint32_t pathSize, @@ -4164,7 +4165,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_WEBDAV == 1 +#if HAS_ORTHANC_PLUGINS_WEBDAV == 1 static OrthancPluginErrorCode WebDavStoreFileCallback(uint8_t* isReadOnly, /* out */ uint32_t pathSize, const char* const* pathItems, @@ -4197,7 +4198,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_WEBDAV == 1 +#if HAS_ORTHANC_PLUGINS_WEBDAV == 1 static OrthancPluginErrorCode WebDavCreateFolderCallback(uint8_t* isReadOnly, /* out */ uint32_t pathSize, const char* const* pathItems, @@ -4222,7 +4223,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_WEBDAV == 1 +#if HAS_ORTHANC_PLUGINS_WEBDAV == 1 static OrthancPluginErrorCode WebDavDeleteItemCallback(uint8_t* isReadOnly, /* out */ uint32_t pathSize, const char* const* pathItems, @@ -4247,7 +4248,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_WEBDAV == 1 +#if HAS_ORTHANC_PLUGINS_WEBDAV == 1 void IWebDavCollection::Register(const std::string& uri, IWebDavCollection& collection) { @@ -4257,7 +4258,7 @@ if (code != OrthancPluginErrorCode_Success) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code); + ORTHANC_PLUGINS_THROW_ERROR_CODE(code); } } #endif @@ -4347,7 +4348,7 @@ } -#if HAS_ORTHANC_PLUGIN_GENERIC_CALL_REST_API == 1 +#if HAS_ORTHANC_PLUGINS_GENERIC_CALL_REST_API == 1 RestApiClient::RestApiClient() : method_(OrthancPluginHttpMethod_Get), path_("/"), @@ -4381,7 +4382,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_GENERIC_CALL_REST_API == 1 +#if HAS_ORTHANC_PLUGINS_GENERIC_CALL_REST_API == 1 void RestApiClient::AddRequestHeader(const std::string& key, const std::string& value) { @@ -4397,7 +4398,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_GENERIC_CALL_REST_API == 1 +#if HAS_ORTHANC_PLUGINS_GENERIC_CALL_REST_API == 1 void RestApiClient::SetRequestHeader(const std::string& key, const std::string& value) { @@ -4406,7 +4407,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_GENERIC_CALL_REST_API == 1 +#if HAS_ORTHANC_PLUGINS_GENERIC_CALL_REST_API == 1 bool RestApiClient::Execute() { if (requestBody_.size() > 0xffffffffu) @@ -4448,7 +4449,7 @@ } else { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code); + ORTHANC_PLUGINS_THROW_ERROR_CODE(code); } } } @@ -4489,7 +4490,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_GENERIC_CALL_REST_API == 1 +#if HAS_ORTHANC_PLUGINS_GENERIC_CALL_REST_API == 1 uint16_t RestApiClient::GetHttpStatus() const { if (httpStatus_ == 0) @@ -4504,7 +4505,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_GENERIC_CALL_REST_API == 1 +#if HAS_ORTHANC_PLUGINS_GENERIC_CALL_REST_API == 1 bool RestApiClient::LookupAnswerHeader(std::string& value, const std::string& key) const { @@ -4529,7 +4530,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_GENERIC_CALL_REST_API == 1 +#if HAS_ORTHANC_PLUGINS_GENERIC_CALL_REST_API == 1 const std::string& RestApiClient::GetAnswerBody() const { if (httpStatus_ == 0) @@ -4544,7 +4545,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_KEY_VALUE_STORES == 1 +#if HAS_ORTHANC_PLUGINS_KEY_VALUE_STORES == 1 KeyValueStore::Iterator::Iterator(OrthancPluginKeysValuesIterator *iterator) : iterator_(iterator) { @@ -4556,7 +4557,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_KEY_VALUE_STORES == 1 +#if HAS_ORTHANC_PLUGINS_KEY_VALUE_STORES == 1 KeyValueStore::Iterator::~Iterator() { OrthancPluginFreeKeysValuesIterator(OrthancPlugins::GetGlobalContext(), iterator_); @@ -4564,7 +4565,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_KEY_VALUE_STORES == 1 +#if HAS_ORTHANC_PLUGINS_KEY_VALUE_STORES == 1 bool KeyValueStore::Iterator::Next() { uint8_t done; @@ -4572,7 +4573,7 @@ if (code != OrthancPluginErrorCode_Success) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code); + ORTHANC_PLUGINS_THROW_ERROR_CODE(code); } else { @@ -4582,7 +4583,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_KEY_VALUE_STORES == 1 +#if HAS_ORTHANC_PLUGINS_KEY_VALUE_STORES == 1 std::string KeyValueStore::Iterator::GetKey() const { const char* s = OrthancPluginKeysValuesIteratorGetKey(OrthancPlugins::GetGlobalContext(), iterator_); @@ -4598,7 +4599,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_KEY_VALUE_STORES == 1 +#if HAS_ORTHANC_PLUGINS_KEY_VALUE_STORES == 1 void KeyValueStore::Iterator::GetValue(std::string& value) const { OrthancPlugins::MemoryBuffer valueBuffer; @@ -4606,7 +4607,7 @@ if (code != OrthancPluginErrorCode_Success) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code); + ORTHANC_PLUGINS_THROW_ERROR_CODE(code); } else { @@ -4616,7 +4617,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_KEY_VALUE_STORES == 1 +#if HAS_ORTHANC_PLUGINS_KEY_VALUE_STORES == 1 void KeyValueStore::Store(const std::string& key, const void* value, size_t valueSize) @@ -4630,13 +4631,13 @@ key.c_str(), value, static_cast(valueSize)); if (code != OrthancPluginErrorCode_Success) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code); + ORTHANC_PLUGINS_THROW_ERROR_CODE(code); } } #endif -#if HAS_ORTHANC_PLUGIN_KEY_VALUE_STORES == 1 +#if HAS_ORTHANC_PLUGINS_KEY_VALUE_STORES == 1 bool KeyValueStore::GetValue(std::string& value, const std::string& key) { @@ -4647,7 +4648,7 @@ if (code != OrthancPluginErrorCode_Success) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code); + ORTHANC_PLUGINS_THROW_ERROR_CODE(code); } else if (found) { @@ -4662,7 +4663,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_KEY_VALUE_STORES == 1 +#if HAS_ORTHANC_PLUGINS_KEY_VALUE_STORES == 1 void KeyValueStore::DeleteKey(const std::string& key) { OrthancPluginErrorCode code = OrthancPluginDeleteKeyValue(OrthancPlugins::GetGlobalContext(), @@ -4670,13 +4671,13 @@ if (code != OrthancPluginErrorCode_Success) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code); + ORTHANC_PLUGINS_THROW_ERROR_CODE(code); } } #endif -#if HAS_ORTHANC_PLUGIN_KEY_VALUE_STORES == 1 +#if HAS_ORTHANC_PLUGINS_KEY_VALUE_STORES == 1 KeyValueStore::Iterator* KeyValueStore::CreateIterator() { return new Iterator(OrthancPluginCreateKeysValuesIterator(OrthancPlugins::GetGlobalContext(), storeId_.c_str())); @@ -4684,7 +4685,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_QUEUES == 1 +#if HAS_ORTHANC_PLUGINS_QUEUES == 1 void Queue::Enqueue(const void* value, size_t valueSize) { @@ -4698,13 +4699,13 @@ if (code != OrthancPluginErrorCode_Success) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code); + ORTHANC_PLUGINS_THROW_ERROR_CODE(code); } } #endif -#if HAS_ORTHANC_PLUGIN_QUEUES == 1 +#if HAS_ORTHANC_PLUGINS_QUEUES == 1 bool Queue::DequeueInternal(std::string& value, OrthancPluginQueueOrigin origin) { @@ -4719,7 +4720,7 @@ if (code != OrthancPluginErrorCode_Success) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code); + ORTHANC_PLUGINS_THROW_ERROR_CODE(code); } else if (found) { @@ -4734,7 +4735,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_QUEUES == 1 +#if HAS_ORTHANC_PLUGINS_QUEUES == 1 uint64_t Queue::GetSize() { uint64_t size = 0; @@ -4742,7 +4743,7 @@ if (code != OrthancPluginErrorCode_Success) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code); + ORTHANC_PLUGINS_THROW_ERROR_CODE(code); } else { @@ -4752,7 +4753,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_RESERVE_QUEUE_VALUE == 1 +#if HAS_ORTHANC_PLUGINS_RESERVE_QUEUE_VALUE == 1 bool Queue::ReserveInternal(std::string& value, uint64_t& valueId, OrthancPluginQueueOrigin origin, uint32_t releaseTimeout) { uint8_t found = false; @@ -4763,7 +4764,7 @@ if (code != OrthancPluginErrorCode_Success) { - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code); + ORTHANC_PLUGINS_THROW_ERROR_CODE(code); } else if (found) { @@ -4778,7 +4779,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_RESERVE_QUEUE_VALUE == 1 +#if HAS_ORTHANC_PLUGINS_RESERVE_QUEUE_VALUE == 1 bool Queue::ReserveBack(std::string& value, uint64_t& valueId, uint32_t releaseTimeout) { return ReserveInternal(value, valueId, OrthancPluginQueueOrigin_Back, releaseTimeout); @@ -4786,7 +4787,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_RESERVE_QUEUE_VALUE == 1 +#if HAS_ORTHANC_PLUGINS_RESERVE_QUEUE_VALUE == 1 bool Queue::ReserveFront(std::string& value, uint64_t& valueId, uint32_t releaseTimeout) { return ReserveInternal(value, valueId, OrthancPluginQueueOrigin_Front, releaseTimeout); @@ -4794,7 +4795,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_RESERVE_QUEUE_VALUE == 1 +#if HAS_ORTHANC_PLUGINS_RESERVE_QUEUE_VALUE == 1 void Queue::Acknowledge(uint64_t valueId) { OrthancPluginAcknowledgeQueueValue(OrthancPlugins::GetGlobalContext(), queueId_.c_str(), valueId); diff -r c5fa14f3bd7a -r 72c735f56b68 OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.h --- a/OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.h Mon Aug 17 09:31:18 2026 +0200 +++ b/OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.h Tue Aug 18 10:03:57 2026 +0200 @@ -66,98 +66,98 @@ #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 2, 0) // The "OrthancPluginFindMatcher()" primitive was introduced in Orthanc 1.2.0 -# define HAS_ORTHANC_PLUGIN_FIND_MATCHER 1 +# define HAS_ORTHANC_PLUGINS_FIND_MATCHER 1 #else -# define HAS_ORTHANC_PLUGIN_FIND_MATCHER 0 +# define HAS_ORTHANC_PLUGINS_FIND_MATCHER 0 #endif #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 4, 2) -# define HAS_ORTHANC_PLUGIN_PEERS 1 -# define HAS_ORTHANC_PLUGIN_JOB 1 +# define HAS_ORTHANC_PLUGINS_PEERS 1 +# define HAS_ORTHANC_PLUGINS_JOB 1 #else -# define HAS_ORTHANC_PLUGIN_PEERS 0 -# define HAS_ORTHANC_PLUGIN_JOB 0 +# define HAS_ORTHANC_PLUGINS_PEERS 0 +# define HAS_ORTHANC_PLUGINS_JOB 0 #endif #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 0) -# define HAS_ORTHANC_PLUGIN_EXCEPTION_DETAILS 1 +# define HAS_ORTHANC_PLUGINS_EXCEPTION_DETAILS 1 #else -# define HAS_ORTHANC_PLUGIN_EXCEPTION_DETAILS 0 +# define HAS_ORTHANC_PLUGINS_EXCEPTION_DETAILS 0 #endif #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 4) -# define HAS_ORTHANC_PLUGIN_METRICS 1 +# define HAS_ORTHANC_PLUGINS_METRICS 1 #else -# define HAS_ORTHANC_PLUGIN_METRICS 0 +# define HAS_ORTHANC_PLUGINS_METRICS 0 #endif #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 1, 0) -# define HAS_ORTHANC_PLUGIN_HTTP_CLIENT 1 +# define HAS_ORTHANC_PLUGINS_HTTP_CLIENT 1 #else -# define HAS_ORTHANC_PLUGIN_HTTP_CLIENT 0 +# define HAS_ORTHANC_PLUGINS_HTTP_CLIENT 0 #endif #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 7) -# define HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT 1 +# define HAS_ORTHANC_PLUGINS_CHUNKED_HTTP_CLIENT 1 #else -# define HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT 0 +# define HAS_ORTHANC_PLUGINS_CHUNKED_HTTP_CLIENT 0 #endif #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 7) -# define HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_SERVER 1 +# define HAS_ORTHANC_PLUGINS_CHUNKED_HTTP_SERVER 1 #else -# define HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_SERVER 0 +# define HAS_ORTHANC_PLUGINS_CHUNKED_HTTP_SERVER 0 #endif #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 6, 0) -# define HAS_ORTHANC_PLUGIN_STORAGE_COMMITMENT_SCP 1 +# define HAS_ORTHANC_PLUGINS_STORAGE_COMMITMENT_SCP 1 #else -# define HAS_ORTHANC_PLUGIN_STORAGE_COMMITMENT_SCP 0 +# define HAS_ORTHANC_PLUGINS_STORAGE_COMMITMENT_SCP 0 #endif #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 9, 2) -# define HAS_ORTHANC_PLUGIN_GENERIC_CALL_REST_API 1 +# define HAS_ORTHANC_PLUGINS_GENERIC_CALL_REST_API 1 #else -# define HAS_ORTHANC_PLUGIN_GENERIC_CALL_REST_API 0 +# define HAS_ORTHANC_PLUGINS_GENERIC_CALL_REST_API 0 #endif #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 10, 1) -# define HAS_ORTHANC_PLUGIN_WEBDAV 1 +# define HAS_ORTHANC_PLUGINS_WEBDAV 1 #else -# define HAS_ORTHANC_PLUGIN_WEBDAV 0 +# define HAS_ORTHANC_PLUGINS_WEBDAV 0 #endif #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4) -# define HAS_ORTHANC_PLUGIN_LOG_MESSAGE 1 +# define HAS_ORTHANC_PLUGINS_LOG_MESSAGE 1 #else -# define HAS_ORTHANC_PLUGIN_LOG_MESSAGE 0 +# define HAS_ORTHANC_PLUGINS_LOG_MESSAGE 0 #endif #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 8) -# define HAS_ORTHANC_PLUGIN_KEY_VALUE_STORES 1 -# define HAS_ORTHANC_PLUGIN_QUEUES 1 +# define HAS_ORTHANC_PLUGINS_KEY_VALUE_STORES 1 +# define HAS_ORTHANC_PLUGINS_QUEUES 1 #else -# define HAS_ORTHANC_PLUGIN_KEY_VALUE_STORES 0 -# define HAS_ORTHANC_PLUGIN_QUEUES 0 +# define HAS_ORTHANC_PLUGINS_KEY_VALUE_STORES 0 +# define HAS_ORTHANC_PLUGINS_QUEUES 0 #endif #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 10) -# define HAS_ORTHANC_PLUGIN_RESERVE_QUEUE_VALUE 1 +# define HAS_ORTHANC_PLUGINS_RESERVE_QUEUE_VALUE 1 #else -# define HAS_ORTHANC_PLUGIN_RESERVE_QUEUE_VALUE 0 +# define HAS_ORTHANC_PLUGINS_RESERVE_QUEUE_VALUE 0 #endif // Macro to tag a function as having been deprecated #if (__cplusplus >= 201402L) // C++14 -# define ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(f) [[deprecated]] f +# define ORTHANC_PLUGINS_CPP_WRAPPER_DEPRECATED(f) [[deprecated]] f #elif defined(__GNUC__) || defined(__clang__) -# define ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(f) f __attribute__((deprecated)) +# define ORTHANC_PLUGINS_CPP_WRAPPER_DEPRECATED(f) f __attribute__((deprecated)) #elif defined(_MSC_VER) -# define ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(f) __declspec(deprecated) f +# define ORTHANC_PLUGINS_CPP_WRAPPER_DEPRECATED(f) __declspec(deprecated) f #else -# define ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED +# define ORTHANC_PLUGINS_CPP_WRAPPER_DEPRECATED #endif @@ -171,7 +171,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1 +#if HAS_ORTHANC_PLUGINS_LOG_MESSAGE == 1 # define ORTHANC_PLUGINS_LOG_ERROR(msg) ::OrthancPlugins::LogMessage(OrthancPluginLogLevel_Error, __ORTHANC_FILE__, __LINE__, msg) # define ORTHANC_PLUGINS_LOG_WARNING(msg) ::OrthancPlugins::LogMessage(OrthancPluginLogLevel_Warning, __ORTHANC_FILE__, __LINE__, msg) # define ORTHANC_PLUGINS_LOG_INFO(msg) ::OrthancPlugins::LogMessage(OrthancPluginLogLevel_Info, __ORTHANC_FILE__, __LINE__, msg) @@ -296,7 +296,7 @@ const Json::Value& body, bool applyPlugins); -#if HAS_ORTHANC_PLUGIN_GENERIC_CALL_REST_API == 1 +#if HAS_ORTHANC_PLUGINS_GENERIC_CALL_REST_API == 1 bool RestApiPost(const std::string& uri, const Json::Value& body, const HttpHeaders& httpHeaders, @@ -395,7 +395,7 @@ void ToJson(Json::Value& target) const; void ToJsonWithoutComments(Json::Value& target) const; -}; + }; class OrthancConfiguration : public boost::noncopyable @@ -534,7 +534,7 @@ }; -#if HAS_ORTHANC_PLUGIN_FIND_MATCHER == 1 +#if HAS_ORTHANC_PLUGINS_FIND_MATCHER == 1 class FindMatcher : public boost::noncopyable { private: @@ -621,7 +621,7 @@ size_t bodySize, bool applyPlugins); -#if HAS_ORTHANC_PLUGIN_GENERIC_CALL_REST_API == 1 +#if HAS_ORTHANC_PLUGINS_GENERIC_CALL_REST_API == 1 bool RestApiPost(Json::Value& result, const std::string& uri, const Json::Value& body, @@ -700,30 +700,30 @@ const char* AutodetectMimeType(const std::string& path); #endif -#if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1 +#if HAS_ORTHANC_PLUGINS_LOG_MESSAGE == 1 void LogMessage(OrthancPluginLogLevel level, const char* file, uint32_t line, const std::string& message); #endif -#if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1 +#if HAS_ORTHANC_PLUGINS_LOG_MESSAGE == 1 // Use macro ORTHANC_PLUGINS_LOG_ERROR() instead - ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(void LogError(const std::string& message)); + ORTHANC_PLUGINS_CPP_WRAPPER_DEPRECATED(void LogError(const std::string& message)); #else void LogError(const std::string& message); #endif -#if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1 +#if HAS_ORTHANC_PLUGINS_LOG_MESSAGE == 1 // Use macro ORTHANC_PLUGINS_LOG_WARNING() instead - ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(void LogWarning(const std::string& message)); + ORTHANC_PLUGINS_CPP_WRAPPER_DEPRECATED(void LogWarning(const std::string& message)); #else void LogWarning(const std::string& message); #endif -#if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1 +#if HAS_ORTHANC_PLUGINS_LOG_MESSAGE == 1 // Use macro ORTHANC_PLUGINS_LOG_INFO() instead - ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(void LogInfo(const std::string& message)); + ORTHANC_PLUGINS_CPP_WRAPPER_DEPRECATED(void LogInfo(const std::string& message)); #else void LogInfo(const std::string& message); #endif @@ -755,7 +755,7 @@ } catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e) { -#if HAS_ORTHANC_EXCEPTION == 1 && HAS_ORTHANC_PLUGIN_EXCEPTION_DETAILS == 1 +#if HAS_ORTHANC_EXCEPTION == 1 && HAS_ORTHANC_PLUGINS_EXCEPTION_DETAILS == 1 if (HasGlobalContext() && e.HasDetails()) { @@ -798,7 +798,7 @@ } -#if HAS_ORTHANC_PLUGIN_PEERS == 1 +#if HAS_ORTHANC_PLUGINS_PEERS == 1 class OrthancPeers : public boost::noncopyable { private: @@ -943,7 +943,7 @@ -#if HAS_ORTHANC_PLUGIN_JOB == 1 +#if HAS_ORTHANC_PLUGINS_JOB == 1 class OrthancJob : public boost::noncopyable { private: @@ -1022,7 +1022,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_METRICS == 1 +#if HAS_ORTHANC_PLUGINS_METRICS == 1 inline void SetMetricsValue(const char* name, float value) { @@ -1042,7 +1042,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_METRICS == 1 +#if HAS_ORTHANC_PLUGINS_METRICS == 1 class MetricsTimer : public boost::noncopyable { private: @@ -1057,7 +1057,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_HTTP_CLIENT == 1 +#if HAS_ORTHANC_PLUGINS_HTTP_CLIENT == 1 class HttpClient : public boost::noncopyable { public: @@ -1105,7 +1105,7 @@ IRequestBody* chunkedBody_; bool allowChunkedTransfers_; -#if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT == 1 +#if HAS_ORTHANC_PLUGINS_CHUNKED_HTTP_CLIENT == 1 void ExecuteWithStream(uint16_t& httpStatus, // out IAnswer& answer, // out IRequestBody& body) const; @@ -1235,11 +1235,11 @@ const OrthancPluginHttpRequest* request); -#if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_SERVER == 1 +#if HAS_ORTHANC_PLUGINS_CHUNKED_HTTP_SERVER == 1 template static OrthancPluginErrorCode ChunkedProtect(OrthancPluginServerChunkedRequestReader** reader, - const char* url, - const OrthancPluginHttpRequest* request) + const char* url, + const OrthancPluginHttpRequest* request) { try { @@ -1327,7 +1327,7 @@ public: static void Apply(const std::string& uri) { -#if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_SERVER == 1 +#if HAS_ORTHANC_PLUGINS_CHUNKED_HTTP_SERVER == 1 OrthancPluginRegisterChunkedRestCallback( GetGlobalContext(), uri.c_str(), GetHandler == Internals::NullRestCallback ? NULL : Internals::Protect, @@ -1347,7 +1347,7 @@ -#if HAS_ORTHANC_PLUGIN_STORAGE_COMMITMENT_SCP == 1 +#if HAS_ORTHANC_PLUGINS_STORAGE_COMMITMENT_SCP == 1 class IStorageCommitmentScpHandler : public boost::noncopyable { public: @@ -1460,15 +1460,15 @@ }; // helper method to convert Http headers from the plugin SDK to a std::map -void GetHttpHeaders(HttpHeaders& result, const OrthancPluginHttpRequest* request); + void GetHttpHeaders(HttpHeaders& result, const OrthancPluginHttpRequest* request); // helper method to re-serialize the get arguments from the SDK into a string -void SerializeGetArguments(std::string& output, const OrthancPluginHttpRequest* request); + void SerializeGetArguments(std::string& output, const OrthancPluginHttpRequest* request); // helper method to convert Get arguments from the plugin SDK to a std::map -void GetGetArguments(GetArguments& result, const OrthancPluginHttpRequest* request); + void GetGetArguments(GetArguments& result, const OrthancPluginHttpRequest* request); -#if HAS_ORTHANC_PLUGIN_WEBDAV == 1 +#if HAS_ORTHANC_PLUGINS_WEBDAV == 1 class IWebDavCollection : public boost::noncopyable { public: @@ -1579,7 +1579,7 @@ const std::string& javascript); -#if HAS_ORTHANC_PLUGIN_GENERIC_CALL_REST_API == 1 +#if HAS_ORTHANC_PLUGINS_GENERIC_CALL_REST_API == 1 class RestApiClient : public boost::noncopyable { private: @@ -1679,7 +1679,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_KEY_VALUE_STORES == 1 +#if HAS_ORTHANC_PLUGINS_KEY_VALUE_STORES == 1 class KeyValueStore : public boost::noncopyable { public: @@ -1734,7 +1734,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_QUEUES == 1 +#if HAS_ORTHANC_PLUGINS_QUEUES == 1 class Queue : public boost::noncopyable { private: @@ -1742,7 +1742,7 @@ bool DequeueInternal(std::string& value, OrthancPluginQueueOrigin origin); -#if HAS_ORTHANC_PLUGIN_RESERVE_QUEUE_VALUE == 1 +#if HAS_ORTHANC_PLUGINS_RESERVE_QUEUE_VALUE == 1 bool ReserveInternal(std::string& value, uint64_t& valueId, OrthancPluginQueueOrigin origin, uint32_t releaseTimeout); #endif @@ -1765,7 +1765,7 @@ Enqueue(value.empty() ? NULL : value.c_str(), value.size()); } -#if HAS_ORTHANC_PLUGIN_RESERVE_QUEUE_VALUE == 1 +#if HAS_ORTHANC_PLUGINS_RESERVE_QUEUE_VALUE == 1 // Use ReserveBack() instead ORTHANC_PLUGIN_DEPRECATED #endif @@ -1774,7 +1774,7 @@ return DequeueInternal(value, OrthancPluginQueueOrigin_Back); } -#if HAS_ORTHANC_PLUGIN_RESERVE_QUEUE_VALUE == 1 +#if HAS_ORTHANC_PLUGINS_RESERVE_QUEUE_VALUE == 1 // Use ReserveFront() instead ORTHANC_PLUGIN_DEPRECATED #endif @@ -1785,15 +1785,15 @@ uint64_t GetSize(); -#if HAS_ORTHANC_PLUGIN_RESERVE_QUEUE_VALUE == 1 +#if HAS_ORTHANC_PLUGINS_RESERVE_QUEUE_VALUE == 1 bool ReserveBack(std::string& value, uint64_t& valueId, uint32_t releaseTimeout); #endif -#if HAS_ORTHANC_PLUGIN_RESERVE_QUEUE_VALUE == 1 +#if HAS_ORTHANC_PLUGINS_RESERVE_QUEUE_VALUE == 1 bool ReserveFront(std::string& value, uint64_t& valueId, uint32_t releaseTimeout); #endif -#if HAS_ORTHANC_PLUGIN_RESERVE_QUEUE_VALUE == 1 +#if HAS_ORTHANC_PLUGINS_RESERVE_QUEUE_VALUE == 1 void Acknowledge(uint64_t valueId); #endif }; diff -r c5fa14f3bd7a -r 72c735f56b68 OrthancServer/Plugins/Samples/Common/OrthancPluginException.h --- a/OrthancServer/Plugins/Samples/Common/OrthancPluginException.h Mon Aug 17 09:31:18 2026 +0200 +++ b/OrthancServer/Plugins/Samples/Common/OrthancPluginException.h Tue Aug 18 10:03:57 2026 +0200 @@ -40,36 +40,47 @@ # define ORTHANC_PLUGINS_GET_ERROR_CODE(code) ::OrthancPluginErrorCode_ ## code #endif -#if HAS_ORTHANC_EXCEPTION == 1 && defined(__ORTHANC_FILE__) // the OrthancException accepts a detail argument -> add the file and line number -# define PLUGIN_ORTHANC_EXCEPTION_STRINGIFY_LINE_HELPER(line) #line -# define PLUGIN_ORTHANC_EXCEPTION_STRINGIFY_LINE(line) PLUGIN_ORTHANC_EXCEPTION_STRINGIFY_LINE_HELPER(line) -# define PLUGIN_THROW_WITH_FILE_AND_LINE_INFO(errorCode) \ - throw ::Orthanc::OrthancException( \ - errorCode, #errorCode " triggered from " __ORTHANC_FILE__ ":" \ - PLUGIN_ORTHANC_EXCEPTION_STRINGIFY_LINE(__LINE__)) + +#if HAS_ORTHANC_EXCEPTION == 1 && defined(__ORTHANC_FILE__) // the OrthancException class accepts a "details" argument -> add the file and line number + +# include -# define PLUGIN_THROW_WITH_FILE_AND_LINE_INFO_HELPER(errorCode, errorCodeStr) \ - throw ::Orthanc::OrthancException( \ - errorCode, "Plugin error code " + errorCodeStr + " triggered from " __ORTHANC_FILE__ ":" \ - PLUGIN_ORTHANC_EXCEPTION_STRINGIFY_LINE(__LINE__)) +# define ORTHANC_PLUGINS_EXCEPTION_STRINGIFY_LINE_HELPER(line) #line +# define ORTHANC_PLUGINS_EXCEPTION_STRINGIFY_LINE(line) ORTHANC_PLUGINS_EXCEPTION_STRINGIFY_LINE_HELPER(line) +# define ORTHANC_PLUGINS_THROW_WITH_FILE_AND_LINE_INFO_HELPER(errorCode, errorCodeStr) \ + throw ::Orthanc::OrthancException( \ + errorCode, "Plugin error code " + errorCodeStr + " triggered from " __ORTHANC_FILE__ ":" \ + ORTHANC_PLUGINS_EXCEPTION_STRINGIFY_LINE(__LINE__)) + +# define ORTHANC_PLUGINS_THROW_WITH_FILE_AND_LINE_INFO(errorCode) \ + throw ::Orthanc::OrthancException( \ + errorCode, #errorCode " triggered from " __ORTHANC_FILE__ ":" \ + ORTHANC_PLUGINS_EXCEPTION_STRINGIFY_LINE(__LINE__)) -# define ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code) \ - PLUGIN_THROW_WITH_FILE_AND_LINE_INFO_HELPER(static_cast(code), boost::lexical_cast(code)) +# define ORTHANC_PLUGINS_THROW_ERROR_CODE(code) \ + ORTHANC_PLUGINS_THROW_WITH_FILE_AND_LINE_INFO_HELPER( \ + static_cast(code), \ + boost::lexical_cast(code)) -# define ORTHANC_PLUGINS_THROW_EXCEPTION(code) \ - PLUGIN_THROW_WITH_FILE_AND_LINE_INFO_HELPER(ORTHANC_PLUGINS_GET_ERROR_CODE(code), boost::lexical_cast(ORTHANC_PLUGINS_GET_ERROR_CODE(code))) +# define ORTHANC_PLUGINS_THROW_EXCEPTION(code) \ + ORTHANC_PLUGINS_THROW_WITH_FILE_AND_LINE_INFO_HELPER( \ + ORTHANC_PLUGINS_GET_ERROR_CODE(code), \ + boost::lexical_cast(ORTHANC_PLUGINS_GET_ERROR_CODE(code))) + +#else // the PluginException does not accept a "details" argument -#else // the PluginException does not accept a detail argument -# define ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code) \ - throw ORTHANC_PLUGINS_EXCEPTION_CLASS(static_cast(code)); +# define ORTHANC_PLUGINS_THROW_ERROR_CODE(code) \ + throw ORTHANC_PLUGINS_EXCEPTION_CLASS(static_cast(code)); + +# define ORTHANC_PLUGINS_THROW_WITH_FILE_AND_LINE_INFO(errorCode) \ + ORTHANC_PLUGINS_THROW_ERROR_CODE(errorCode) -# define PLUGIN_THROW_WITH_FILE_AND_LINE_INFO(errorCode) \ - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(errorCode) +# define ORTHANC_PLUGINS_THROW_EXCEPTION(code) \ + throw ORTHANC_PLUGINS_EXCEPTION_CLASS(ORTHANC_PLUGINS_GET_ERROR_CODE(code)); -# define ORTHANC_PLUGINS_THROW_EXCEPTION(code) \ - throw ORTHANC_PLUGINS_EXCEPTION_CLASS(ORTHANC_PLUGINS_GET_ERROR_CODE(code)); #endif + #define ORTHANC_PLUGINS_CHECK_ERROR(code) \ if (code != ORTHANC_PLUGINS_GET_ERROR_CODE(Success)) \ { \ diff -r c5fa14f3bd7a -r 72c735f56b68 OrthancServer/Plugins/Samples/ModalityWorklists/Plugin.cpp --- a/OrthancServer/Plugins/Samples/ModalityWorklists/Plugin.cpp Mon Aug 17 09:31:18 2026 +0200 +++ b/OrthancServer/Plugins/Samples/ModalityWorklists/Plugin.cpp Tue Aug 18 10:03:57 2026 +0200 @@ -56,7 +56,7 @@ if (code != OrthancPluginErrorCode_Success) { ORTHANC_PLUGINS_LOG_ERROR("Error while adding an answer to a worklist request"); - ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code); + ORTHANC_PLUGINS_THROW_ERROR_CODE(code); } return true;