Mercurial > hg > orthanc
comparison Core/RestApi/RestApiHierarchy.h @ 974:83622b0f544c
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 30 Jun 2014 14:44:05 +0200 |
parents | 2047e6f033bd |
children | c550e99c452b |
comparison
equal
deleted
inserted
replaced
972:2047e6f033bd | 974:83622b0f544c |
---|---|
45 { | 45 { |
46 private: | 46 private: |
47 class Handlers | 47 class Handlers |
48 { | 48 { |
49 private: | 49 private: |
50 RestApi::GetHandler getHandler_; | 50 RestApiGetCall::Handler getHandler_; |
51 RestApi::PostHandler postHandler_; | 51 RestApiPostCall::Handler postHandler_; |
52 RestApi::PutHandler putHandler_; | 52 RestApiPutCall::Handler putHandler_; |
53 RestApi::DeleteHandler deleteHandler_; | 53 RestApiDeleteCall::Handler deleteHandler_; |
54 | 54 |
55 public: | 55 public: |
56 Handlers(); | 56 Handlers(); |
57 | 57 |
58 bool HasHandler(HttpMethod method) const; | 58 bool HasHandler(HttpMethod method) const; |
59 | 59 |
60 RestApi::GetHandler GetGetHandler() const; | 60 RestApiGetCall::Handler GetGetHandler() const; |
61 | 61 |
62 RestApi::PutHandler GetPutHandler() const; | 62 RestApiPutCall::Handler GetPutHandler() const; |
63 | 63 |
64 RestApi::PostHandler GetPostHandler() const; | 64 RestApiPostCall::Handler GetPostHandler() const; |
65 | 65 |
66 RestApi::DeleteHandler GetDeleteHandler() const; | 66 RestApiDeleteCall::Handler GetDeleteHandler() const; |
67 | 67 |
68 void Register(RestApi::GetHandler handler) | 68 void Register(RestApiGetCall::Handler handler) |
69 { | 69 { |
70 getHandler_ = handler; | 70 getHandler_ = handler; |
71 } | 71 } |
72 | 72 |
73 void Register(RestApi::PutHandler handler) | 73 void Register(RestApiPutCall::Handler handler) |
74 { | 74 { |
75 putHandler_ = handler; | 75 putHandler_ = handler; |
76 } | 76 } |
77 | 77 |
78 void Register(RestApi::PostHandler handler) | 78 void Register(RestApiPostCall::Handler handler) |
79 { | 79 { |
80 postHandler_ = handler; | 80 postHandler_ = handler; |
81 } | 81 } |
82 | 82 |
83 void Register(RestApi::DeleteHandler handler) | 83 void Register(RestApiDeleteCall::Handler handler) |
84 { | 84 { |
85 deleteHandler_ = handler; | 85 deleteHandler_ = handler; |
86 } | 86 } |
87 | 87 |
88 bool IsEmpty() const; | 88 bool IsEmpty() const; |
149 | 149 |
150 public: | 150 public: |
151 ~RestApiHierarchy(); | 151 ~RestApiHierarchy(); |
152 | 152 |
153 void Register(const std::string& uri, | 153 void Register(const std::string& uri, |
154 RestApi::GetHandler handler); | 154 RestApiGetCall::Handler handler); |
155 | 155 |
156 void Register(const std::string& uri, | 156 void Register(const std::string& uri, |
157 RestApi::PutHandler handler); | 157 RestApiPutCall::Handler handler); |
158 | 158 |
159 void Register(const std::string& uri, | 159 void Register(const std::string& uri, |
160 RestApi::PostHandler handler); | 160 RestApiPostCall::Handler handler); |
161 | 161 |
162 void Register(const std::string& uri, | 162 void Register(const std::string& uri, |
163 RestApi::DeleteHandler handler); | 163 RestApiDeleteCall::Handler handler); |
164 | 164 |
165 void CreateSiteMap(Json::Value& target) const; | 165 void CreateSiteMap(Json::Value& target) const; |
166 | 166 |
167 bool GetDirectory(Json::Value& result, | 167 bool GetDirectory(Json::Value& result, |
168 const UriComponents& uri) | 168 const UriComponents& uri) |
169 { | 169 { |
170 return GetDirectory(result, uri, 0); | 170 return GetDirectory(result, uri, 0); |
171 } | 171 } |
172 | 172 |
173 bool Handle(RestApi::GetCall& call, | 173 bool Handle(RestApiGetCall& call, |
174 const UriComponents& uri); | 174 const UriComponents& uri); |
175 | 175 |
176 bool Handle(RestApi::PutCall& call, | 176 bool Handle(RestApiPutCall& call, |
177 const UriComponents& uri); | 177 const UriComponents& uri); |
178 | 178 |
179 bool Handle(RestApi::PostCall& call, | 179 bool Handle(RestApiPostCall& call, |
180 const UriComponents& uri); | 180 const UriComponents& uri); |
181 | 181 |
182 bool Handle(RestApi::DeleteCall& call, | 182 bool Handle(RestApiDeleteCall& call, |
183 const UriComponents& uri); | 183 const UriComponents& uri); |
184 }; | 184 }; |
185 } | 185 } |