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

56 lines
924 B
C
Raw Normal View History

2022-10-03 07:46:41 +00:00
#pragma once
2023-12-21 09:18:44 +00:00
#include "String.h"
2022-10-03 07:46:41 +00:00
#include <iostream>
#include <filesystem>
2023-12-27 12:20:02 +00:00
#include Map.h
2023-12-21 09:18:44 +00:00
#include "Vector.h"
2022-10-03 07:46:41 +00:00
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
2023-12-21 09:18:44 +00:00
void findProject(const 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
2022-12-05 17:50:49 +00:00
Path getOutputPath() const;
2022-10-03 07:46:41 +00:00
std::filesystem::path mProjectPath;
2023-12-21 09:18:44 +00:00
Ptr<SiteGeneratorConfig> mConfig;
Ptr<TemplatingEngine> mTemplateEngine;
2023-12-21 09:18:44 +00:00
Vector<Ptr<ContentPage> > mPages;
Vector<Ptr<ContentArticle> > mArticles;
2022-10-03 07:46:41 +00:00
};