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 39
#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 SetTemplateSystem(std::shared_ptr<TemplateManager> const & 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; ContentModules const & GetAllModulesRoutes() const; static void RemoveGarbageSlashes(std::string & uri_basepath); private: std::shared_ptr<TemplateManager> m_TemplateManager; ContentModules m_ContentModules; ContentModules m_ContentModulesRoutes; }; #endif