30 lines
708 B
C++
30 lines
708 B
C++
#pragma once
|
|
|
|
#include "File.h"
|
|
#include "TemplateFile.h"
|
|
|
|
#include "Vector.h"
|
|
#include "String.h"
|
|
#include "Pointer.h"
|
|
#include Map.h
|
|
|
|
class TemplateSubstitutionContext;
|
|
|
|
class TemplatingEngine
|
|
{
|
|
public:
|
|
TemplatingEngine(const Path& workingDirectory);
|
|
|
|
String renderTemplate(const String& name, TemplateSubstitutionContext* substitutionContext);
|
|
|
|
private:
|
|
TemplateFile* getTemplateFile(const String& name);
|
|
TemplateFile* getTemplateFile(const Path& path);
|
|
|
|
void loadTemplateFiles();
|
|
void processTemplate(TemplateFile* file, TemplateNode* parent = nullptr);
|
|
|
|
Map<String, Ptr<TemplateFile> > mTemplateFiles;
|
|
Path mWorkingDirectory;
|
|
String mTemplateExtension{ ".html" };
|
|
};
|