stuff-from-scratch/apps/website-generator/WebsiteGenerator.h
2022-10-09 17:39:46 +01:00

61 lines
955 B
C++

#pragma once
#include "Directory.h"
#include "ContentFile.h"
#include <string>
#include <iostream>
#include <filesystem>
#include <vector>
class GeneratorConfig
{
void setThemePath(const Path& path)
{
mThemesPath = path;
}
void setActiveTheme(const std::string& theme)
{
mActiveTheme = theme;
}
private:
Path mThemesPath;
std::string mActiveTheme;
};
class WebsiteGenerator
{
public:
void findProject(const std::string& searchPath);
void readConfig();
void parseContentFiles();
void parseTemplateFiles();
void doSubstitutions();
void write();
private:
void findContentFiles();
Path getContentPath() const;
Path getPagesPath() const;
Path getArticlesPath() const;
Path getConfigPath() const;
std::filesystem::path mProjectPath;
GeneratorConfig mConfig;
std::vector<ContentPage> mPages;
std::vector<ContentArticle> mArticles;
};