comparison Plugins/Engine/OrthancPlugins.cpp @ 1249:40725595aaf0

Plugins can get/set global properties to save their configuration
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 15 Dec 2014 10:20:33 +0100
parents f1c01451a8ee
children 2ffe07abd9d8
comparison
equal deleted inserted replaced
1248:db753e57934f 1249:40725595aaf0
1024 pimpl_->storageArea_ = p; 1024 pimpl_->storageArea_ = p;
1025 pimpl_->hasStorageArea_ = true; 1025 pimpl_->hasStorageArea_ = true;
1026 return true; 1026 return true;
1027 } 1027 }
1028 1028
1029 case _OrthancPluginService_SetProperty: 1029 case _OrthancPluginService_SetPluginProperty:
1030 { 1030 {
1031 const _OrthancPluginSetProperty& p = 1031 const _OrthancPluginSetPluginProperty& p =
1032 *reinterpret_cast<const _OrthancPluginSetProperty*>(parameters); 1032 *reinterpret_cast<const _OrthancPluginSetPluginProperty*>(parameters);
1033 pimpl_->properties_[std::make_pair(p.plugin, p.property)] = p.value; 1033 pimpl_->properties_[std::make_pair(p.plugin, p.property)] = p.value;
1034 return true;
1035 }
1036
1037 case _OrthancPluginService_SetGlobalProperty:
1038 {
1039 const _OrthancPluginGlobalProperty& p =
1040 *reinterpret_cast<const _OrthancPluginGlobalProperty*>(parameters);
1041 if (p.property < 1024)
1042 {
1043 return false;
1044 }
1045 else
1046 {
1047 pimpl_->context_.GetIndex().SetGlobalProperty(static_cast<GlobalProperty>(p.property), p.value);
1048 return true;
1049 }
1050 }
1051
1052 case _OrthancPluginService_GetGlobalProperty:
1053 {
1054 const _OrthancPluginGlobalProperty& p =
1055 *reinterpret_cast<const _OrthancPluginGlobalProperty*>(parameters);
1056 std::string result = pimpl_->context_.GetIndex().GetGlobalProperty(static_cast<GlobalProperty>(p.property), p.value);
1057 *(p.result) = CopyString(result);
1034 return true; 1058 return true;
1035 } 1059 }
1036 1060
1037 default: 1061 default:
1038 return false; 1062 return false;