aboutsummaryrefslogtreecommitdiff
path: root/src/ContentManager.hpp
blob: 83f4bc9a0cdcd055f5d2dde741aa2f2e34205c4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef CONTENTMANAGER_H
#define CONTENTMANAGER_H 1

#include "Content.hpp"
#include "Filesystem.hpp"
#include "TemplateManager.hpp"

#include <memory>
#include <unordered_map>

using ContentModules = std::unordered_map<std::string, std::shared_ptr<Content> >;

class ContentManager
{
public:
    ContentManager()
    {
    }
    ~ContentManager()
    {
        ShutdownAll();
    }

    void SetStaticFilesystem(std::shared_ptr<Filesystem> & static_fs);
    void SetTemplateSystem(std::shared_ptr<TemplateManager> & tmgr);
    bool RegisterModule(std::shared_ptr<Content> ctnt);
    bool InitAll(void);
    void ShutdownAll(void);
    bool Render(char const * basePath, RequestResponse & rr, std::string & out);
    ContentModules const & GetAllModules() const;

private:
    std::shared_ptr<Filesystem> m_StaticFilesystem;
    std::shared_ptr<TemplateManager> m_TemplateManager;
    ContentModules m_ContentModules;
};

#endif