blob: b473bf3d311b06c48c321140b5a8ea2aceab8299 (
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#include "Blog.hpp"
Blog::Blog(std::string uriBasePath, std::string mainTemplatePath, std::string blogPath)
: Content(),
m_UriBasePath(uriBasePath),
m_MainTemplatePath(mainTemplatePath),
m_BlogPath(blogPath),
m_BlogEntries("", blogPath)
{
m_Redirections.push_back(uriBasePath + "/");
m_Redirections.push_back(uriBasePath + "/index.html");
}
bool Blog::Init()
{
std::cout << "Blog entries path: " << m_BlogPath << std::endl;
std::vector<std::string> extensions = {"json"};
if (m_BlogEntriesMetadata.Scan(m_BlogPath, extensions, false) == false)
{
return false;
}
m_BlogEntries.Init();
return true;
}
void Blog::Shutdown()
{
std::cout << "Blog module shutdown" << std::endl;
m_BlogEntries.Shutdown();
}
bool Blog::Render(RequestResponse & rr, RenderData & rd, std::string & out)
{
(void)rr;
(void)rd;
(void)out;
rd["blah"] = "Yooooh!";
return true;
}
std::string const & Blog::GetUriBasePath() const
{
return m_UriBasePath;
}
std::string const & Blog::GetMainTemplate() const
{
return m_MainTemplatePath;
}
Redirections const & Blog::GetRedirections() const
{
return m_Redirections;
}
|