mirror of
https://gitee.com/an-tao/drogon.git
synced 2024-11-30 02:37:57 +08:00
Modify HttpSimpleController.h
This commit is contained in:
parent
acc26c0776
commit
6745d703db
@ -20,16 +20,17 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#define PATH_LIST_BEGIN \
|
||||
static std::vector<std::pair<std::string, std::vector<std::string>>> paths() \
|
||||
{ \
|
||||
std::vector<std::pair<std::string, std::vector<std::string>>> vet;
|
||||
#define PATH_LIST_BEGIN \
|
||||
static void ___paths___() \
|
||||
{
|
||||
|
||||
#define PATH_ADD(path, filters...) \
|
||||
vet.push_back({path, {filters}})
|
||||
#define PATH_ADD(path, filters...) \
|
||||
{ \
|
||||
LOG_TRACE << "register simple controller(" << classTypeName() << ") on path:" << path; \
|
||||
HttpAppFramework::instance().registerHttpSimpleController(path, classTypeName(), {filters}); \
|
||||
}
|
||||
|
||||
#define PATH_LIST_END \
|
||||
return vet; \
|
||||
}
|
||||
namespace drogon
|
||||
{
|
||||
@ -55,13 +56,7 @@ class HttpSimpleController : public DrObject<T>, public HttpSimpleControllerBase
|
||||
public:
|
||||
pathRegister()
|
||||
{
|
||||
auto vPaths = T::paths();
|
||||
|
||||
for (auto path : vPaths)
|
||||
{
|
||||
LOG_TRACE << "register simple controller(" << HttpSimpleController<T>::classTypeName() << ") on path:" << path.first;
|
||||
HttpAppFramework::instance().registerHttpSimpleController(path.first, HttpSimpleController<T>::classTypeName(), path.second);
|
||||
}
|
||||
T::___paths___();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user