diff --git a/modules/drogon/drogon/lib/inc/drogon/utils/FunctionTraits.h b/modules/drogon/drogon/lib/inc/drogon/utils/FunctionTraits.h deleted file mode 100644 index fd15524..0000000 --- a/modules/drogon/drogon/lib/inc/drogon/utils/FunctionTraits.h +++ /dev/null @@ -1,142 +0,0 @@ -/** - * - * FunctionTraits.h - * An Tao - * - * Copyright 2018, An Tao. All rights reserved. - * https://github.com/an-tao/drogon - * Use of this source code is governed by a MIT license - * that can be found in the License file. - * - * Drogon - * - */ - -#pragma once - -#include -#include -#include -#include - -namespace drogon { -class HttpRequest; -class HttpResponse; -using HttpRequestPtr = std::shared_ptr; -using HttpResponsePtr = std::shared_ptr; - -namespace internal { - - -template -struct resumable_type : std::false_type { -}; - -template -struct FunctionTraits; - -// functor,lambda,std::function... -template -struct FunctionTraits : public FunctionTraits::type::operator())> { - static const bool isClassFunction = false; - static const bool isDrObjectClass = false; - using class_type = void; - static const std::string name() { - return std::string("Functor"); - } -}; - -// class instance method of const object -template -struct FunctionTraits - : FunctionTraits { - static const bool isClassFunction = true; - static const bool isDrObjectClass = - std::is_base_of, ClassType>::value; - using class_type = ClassType; - static const std::string name() { - return std::string("Class Function"); - } -}; - -// class instance method of non-const object -template -struct FunctionTraits - : FunctionTraits { - static const bool isClassFunction = true; - static const bool isDrObjectClass = - std::is_base_of, ClassType>::value; - using class_type = ClassType; - static const std::string name() { - return std::string("Class Function"); - } -}; - -// normal function for HTTP handling -template -struct FunctionTraits< - ReturnType (*)(const HttpRequestPtr &req, - std::function &&callback, - Arguments...)> : FunctionTraits { - static const bool isHTTPFunction = !resumable_type::value; - static const bool isCoroutine = false; - using class_type = void; - using first_param_type = HttpRequestPtr; - using return_type = ReturnType; -}; - -template -struct FunctionTraits< - ReturnType (*)(HttpRequestPtr &req, - std::function &&callback, - Arguments...)> : FunctionTraits { - static const bool isHTTPFunction = false; - using class_type = void; -}; - -template -struct FunctionTraits< - ReturnType (*)(HttpRequestPtr &&req, - std::function &&callback, - Arguments...)> : FunctionTraits { - static const bool isHTTPFunction = false; - using class_type = void; -}; - -// normal function for HTTP handling -template -struct FunctionTraits< - ReturnType (*)(T &&customReq, - std::function &&callback, - Arguments...)> : FunctionTraits { - static const bool isHTTPFunction = !resumable_type::value; - static const bool isCoroutine = false; - using class_type = void; - using first_param_type = T; - using return_type = ReturnType; -}; - -// normal function -template -struct FunctionTraits { - using result_type = ReturnType; - - template - using argument = - typename std::tuple_element >::type; - - static const std::size_t arity = sizeof...(Arguments); - using class_type = void; - using return_type = ReturnType; - static const bool isHTTPFunction = false; - static const bool isClassFunction = false; - static const bool isDrObjectClass = false; - static const bool isCoroutine = false; - static const std::string name() { - return std::string("Normal or Static Function"); - } -}; - -} // namespace internal -} // namespace drogon