Add DynamicContentFactory
This commit is contained in:
джерело
51b259f385
коміт
6dbe8d34dc
28
dynamic/dynamiccontentfactory.h
Normal file
28
dynamic/dynamiccontentfactory.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#ifndef DYNAMICCONTENTFACTORY_H
|
||||||
|
#define DYNAMICCONTENTFACTORY_H
|
||||||
|
|
||||||
|
#include "dynamiccontent.h"
|
||||||
|
|
||||||
|
class DynamicContentFactory
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
Template *templ;
|
||||||
|
Database *db;
|
||||||
|
UrlProvider *urlProvider;
|
||||||
|
|
||||||
|
public:
|
||||||
|
DynamicContentFactory(Template &templ, Database &db, UrlProvider &urlProvider)
|
||||||
|
{
|
||||||
|
this->templ = &templ;
|
||||||
|
this->db = &db;
|
||||||
|
this->urlProvider = &urlProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T> inline std::shared_ptr<T> createDynamicContent()
|
||||||
|
{
|
||||||
|
return std::make_shared<T>(*this->templ, *this->db, *this->urlProvider);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif // DYNAMICCONTENTFACTORY_H_INCLUDED
|
Завантаження…
Посилання в новій задачі
Block a user