qswiki/requestworker.h

37 sor
772 B
C

2018-11-03 17:12:20 +01:00
#ifndef REQUESTWORKER_H
#define REQUESTWORKER_H
#include "request.h"
#include "response.h"
#include "session.h"
#include "template.h"
#include "database/database.h"
#include "urlprovider.h"
#include "database/sessiondao.h"
#include "cache/fscache.h"
class RequestWorker
{
Database *db;
Template *templ;
UrlProvider *urlProvider;
ICache *cache;
std::unique_ptr<SessionDao> sessionDao;
private:
Session retrieveSession(std::string token) const;
public:
RequestWorker(Database &db, Template &templ, UrlProvider &provider, ICache &cache)
{
this->db = &db;
this->templ = &templ;
this->urlProvider = &provider;
this->sessionDao = db.createSessionDao();
this->cache = &cache;
}
Response processRequest(const Request &r);
};
#endif // REQUESTWORKER_H