comparison OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.h @ 4962:501411a67f10 more-tags

merge
author Alain Mazy <am@osimis.io>
date Wed, 23 Mar 2022 12:23:11 +0100
parents 1b76853e1797 51e4947aa3b3
children 8c9a1cce076e
comparison
equal deleted inserted replaced
4961:1b76853e1797 4962:501411a67f10
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,
1255 static DicomInstance* Transcode(const void* buffer, 1261 static DicomInstance* Transcode(const void* buffer,
1256 size_t size, 1262 size_t size,
1257 const std::string& transferSyntax); 1263 const std::string& transferSyntax);
1258 #endif 1264 #endif
1259 }; 1265 };
1266
1267
1268
1269 #if HAS_ORTHANC_PLUGIN_WEBDAV == 1
1270 class IWebDavCollection : public boost::noncopyable
1271 {
1272 public:
1273 class FileInfo
1274 {
1275 private:
1276 std::string name_;
1277 uint64_t contentSize_;
1278 std::string mime_;
1279 std::string dateTime_;
1280
1281 public:
1282 FileInfo(const std::string& name,
1283 uint64_t contentSize,
1284 const std::string& dateTime) :
1285 name_(name),
1286 contentSize_(contentSize),
1287 dateTime_(dateTime)
1288 {
1289 }
1290
1291 const std::string& GetName() const
1292 {
1293 return name_;
1294 }
1295
1296 uint64_t GetContentSize() const
1297 {
1298 return contentSize_;
1299 }
1300
1301 void SetMimeType(const std::string& mime)
1302 {
1303 mime_ = mime;
1304 }
1305
1306 const std::string& GetMimeType() const
1307 {
1308 return mime_;
1309 }
1310
1311 const std::string& GetDateTime() const
1312 {
1313 return dateTime_;
1314 }
1315 };
1316
1317 class FolderInfo
1318 {
1319 private:
1320 std::string name_;
1321 std::string dateTime_;
1322
1323 public:
1324 FolderInfo(const std::string& name,
1325 const std::string& dateTime) :
1326 name_(name),
1327 dateTime_(dateTime)
1328 {
1329 }
1330
1331 const std::string& GetName() const
1332 {
1333 return name_;
1334 }
1335
1336 const std::string& GetDateTime() const
1337 {
1338 return dateTime_;
1339 }
1340 };
1341
1342 virtual ~IWebDavCollection()
1343 {
1344 }
1345
1346 virtual bool IsExistingFolder(const std::vector<std::string>& path) = 0;
1347
1348 virtual bool ListFolder(std::list<FileInfo>& files,
1349 std::list<FolderInfo>& subfolders,
1350 const std::vector<std::string>& path) = 0;
1351
1352 virtual bool GetFile(std::string& content /* out */,
1353 std::string& mime /* out */,
1354 std::string& dateTime /* out */,
1355 const std::vector<std::string>& path) = 0;
1356
1357 virtual bool StoreFile(const std::vector<std::string>& path,
1358 const void* data,
1359 size_t size) = 0;
1360
1361 virtual bool CreateFolder(const std::vector<std::string>& path) = 0;
1362
1363 virtual bool DeleteItem(const std::vector<std::string>& path) = 0;
1364
1365 static void Register(const std::string& uri,
1366 IWebDavCollection& collection);
1367 };
1368 #endif
1260 } 1369 }