From f35ff6347ae5f931ef1688ee62adb4e0ffded8c3 Mon Sep 17 00:00:00 2001 From: antao Date: Wed, 2 Jan 2019 18:49:37 +0800 Subject: [PATCH] Format some files --- examples/simple_example/TestController.h | 20 +++++------ examples/simple_example/api_Attachment.h | 22 ++++++------- examples/simple_example/api_v1_ApiTest.h | 26 +++++++-------- lib/inc/drogon/utils/FunctionTraits.h | 42 ++++++++++++------------ 4 files changed, 55 insertions(+), 55 deletions(-) diff --git a/examples/simple_example/TestController.h b/examples/simple_example/TestController.h index 4bae623a..fa97ab82 100755 --- a/examples/simple_example/TestController.h +++ b/examples/simple_example/TestController.h @@ -5,15 +5,15 @@ namespace example { class TestController : public drogon::HttpSimpleController { -public: - virtual void asyncHandleHttpRequest(const HttpRequestPtr &req, const std::function &callback) override; - PATH_LIST_BEGIN - //list path definations here; - //PATH_ADD("/path","filter1","filter2",...); - PATH_ADD("/"); - PATH_ADD("/Test", "nonFilter"); - PATH_ADD("/tpost", "drogon::PostFilter"); - PATH_ADD("/slow", "TimeFilter", Get); - PATH_LIST_END + public: + virtual void asyncHandleHttpRequest(const HttpRequestPtr &req, const std::function &callback) override; + PATH_LIST_BEGIN + //list path definations here; + //PATH_ADD("/path","filter1","filter2",...); + PATH_ADD("/"); + PATH_ADD("/Test", "nonFilter"); + PATH_ADD("/tpost", "drogon::PostFilter"); + PATH_ADD("/slow", "TimeFilter", Get); + PATH_LIST_END }; } // namespace example diff --git a/examples/simple_example/api_Attachment.h b/examples/simple_example/api_Attachment.h index 807e2504..322b73ce 100644 --- a/examples/simple_example/api_Attachment.h +++ b/examples/simple_example/api_Attachment.h @@ -5,16 +5,16 @@ namespace api { class Attachment : public drogon::HttpController { -public: - METHOD_LIST_BEGIN - //use METHOD_ADD to add your custom processing function here; - METHOD_ADD(Attachment::get, "", Get); //Path will be '/api/attachment' - METHOD_ADD(Attachment::upload,"/upload",Post); - METHOD_LIST_END - //your declaration of processing function maybe like this: - void get(const HttpRequestPtr &req, - const std::function &callback); - void upload(const HttpRequestPtr &req, - const std::function &callback); + public: + METHOD_LIST_BEGIN + //use METHOD_ADD to add your custom processing function here; + METHOD_ADD(Attachment::get, "", Get); //Path will be '/api/attachment' + METHOD_ADD(Attachment::upload, "/upload", Post); + METHOD_LIST_END + //your declaration of processing function maybe like this: + void get(const HttpRequestPtr &req, + const std::function &callback); + void upload(const HttpRequestPtr &req, + const std::function &callback); }; } // namespace api diff --git a/examples/simple_example/api_v1_ApiTest.h b/examples/simple_example/api_v1_ApiTest.h index 63d7f2bf..6a3b2f6c 100755 --- a/examples/simple_example/api_v1_ApiTest.h +++ b/examples/simple_example/api_v1_ApiTest.h @@ -7,19 +7,19 @@ namespace v1 { class ApiTest : public drogon::HttpController { -public: - METHOD_LIST_BEGIN - //use METHOD_ADD to add your custom processing function here; - METHOD_ADD(ApiTest::get, "/get/{2}/{1}", "drogon::GetFilter"); //path will be /api/v1/apitest/get/{arg2}/{arg1} - METHOD_ADD(ApiTest::your_method_name, "/{1}/List?P2={2}", Get); //path will be /api/v1/apitest/{arg1}/list - METHOD_ADD(ApiTest::staticApi, "/static", Get, Post); - METHOD_ADD(ApiTest::get2, "/get/{1}", "drogon::GetFilter"); - METHOD_LIST_END - //your declaration of processing function maybe like this: - void get(const HttpRequestPtr &req, const std::function &callback, int p1, std::string &&p2); - void your_method_name(const HttpRequestPtr &req, const std::function &callback, double p1, int p2) const; - void staticApi(const HttpRequestPtr &req, const std::function &callback); - void get2(const HttpRequestPtr &req, const std::function &callback, std::string &&p1); + public: + METHOD_LIST_BEGIN + //use METHOD_ADD to add your custom processing function here; + METHOD_ADD(ApiTest::get, "/get/{2}/{1}", "drogon::GetFilter"); //path will be /api/v1/apitest/get/{arg2}/{arg1} + METHOD_ADD(ApiTest::your_method_name, "/{1}/List?P2={2}", Get); //path will be /api/v1/apitest/{arg1}/list + METHOD_ADD(ApiTest::staticApi, "/static", Get, Post); + METHOD_ADD(ApiTest::get2, "/get/{1}", "drogon::GetFilter"); + METHOD_LIST_END + //your declaration of processing function maybe like this: + void get(const HttpRequestPtr &req, const std::function &callback, int p1, std::string &&p2); + void your_method_name(const HttpRequestPtr &req, const std::function &callback, double p1, int p2) const; + void staticApi(const HttpRequestPtr &req, const std::function &callback); + void get2(const HttpRequestPtr &req, const std::function &callback, std::string &&p1); }; } // namespace v1 } // namespace api diff --git a/lib/inc/drogon/utils/FunctionTraits.h b/lib/inc/drogon/utils/FunctionTraits.h index 9a1ca2af..b8638ae0 100755 --- a/lib/inc/drogon/utils/FunctionTraits.h +++ b/lib/inc/drogon/utils/FunctionTraits.h @@ -37,11 +37,11 @@ template struct FunctionTraits : public FunctionTraits< decltype(&std::remove_reference::type::operator())> { - static const bool isClassFunction = false; - static const std::string name() - { - return std::string("Functor"); - } + static const bool isClassFunction = false; + static const std::string name() + { + return std::string("Functor"); + } }; //class instance method of const object @@ -52,9 +52,9 @@ template < struct FunctionTraits< ReturnType (ClassType::*)(Arguments...) const> : FunctionTraits { - static const bool isClassFunction = true; - typedef ClassType class_type; - static const std::string name() { return std::string("Class Function"); } + static const bool isClassFunction = true; + typedef ClassType class_type; + static const std::string name() { return std::string("Class Function"); } }; //class instance method of non-const object @@ -65,9 +65,9 @@ template < struct FunctionTraits< ReturnType (ClassType::*)(Arguments...)> : FunctionTraits { - static const bool isClassFunction = true; - typedef ClassType class_type; - static const std::string name() { return std::string("Class Function"); } + static const bool isClassFunction = true; + typedef ClassType class_type; + static const std::string name() { return std::string("Class Function"); } }; //normal function for HTTP handling @@ -77,7 +77,7 @@ template < struct FunctionTraits< ReturnType (*)(const HttpRequestPtr &req, const std::function &callback, Arguments...)> : FunctionTraits { - static const bool isHTTPFunction = true; + static const bool isHTTPFunction = true; }; //normal function @@ -87,18 +87,18 @@ template < struct FunctionTraits< ReturnType (*)(Arguments...)> { - typedef ReturnType result_type; + typedef ReturnType result_type; - template - using argument = typename std::tuple_element< - Index, - std::tuple>::type; + template + using argument = typename std::tuple_element< + Index, + std::tuple>::type; - static const std::size_t arity = sizeof...(Arguments); + static const std::size_t arity = sizeof...(Arguments); - static const bool isHTTPFunction = false; - static const bool isClassFunction = false; - static const std::string name() { return std::string("Normal or Static Function"); } + static const bool isHTTPFunction = false; + static const bool isClassFunction = false; + static const std::string name() { return std::string("Normal or Static Function"); } }; } // namespace utility