Mercurial > hg > orthanc
changeset 970:1a3817d84f39
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 30 Jun 2014 13:23:05 +0200 |
parents | 3dce528b0cc2 |
children | 509e146c3cb3 2047e6f033bd |
files | Core/RestApi/RestApiHierarchy.cpp Core/RestApi/RestApiHierarchy.h UnitTestsSources/RestApiTests.cpp |
diffstat | 3 files changed, 16 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/Core/RestApi/RestApiHierarchy.cpp Mon Jun 30 13:17:49 2014 +0200 +++ b/Core/RestApi/RestApiHierarchy.cpp Mon Jun 30 13:23:05 2014 +0200 @@ -308,27 +308,31 @@ DeleteChildren(wildcardChildren_); } - void RestApiHierarchy::Register(const RestApiPath& path, + void RestApiHierarchy::Register(const std::string& uri, RestApi::GetHandler handler) { + RestApiPath path(uri); RegisterInternal(path, handler, 0); } - void RestApiHierarchy::Register(const RestApiPath& path, + void RestApiHierarchy::Register(const std::string& uri, RestApi::PutHandler handler) { + RestApiPath path(uri); RegisterInternal(path, handler, 0); } - void RestApiHierarchy::Register(const RestApiPath& path, + void RestApiHierarchy::Register(const std::string& uri, RestApi::PostHandler handler) { + RestApiPath path(uri); RegisterInternal(path, handler, 0); } - void RestApiHierarchy::Register(const RestApiPath& path, + void RestApiHierarchy::Register(const std::string& uri, RestApi::DeleteHandler handler) { + RestApiPath path(uri); RegisterInternal(path, handler, 0); }
--- a/Core/RestApi/RestApiHierarchy.h Mon Jun 30 13:17:49 2014 +0200 +++ b/Core/RestApi/RestApiHierarchy.h Mon Jun 30 13:23:05 2014 +0200 @@ -143,16 +143,16 @@ public: ~RestApiHierarchy(); - void Register(const RestApiPath& path, + void Register(const std::string& uri, RestApi::GetHandler handler); - void Register(const RestApiPath& path, + void Register(const std::string& uri, RestApi::PutHandler handler); - void Register(const RestApiPath& path, + void Register(const std::string& uri, RestApi::PostHandler handler); - void Register(const RestApiPath& path, + void Register(const std::string& uri, RestApi::DeleteHandler handler); void CreateSiteMap(Json::Value& target) const;
--- a/UnitTestsSources/RestApiTests.cpp Mon Jun 30 13:17:49 2014 +0200 +++ b/UnitTestsSources/RestApiTests.cpp Mon Jun 30 13:23:05 2014 +0200 @@ -224,10 +224,10 @@ TEST(RestApi, RestApiHierarchy) { RestApiHierarchy root; - root.Register(RestApiPath("/hello/world/test"), SetValue<1>); - root.Register(RestApiPath("/hello/world/test2"), SetValue<2>); - root.Register(RestApiPath("/hello/{world}/test3/test4"), SetValue<3>); - root.Register(RestApiPath("/hello2/*"), SetValue<4>); + root.Register("/hello/world/test", SetValue<1>); + root.Register("/hello/world/test2", SetValue<2>); + root.Register("/hello/{world}/test3/test4", SetValue<3>); + root.Register("/hello2/*", SetValue<4>); Json::Value m; root.CreateSiteMap(m);