comparison RenderingPlugin/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h @ 1913:6a65b7cb77ab

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 20 Mar 2022 17:54:31 +0100
parents a2955abe4c2e
children 0d1235ca4abc
comparison
equal deleted inserted replaced
1912:7947565ed2b7 1913:6a65b7cb77ab
113 # define HAS_ORTHANC_PLUGIN_STORAGE_COMMITMENT_SCP 1 113 # define HAS_ORTHANC_PLUGIN_STORAGE_COMMITMENT_SCP 1
114 #else 114 #else
115 # define HAS_ORTHANC_PLUGIN_STORAGE_COMMITMENT_SCP 0 115 # define HAS_ORTHANC_PLUGIN_STORAGE_COMMITMENT_SCP 0
116 #endif 116 #endif
117 117
118 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 10, 1)
119 # define HAS_ORTHANC_PLUGIN_WEBDAV 1
120 #else
121 # define HAS_ORTHANC_PLUGIN_WEBDAV 0
122 #endif
123
118 124
119 125
120 namespace OrthancPlugins 126 namespace OrthancPlugins
121 { 127 {
122 typedef void (*RestCallback) (OrthancPluginRestOutput* output, 128 typedef void (*RestCallback) (OrthancPluginRestOutput* output,
298 } 304 }
299 305
300 void ToString(std::string& target) const; 306 void ToString(std::string& target) const;
301 307
302 void ToJson(Json::Value& target) const; 308 void ToJson(Json::Value& target) const;
303 }; 309
310 void ToJsonWithoutComments(Json::Value& target) const;
311 };
304 312
305 313
306 class OrthancConfiguration : public boost::noncopyable 314 class OrthancConfiguration : public boost::noncopyable
307 { 315 {
308 private: 316 private:
1244 static DicomInstance* Transcode(const void* buffer, 1252 static DicomInstance* Transcode(const void* buffer,
1245 size_t size, 1253 size_t size,
1246 const std::string& transferSyntax); 1254 const std::string& transferSyntax);
1247 #endif 1255 #endif
1248 }; 1256 };
1257
1258
1259
1260 #if HAS_ORTHANC_PLUGIN_WEBDAV == 1
1261 class IWebDavCollection : public boost::noncopyable
1262 {
1263 public:
1264 class FileInfo
1265 {
1266 private:
1267 std::string name_;
1268 uint64_t contentSize_;
1269 std::string mime_;
1270 std::string dateTime_;
1271
1272 public:
1273 FileInfo(const std::string& name,
1274 uint64_t contentSize,
1275 const std::string& dateTime) :
1276 name_(name),
1277 contentSize_(contentSize),
1278 dateTime_(dateTime)
1279 {
1280 }
1281
1282 const std::string& GetName() const
1283 {
1284 return name_;
1285 }
1286
1287 uint64_t GetContentSize() const
1288 {
1289 return contentSize_;
1290 }
1291
1292 void SetMimeType(const std::string& mime)
1293 {
1294 mime_ = mime;
1295 }
1296
1297 const std::string& GetMimeType() const
1298 {
1299 return mime_;
1300 }
1301
1302 const std::string& GetDateTime() const
1303 {
1304 return dateTime_;
1305 }
1306 };
1307
1308 class FolderInfo
1309 {
1310 private:
1311 std::string name_;
1312 std::string dateTime_;
1313
1314 public:
1315 FolderInfo(const std::string& name,
1316 const std::string& dateTime) :
1317 name_(name),
1318 dateTime_(dateTime)
1319 {
1320 }
1321
1322 const std::string& GetName() const
1323 {
1324 return name_;
1325 }
1326
1327 const std::string& GetDateTime() const
1328 {
1329 return dateTime_;
1330 }
1331 };
1332
1333 virtual ~IWebDavCollection()
1334 {
1335 }
1336
1337 virtual bool IsExistingFolder(const std::vector<std::string>& path) = 0;
1338
1339 virtual bool ListFolder(std::list<FileInfo>& files,
1340 std::list<FolderInfo>& subfolders,
1341 const std::vector<std::string>& path) = 0;
1342
1343 virtual bool GetFile(std::string& content /* out */,
1344 std::string& mime /* out */,
1345 std::string& dateTime /* out */,
1346 const std::vector<std::string>& path) = 0;
1347
1348 virtual bool StoreFile(const std::vector<std::string>& path,
1349 const void* data,
1350 size_t size) = 0;
1351
1352 virtual bool CreateFolder(const std::vector<std::string>& path) = 0;
1353
1354 virtual bool DeleteItem(const std::vector<std::string>& path) = 0;
1355
1356 static void Register(const std::string& uri,
1357 IWebDavCollection& collection);
1358 };
1359 #endif
1360
1361
1362 #if HAS_ORTHANC_PLUGIN_WEBDAV == 1
1363 class ReadOnlyWebDavCollection : public IWebDavCollection
1364 {
1365 public:
1366 virtual bool StoreFile(const std::vector<std::string>& path,
1367 const void* data,
1368 size_t size)
1369 {
1370 return false;
1371 }
1372
1373 virtual bool CreateFolder(const std::vector<std::string>& path)
1374 {
1375 return false;
1376 }
1377
1378 virtual bool DeleteItem(const std::vector<std::string>& path)
1379 {
1380 return false;
1381 }
1382 };
1383 #endif
1249 } 1384 }