diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2021-06-20 11:20:47 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2021-06-20 11:20:47 +0200 |
commit | 1967e3465c7e82d84dc8441ba1993a55050766fb (patch) | |
tree | 1a8703b9dac00f659a774c7892db528df25f7d22 /src/ContentManager.cpp | |
parent | a1dbf3f04bde8f98c11f43722e90b20dc832e78c (diff) |
Basic blog module.
EventManager, ContentManager
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'src/ContentManager.cpp')
-rw-r--r-- | src/ContentManager.cpp | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/src/ContentManager.cpp b/src/ContentManager.cpp index 1ba7654..951c10e 100644 --- a/src/ContentManager.cpp +++ b/src/ContentManager.cpp @@ -1,6 +1,61 @@ #include "ContentManager.hpp" -bool ContentManager::Register(Content const & ctnt) +bool ContentManager::RegisterModule(std::shared_ptr<Content> ctnt) { + std::string const & basePath = ctnt->GetBasePath(); + Redirections const & rs = ctnt->GetRedirections(); + + m_ContentModules[basePath] = ctnt; + for (auto & redirect : rs) + { + m_ContentModules[redirect] = ctnt; + } + + return false; +} + +bool ContentManager::InitAll(void) +{ + bool ret = true; + + for (auto & content : m_ContentModules) + { + if (content.second->Init() == false) + { + ret = false; + } + } + + return ret; +} + +void ContentManager::ShutdownAll(void) +{ + std::unordered_map<std::shared_ptr<Content>, bool> shutdownModules; + + for (auto & content : m_ContentModules) + { + auto const & search = shutdownModules.find(content.second); + if (search != shutdownModules.end()) + { + continue; + } else { + content.second->Shutdown(); + shutdownModules[content.second] = true; + } + } + + m_ContentModules.clear(); +} + +bool ContentManager::Render(std::string & basePath) +{ + (void)basePath; + return false; } + +ContentModules const & ContentManager::GetAllModules() const +{ + return m_ContentModules; +} |