Mercurial > hg > orthanc
comparison Core/RestApi/RestApiHierarchy.cpp @ 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 |
---|---|
74 putHandler_ == NULL && | 74 putHandler_ == NULL && |
75 deleteHandler_ == NULL); | 75 deleteHandler_ == NULL); |
76 } | 76 } |
77 | 77 |
78 | 78 |
79 RestApi::GetHandler RestApiHierarchy::Handlers::GetGetHandler() const | 79 RestApiGetCall::Handler RestApiHierarchy::Handlers::GetGetHandler() const |
80 { | 80 { |
81 assert(getHandler_ != NULL); | 81 assert(getHandler_ != NULL); |
82 return getHandler_; | 82 return getHandler_; |
83 } | 83 } |
84 | 84 |
85 RestApi::PutHandler RestApiHierarchy::Handlers::GetPutHandler() const | 85 RestApiPutCall::Handler RestApiHierarchy::Handlers::GetPutHandler() const |
86 { | 86 { |
87 assert(putHandler_ != NULL); | 87 assert(putHandler_ != NULL); |
88 return putHandler_; | 88 return putHandler_; |
89 } | 89 } |
90 | 90 |
91 RestApi::PostHandler RestApiHierarchy::Handlers::GetPostHandler() const | 91 RestApiPostCall::Handler RestApiHierarchy::Handlers::GetPostHandler() const |
92 { | 92 { |
93 assert(postHandler_ != NULL); | 93 assert(postHandler_ != NULL); |
94 return postHandler_; | 94 return postHandler_; |
95 } | 95 } |
96 | 96 |
97 RestApi::DeleteHandler RestApiHierarchy::Handlers::GetDeleteHandler() const | 97 RestApiDeleteCall::Handler RestApiHierarchy::Handlers::GetDeleteHandler() const |
98 { | 98 { |
99 assert(deleteHandler_ != NULL); | 99 assert(deleteHandler_ != NULL); |
100 return deleteHandler_; | 100 return deleteHandler_; |
101 } | 101 } |
102 | 102 |
284 const UriComponents& trailing, | 284 const UriComponents& trailing, |
285 void* call) | 285 void* call) |
286 { | 286 { |
287 if (handlers.HasHandler(HttpMethod_Get)) | 287 if (handlers.HasHandler(HttpMethod_Get)) |
288 { | 288 { |
289 handlers.GetGetHandler() (*reinterpret_cast<RestApi::GetCall*>(call)); | 289 handlers.GetGetHandler() (*reinterpret_cast<RestApiGetCall*>(call)); |
290 return true; | 290 return true; |
291 } | 291 } |
292 else | 292 else |
293 { | 293 { |
294 return false; | 294 return false; |
302 const UriComponents& trailing, | 302 const UriComponents& trailing, |
303 void* call) | 303 void* call) |
304 { | 304 { |
305 if (handlers.HasHandler(HttpMethod_Post)) | 305 if (handlers.HasHandler(HttpMethod_Post)) |
306 { | 306 { |
307 handlers.GetPostHandler() (*reinterpret_cast<RestApi::PostCall*>(call)); | 307 handlers.GetPostHandler() (*reinterpret_cast<RestApiPostCall*>(call)); |
308 return true; | 308 return true; |
309 } | 309 } |
310 else | 310 else |
311 { | 311 { |
312 return false; | 312 return false; |
320 const UriComponents& trailing, | 320 const UriComponents& trailing, |
321 void* call) | 321 void* call) |
322 { | 322 { |
323 if (handlers.HasHandler(HttpMethod_Put)) | 323 if (handlers.HasHandler(HttpMethod_Put)) |
324 { | 324 { |
325 handlers.GetPutHandler() (*reinterpret_cast<RestApi::PutCall*>(call)); | 325 handlers.GetPutHandler() (*reinterpret_cast<RestApiPutCall*>(call)); |
326 return true; | 326 return true; |
327 } | 327 } |
328 else | 328 else |
329 { | 329 { |
330 return false; | 330 return false; |
338 const UriComponents& trailing, | 338 const UriComponents& trailing, |
339 void* call) | 339 void* call) |
340 { | 340 { |
341 if (handlers.HasHandler(HttpMethod_Delete)) | 341 if (handlers.HasHandler(HttpMethod_Delete)) |
342 { | 342 { |
343 handlers.GetDeleteHandler() (*reinterpret_cast<RestApi::DeleteCall*>(call)); | 343 handlers.GetDeleteHandler() (*reinterpret_cast<RestApiDeleteCall*>(call)); |
344 return true; | 344 return true; |
345 } | 345 } |
346 else | 346 else |
347 { | 347 { |
348 return false; | 348 return false; |
355 DeleteChildren(children_); | 355 DeleteChildren(children_); |
356 DeleteChildren(wildcardChildren_); | 356 DeleteChildren(wildcardChildren_); |
357 } | 357 } |
358 | 358 |
359 void RestApiHierarchy::Register(const std::string& uri, | 359 void RestApiHierarchy::Register(const std::string& uri, |
360 RestApi::GetHandler handler) | 360 RestApiGetCall::Handler handler) |
361 { | 361 { |
362 RestApiPath path(uri); | 362 RestApiPath path(uri); |
363 RegisterInternal(path, handler, 0); | 363 RegisterInternal(path, handler, 0); |
364 } | 364 } |
365 | 365 |
366 void RestApiHierarchy::Register(const std::string& uri, | 366 void RestApiHierarchy::Register(const std::string& uri, |
367 RestApi::PutHandler handler) | 367 RestApiPutCall::Handler handler) |
368 { | 368 { |
369 RestApiPath path(uri); | 369 RestApiPath path(uri); |
370 RegisterInternal(path, handler, 0); | 370 RegisterInternal(path, handler, 0); |
371 } | 371 } |
372 | 372 |
373 void RestApiHierarchy::Register(const std::string& uri, | 373 void RestApiHierarchy::Register(const std::string& uri, |
374 RestApi::PostHandler handler) | 374 RestApiPostCall::Handler handler) |
375 { | 375 { |
376 RestApiPath path(uri); | 376 RestApiPath path(uri); |
377 RegisterInternal(path, handler, 0); | 377 RegisterInternal(path, handler, 0); |
378 } | 378 } |
379 | 379 |
380 void RestApiHierarchy::Register(const std::string& uri, | 380 void RestApiHierarchy::Register(const std::string& uri, |
381 RestApi::DeleteHandler handler) | 381 RestApiDeleteCall::Handler handler) |
382 { | 382 { |
383 RestApiPath path(uri); | 383 RestApiPath path(uri); |
384 RegisterInternal(path, handler, 0); | 384 RegisterInternal(path, handler, 0); |
385 } | 385 } |
386 | 386 |
427 { | 427 { |
428 it->second->CreateSiteMap(target["* (" + it->first + ")"]); | 428 it->second->CreateSiteMap(target["* (" + it->first + ")"]); |
429 }*/ | 429 }*/ |
430 } | 430 } |
431 | 431 |
432 bool RestApiHierarchy::Handle(RestApi::GetCall& call, | 432 bool RestApiHierarchy::Handle(RestApiGetCall& call, |
433 const UriComponents& uri) | 433 const UriComponents& uri) |
434 { | 434 { |
435 RestApiPath::Components components; | 435 RestApiPath::Components components; |
436 return LookupHandler(components, uri, GetCallback, 0, &call); | 436 return LookupHandler(components, uri, GetCallback, 0, &call); |
437 } | 437 } |
438 | 438 |
439 bool RestApiHierarchy::Handle(RestApi::PutCall& call, | 439 bool RestApiHierarchy::Handle(RestApiPutCall& call, |
440 const UriComponents& uri) | 440 const UriComponents& uri) |
441 { | 441 { |
442 RestApiPath::Components components; | 442 RestApiPath::Components components; |
443 return LookupHandler(components, uri, PutCallback, 0, &call); | 443 return LookupHandler(components, uri, PutCallback, 0, &call); |
444 } | 444 } |
445 | 445 |
446 bool RestApiHierarchy::Handle(RestApi::PostCall& call, | 446 bool RestApiHierarchy::Handle(RestApiPostCall& call, |
447 const UriComponents& uri) | 447 const UriComponents& uri) |
448 { | 448 { |
449 RestApiPath::Components components; | 449 RestApiPath::Components components; |
450 return LookupHandler(components, uri, PostCallback, 0, &call); | 450 return LookupHandler(components, uri, PostCallback, 0, &call); |
451 } | 451 } |
452 | 452 |
453 bool RestApiHierarchy::Handle(RestApi::DeleteCall& call, | 453 bool RestApiHierarchy::Handle(RestApiDeleteCall& call, |
454 const UriComponents& uri) | 454 const UriComponents& uri) |
455 { | 455 { |
456 RestApiPath::Components components; | 456 RestApiPath::Components components; |
457 return LookupHandler(components, uri, DeleteCallback, 0, &call); | 457 return LookupHandler(components, uri, DeleteCallback, 0, &call); |
458 } | 458 } |