stuff-from-scratch/apps/website-generator/WebsiteGenerator.h

54 lines
960 B
C
Raw Normal View History

2022-10-03 07:46:41 +00:00
#pragma once
#include <string>
#include <iostream>
#include <filesystem>
#include <unordered_map>
2022-10-03 07:46:41 +00:00
#include <vector>
using Path = std::filesystem::path;
2022-10-11 19:20:12 +00:00
class SiteGeneratorConfig;
class ContentPage;
class ContentArticle;
class TemplatingEngine;
2022-10-03 07:46:41 +00:00
class WebsiteGenerator
2022-10-11 19:20:12 +00:00
{
public:
WebsiteGenerator();
2022-10-11 19:20:12 +00:00
~WebsiteGenerator();
void doSubstitutions();
2022-10-03 07:46:41 +00:00
2022-10-09 16:39:46 +00:00
void findProject(const std::string& searchPath);
2022-10-03 07:46:41 +00:00
2022-10-09 16:39:46 +00:00
void parseContentFiles();
2022-10-03 07:46:41 +00:00
2022-10-09 16:39:46 +00:00
void parseTemplateFiles();
2022-10-03 07:46:41 +00:00
void readConfig();
2022-10-03 07:46:41 +00:00
2022-10-09 16:39:46 +00:00
void write();
2022-10-03 07:46:41 +00:00
private:
2022-10-09 16:39:46 +00:00
void findContentFiles();
2022-10-03 07:46:41 +00:00
2022-10-09 16:39:46 +00:00
Path getContentPath() const;
2022-10-03 07:46:41 +00:00
2022-10-09 16:39:46 +00:00
Path getPagesPath() const;
2022-10-03 07:46:41 +00:00
2022-10-09 16:39:46 +00:00
Path getArticlesPath() const;
Path getConfigPath() const;
2022-10-03 07:46:41 +00:00
std::filesystem::path mProjectPath;
std::unique_ptr<SiteGeneratorConfig> mConfig;
std::unique_ptr<TemplatingEngine> mTemplateEngine;
std::vector<std::unique_ptr<ContentPage> > mPages;
std::vector<std::unique_ptr<ContentArticle> > mArticles;
2022-10-03 07:46:41 +00:00
};