diff options
author | ipknHama <ipknhama@gmail.com> | 2014-09-07 01:24:45 +0900 |
---|---|---|
committer | ipknHama <ipknhama@gmail.com> | 2014-09-07 01:24:45 +0900 |
commit | c89cafa820ec02f041c3b0e52877bc321f6a1ba9 (patch) | |
tree | 8b74deacdefd07048c230cb553efe6bb4e7352e1 /include/middleware.h | |
parent | daa3c820878f8e189120cf9359caf8b2359d61ca (diff) | |
download | crow-c89cafa820ec02f041c3b0e52877bc321f6a1ba9.tar.gz crow-c89cafa820ec02f041c3b0e52877bc321f6a1ba9.zip |
add Middlewares template to Crow main class, context implementation
Diffstat (limited to 'include/middleware.h')
-rw-r--r-- | include/middleware.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/include/middleware.h b/include/middleware.h new file mode 100644 index 0000000..270e026 --- /dev/null +++ b/include/middleware.h @@ -0,0 +1,50 @@ +#pragma once +#include "http_request.h" +#include "http_response.h" + +namespace crow +{ + class CookieParser + { + struct context + { + std::unordered_map<std::string, std::string> jar; + }; + + template <typename AllContext> + void before_handle(request& req, response& res, context& ctx, AllContext& all_ctx) + { + // ctx == all_ctx.bind<CookieParser>() + // ctx.jar[] = ; + } + + template <typename AllContext> + void after_handle(request& req, response& res, context& ctx, AllContext& all_ctx) + { + } + } + + /* + App<CookieParser, AnotherJarMW> app; + A B C + A::context + int aa; + + ctx1 : public A::context + ctx2 : public ctx1, public B::context + ctx3 : public ctx2, public C::context + + C depends on A + + C::handle + context.aaa + + App::context : private CookieParser::contetx, ... + { + jar + + } + + SimpleApp + */ +} |