diff options
author | lns <matzeton@googlemail.com> | 2021-05-06 13:40:23 +0200 |
---|---|---|
committer | lns <matzeton@googlemail.com> | 2021-05-06 13:40:23 +0200 |
commit | a1dbf3f04bde8f98c11f43722e90b20dc832e78c (patch) | |
tree | 82698dc88f2770bf99841ae4db7a14ffb8a42842 | |
parent | c0483779dac4d8fd5fcc736ae5ffa8ddede0e511 (diff) |
Blog, Content, ContentManager skeleton!
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/Content.cpp | 1 | ||||
-rw-r--r-- | src/Content.hpp | 11 | ||||
-rw-r--r-- | src/ContentManager.cpp | 5 | ||||
-rw-r--r-- | src/ContentManager.hpp | 7 | ||||
-rw-r--r-- | src/content/blog/Blog.cpp | 23 | ||||
-rw-r--r-- | src/content/blog/Blog.hpp | 15 | ||||
-rw-r--r-- | src/main.cpp | 7 |
8 files changed, 69 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 376875d..ae0b1c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.9) +cmake_minimum_required(VERSION 3.1.9) project(cpp-web) if(NOT CMAKE_BUILD_TYPE) @@ -16,7 +16,7 @@ if(NOT EXISTS "${INJA_SRCDIR}/single_include/inja/inja.hpp") endif() include_directories(${CPP_HTTPLIB_SRCDIR} ${INJA_SRCDIR}/single_include ${INJA_SRCDIR}/third_party/include) -file(GLOB SOURCES "src/*.cpp") +file(GLOB_RECURSE SOURCES "src/*.cpp") add_executable(cpp-web ${SOURCES}) #target_compile_definitions(cpp-web PUBLIC CPPHTTPLIB_THREAD_POOL_COUNT=4) if(CMAKE_BUILD_TYPE MATCHES Release) diff --git a/src/Content.cpp b/src/Content.cpp new file mode 100644 index 0000000..e302a78 --- /dev/null +++ b/src/Content.cpp @@ -0,0 +1 @@ +#include "Content.hpp" diff --git a/src/Content.hpp b/src/Content.hpp index c630568..e337074 100644 --- a/src/Content.hpp +++ b/src/Content.hpp @@ -1,9 +1,18 @@ #ifndef CONTENT_H #define CONTENT_H 1 +#include <string> +#include <tuple> +#include <vector> + +typedef std::vector<std::tuple<std::string, std::string>> Redirections; + class Content { public: - virtual bool Render(); + virtual bool Init(std::string & basePath) = 0; + virtual void Shutdown() = 0; + virtual bool Render() = 0; + virtual Redirections const GetRedirections() = 0; }; #endif diff --git a/src/ContentManager.cpp b/src/ContentManager.cpp index 94bbb15..1ba7654 100644 --- a/src/ContentManager.cpp +++ b/src/ContentManager.cpp @@ -1 +1,6 @@ #include "ContentManager.hpp" + +bool ContentManager::Register(Content const & ctnt) +{ + return false; +} diff --git a/src/ContentManager.hpp b/src/ContentManager.hpp index 8a7972a..75b9173 100644 --- a/src/ContentManager.hpp +++ b/src/ContentManager.hpp @@ -3,12 +3,17 @@ #include "Content.hpp" +#include <map> + class ContentManager { public: ContentManager() {} ~ContentManager() {} - bool Register(Content ctnt); + bool Register(Content const & ctnt); + +private: + std::map<std::string, Content const &> m_ContentModules; }; #endif diff --git a/src/content/blog/Blog.cpp b/src/content/blog/Blog.cpp new file mode 100644 index 0000000..d79f207 --- /dev/null +++ b/src/content/blog/Blog.cpp @@ -0,0 +1,23 @@ +#include "Blog.hpp" + +bool Blog::Init(std::string & basePath) +{ + (void)basePath; + + return false; +} + +void Blog::Shutdown() +{ +} + +bool Blog::Render() +{ + return false; +} + +Redirections const +Blog::GetRedirections() +{ + return Redirections(); +} diff --git a/src/content/blog/Blog.hpp b/src/content/blog/Blog.hpp new file mode 100644 index 0000000..c903a22 --- /dev/null +++ b/src/content/blog/Blog.hpp @@ -0,0 +1,15 @@ +#ifndef BLOG_H +#define BLOG_H 1 + +#include "../../Content.hpp" + +class Blog : public Content +{ +public: + bool Init(std::string & basePath); + void Shutdown(); + bool Render(); + Redirections const GetRedirections(); +}; + +#endif diff --git a/src/main.cpp b/src/main.cpp index ea0f333..feabb19 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,3 +1,5 @@ +#include "ContentManager.hpp" +#include "content/blog/Blog.hpp" #include "EventManager.hpp" #include "Filesystem.hpp" @@ -84,6 +86,11 @@ int main(int argc, char **argv) { } fs.Scan(); + Blog blog; + + ContentManager ctmgr; + ctmgr.Register(blog); + EventManager evmgr; evmgr.setDefaultCallback(example_inja_render, {}); evmgr.Init(host, port); |