annotate OrthancServer/Plugins/Samples/WebDavFilesystem/Plugin.cpp @ 5640:f7adfb22e20e

updated copyright, as Orthanc Team now replaces Osimis
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 30 May 2024 21:19:57 +0200
parents f0dc99bc811c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4943
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
5640
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5572
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5572
diff changeset
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
4943
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 *
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * This program is free software: you can redistribute it and/or
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * modify it under the terms of the GNU General Public License as
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * published by the Free Software Foundation, either version 3 of the
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * License, or (at your option) any later version.
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 *
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful, but
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * General Public License for more details.
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 *
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 **/
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "../Common/OrthancPluginCppWrapper.h"
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include <boost/thread/mutex.hpp>
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 class Resource : public boost::noncopyable
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 private:
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 boost::posix_time::ptime dateTime_;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 public:
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 Resource() :
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 dateTime_(boost::posix_time::second_clock::universal_time())
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 virtual ~Resource()
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 const boost::posix_time::ptime& GetDateTime() const
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 return dateTime_;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 virtual bool IsFolder() const = 0;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 virtual Resource* LookupPath(const std::vector<std::string>& path) = 0;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 };
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 class File : public Resource
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 private:
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 std::string content_;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 public:
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 File(const void* data,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 size_t size) :
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 content_(reinterpret_cast<const char*>(data), size)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 const std::string& GetContent() const
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 return content_;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 virtual bool IsFolder() const
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 return false;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 virtual Resource* LookupPath(const std::vector<std::string>& path)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 if (path.empty())
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 return this;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 else
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 return NULL;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 };
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 class Folder : public Resource
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 private:
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 typedef std::map<std::string, Resource*> Content;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 Content content_;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 public:
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 virtual ~Folder()
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 for (Content::iterator it = content_.begin(); it != content_.end(); ++it)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 assert(it->second != NULL);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 delete it->second;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 virtual bool IsFolder() const
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 return true;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 virtual Resource* LookupPath(const std::vector<std::string>& path)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 if (path.empty())
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 return this;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 else
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 Content::const_iterator found = content_.find(path[0]);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 if (found == content_.end())
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 return NULL;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 else
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 std::vector<std::string> childPath(path.size() - 1);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 for (size_t i = 0; i < childPath.size(); i++)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 childPath[i] = path[i + 1];
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 return found->second->LookupPath(childPath);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 void ListContent(std::list<OrthancPlugins::IWebDavCollection::FileInfo>& files,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 std::list<OrthancPlugins::IWebDavCollection::FolderInfo>& subfolders) const
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 for (Content::const_iterator it = content_.begin(); it != content_.end(); ++it)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 assert(it->second != NULL);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 const std::string dateTime = boost::posix_time::to_iso_string(it->second->GetDateTime());
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 if (it->second->IsFolder())
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 subfolders.push_back(OrthancPlugins::IWebDavCollection::FolderInfo(it->first, dateTime));
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 else
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 const File& f = dynamic_cast<const File&>(*it->second);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 files.push_back(OrthancPlugins::IWebDavCollection::FileInfo(it->first, f.GetContent().size(), dateTime));
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 void StoreFile(const std::string& name,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 File* f)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 std::unique_ptr<File> protection(f);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 if (content_.find(name) != content_.end())
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 {
5572
f0dc99bc811c removed circular dependency of OrthancPluginsCppWrapper with Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
168 ORTHANC_PLUGINS_LOG_ERROR("Already existing: " + name);
4943
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 ORTHANC_PLUGINS_THROW_EXCEPTION(BadRequest);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 else
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 content_[name] = protection.release();
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 void CreateSubfolder(const std::string& name)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 if (content_.find(name) != content_.end())
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 {
5572
f0dc99bc811c removed circular dependency of OrthancPluginsCppWrapper with Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
181 ORTHANC_PLUGINS_LOG_ERROR("Already existing: " + name);
4943
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 ORTHANC_PLUGINS_THROW_EXCEPTION(BadRequest);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 else
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 content_[name] = new Folder;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 void DeleteItem(const std::string& name)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 Content::iterator found = content_.find(name);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 if (found == content_.end())
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 {
5572
f0dc99bc811c removed circular dependency of OrthancPluginsCppWrapper with Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
196 ORTHANC_PLUGINS_LOG_ERROR("Cannot delete inexistent path: " + name);
4943
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 ORTHANC_PLUGINS_THROW_EXCEPTION(InexistentItem);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 else
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 assert(found->second != NULL);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 delete found->second;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 content_.erase(found);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 };
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 class WebDavFilesystem : public OrthancPlugins::IWebDavCollection
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 private:
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 boost::mutex mutex_;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 std::unique_ptr<Resource> root_;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 static std::vector<std::string> GetParentPath(const std::vector<std::string>& path)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 if (path.empty())
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 {
5572
f0dc99bc811c removed circular dependency of OrthancPluginsCppWrapper with Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
219 ORTHANC_PLUGINS_LOG_ERROR("Empty path");
4943
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 ORTHANC_PLUGINS_THROW_EXCEPTION(ParameterOutOfRange);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 else
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 std::vector<std::string> p(path.size() - 1);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 for (size_t i = 0; i < p.size(); i++)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 p[i] = path[i];
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 return p;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 public:
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 WebDavFilesystem() :
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 root_(new Folder)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 virtual bool IsExistingFolder(const std::vector<std::string>& path)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 boost::mutex::scoped_lock lock(mutex_);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 Resource* resource = root_->LookupPath(path);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 return (resource != NULL &&
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 resource->IsFolder());
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 virtual bool ListFolder(std::list<FileInfo>& files,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 std::list<FolderInfo>& subfolders,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 const std::vector<std::string>& path)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 boost::mutex::scoped_lock lock(mutex_);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 Resource* resource = root_->LookupPath(path);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 if (resource != NULL &&
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 resource->IsFolder())
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 dynamic_cast<Folder&>(*resource).ListContent(files, subfolders);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 return true;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 else
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 return false;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 virtual bool GetFile(std::string& content /* out */,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 std::string& mime /* out */,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 std::string& dateTime /* out */,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 const std::vector<std::string>& path)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 boost::mutex::scoped_lock lock(mutex_);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 Resource* resource = root_->LookupPath(path);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 if (resource != NULL &&
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 !resource->IsFolder())
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 const File& file = dynamic_cast<const File&>(*resource);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 content = file.GetContent();
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282 mime = ""; // Let the Orthanc core autodetect the MIME type
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 dateTime = boost::posix_time::to_iso_string(file.GetDateTime());
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284 return true;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286 else
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 return false;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 virtual bool StoreFile(const std::vector<std::string>& path,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 const void* data,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 size_t size)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296 boost::mutex::scoped_lock lock(mutex_);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298 Resource* parent = root_->LookupPath(GetParentPath(path));
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 if (parent != NULL &&
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300 parent->IsFolder())
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302 dynamic_cast<Folder&>(*parent).StoreFile(path.back(), new File(data, size));
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303 return true;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305 else
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 return false;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
310
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311 virtual bool CreateFolder(const std::vector<std::string>& path)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313 boost::mutex::scoped_lock lock(mutex_);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
314
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315 Resource* parent = root_->LookupPath(GetParentPath(path));
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316 if (parent != NULL &&
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317 parent->IsFolder())
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319 dynamic_cast<Folder&>(*parent).CreateSubfolder(path.back());
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320 return true;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322 else
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
323 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324 return false;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 virtual bool DeleteItem(const std::vector<std::string>& path)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330 boost::mutex::scoped_lock lock(mutex_);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
332 Resource* parent = root_->LookupPath(GetParentPath(path));
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333 if (parent != NULL &&
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334 parent->IsFolder())
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336 dynamic_cast<Folder&>(*parent).DeleteItem(path.back());
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337 return true;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
339 else
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
340 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
341 return false;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
342 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
343 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
344 };
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
345
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
347
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
348 extern "C"
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
349 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
351 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352 OrthancPlugins::SetGlobalContext(c);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353 OrthancPluginLogWarning(c, "WebDAV plugin is initializing");
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355 /* Check the version of the Orthanc core */
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356 if (OrthancPluginCheckVersion(c) == 0)
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 char info[1024];
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359 sprintf(info, "Your version of Orthanc (%s) must be above %d.%d.%d to run this plugin",
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360 c->orthancVersion,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361 ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
362 ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER,
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364 OrthancPluginLogError(c, info);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365 return -1;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368 static WebDavFilesystem filesystem;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369 OrthancPlugins::IWebDavCollection::Register("/webdav-plugin", filesystem);
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
370
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371 return 0;
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
373
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375 ORTHANC_PLUGINS_API void OrthancPluginFinalize()
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377 OrthancPluginLogWarning(OrthancPlugins::GetGlobalContext(), "WebDAV plugin is finalizing");
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381 ORTHANC_PLUGINS_API const char* OrthancPluginGetName()
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383 return "webdav-sample";
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
386
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387 ORTHANC_PLUGINS_API const char* OrthancPluginGetVersion()
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 {
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 return "0.0";
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390 }
47d734fa30f6 adding function OrthancPluginRegisterWebDavCollection() to the plugin SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 }