Let's make (git) history!

此提交包含在:
2018-11-03 17:12:20 +01:00
當前提交 3bfebfe8a8
共有 212 個檔案被更改,包括 11970 行新增0 行删除

40
handlers/handler.h 一般檔案
查看文件

@@ -0,0 +1,40 @@
#ifndef HANDLER_H
#define HANDLER_H
#include "../response.h"
#include "../request.h"
#include "../template.h"
#include "../database/database.h"
#include "../urlprovider.h"
#include "../database/queryoption.h"
#include "../logger.h"
#include "../cache/icache.h"
class Handler
{
protected:
ICache *cache;
Template *templ;
Database *database;
Session *userSession;
UrlProvider *urlProvider;
QueryOption queryOption(const Request &r) const;
public:
Handler(Template &templ, Database &db, Session &userSession, UrlProvider &provider, ICache &cache)
{
this->templ = &templ;
this->database = &db;
this->userSession = &userSession;
this->urlProvider = &provider;
this->cache = &cache;
}
virtual Response handle(const Request &r) = 0;
void setGeneralVars(TemplatePage &page);
virtual ~Handler()
{
}
Response errorResponse(std::string errortitle, std::string errormessage, int status = 200);
};
#endif // HANDLER_H