2018-11-03 17:12:20 +01:00
|
|
|
#ifndef HANDLERFACTORY_H
|
|
|
|
#define HANDLERFACTORY_H
|
|
|
|
#include <memory>
|
|
|
|
#include "handler.h"
|
|
|
|
#include "../template.h"
|
2019-09-29 20:57:46 +02:00
|
|
|
class HandlerFactory
|
|
|
|
{
|
|
|
|
HandlerConfig &handlerConfig;
|
|
|
|
Template &templ;
|
|
|
|
Database &db;
|
|
|
|
UrlProvider &urlProvider;
|
|
|
|
ICache &cache;
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
inline std::unique_ptr<T> produce( Session &userSession)
|
|
|
|
{
|
|
|
|
return std::make_unique<T>(handlerConfig, templ, db, userSession, urlProvider, cache);
|
|
|
|
}
|
|
|
|
public:
|
|
|
|
|
|
|
|
HandlerFactory(HandlerConfig &handlerConfig, Template &templ, Database &db, UrlProvider &urlprovider, ICache &cache) : handlerConfig(handlerConfig), templ(templ) ,db(db), urlProvider(urlprovider), cache(cache) { }
|
|
|
|
std::unique_ptr<Handler> createHandler(const std::string &action, Session &userSession);
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2018-11-03 17:12:20 +01:00
|
|
|
|
|
|
|
#endif // HANDLERFACTORY_H
|