58 lines
1.1 KiB
C++
58 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "Vector.h"
|
|
#include "String.h"
|
|
#include <filesystem>
|
|
|
|
class TemplateNode;
|
|
class TemplateTextBody;
|
|
|
|
using Path = std::filesystem::path;
|
|
|
|
class TemplateFile
|
|
{
|
|
public:
|
|
TemplateFile(const Path& path);
|
|
|
|
~TemplateFile();
|
|
|
|
String dumpContent();
|
|
|
|
String getName() const;
|
|
|
|
TemplateNode* getContent() const;
|
|
|
|
bool hasLoaded() const;
|
|
|
|
void loadContent();
|
|
|
|
private:
|
|
std::size_t checkForStatement(const String& lineSection);
|
|
|
|
std::size_t checkForExpression(const String& lineSection);
|
|
|
|
void onTextSpanFinished();
|
|
|
|
void onFoundStatement(const String& statement_string);
|
|
|
|
void onFoundExpression(const String& expression_string);
|
|
|
|
void onFoundBlock(const Vector<String> args);
|
|
|
|
void onFoundEndBlock(const Vector<String> args);
|
|
|
|
void onFoundExtends(const Vector<String> args);
|
|
|
|
void processLine(const String& line);
|
|
|
|
Path mPath;
|
|
String mParentName;
|
|
Vector<String> mRawContent;
|
|
bool mHasLoaded{false};
|
|
|
|
Ptr<TemplateNode> mRootNode;
|
|
TemplateNode* mWorkingNode{ nullptr };
|
|
|
|
String mWorkingLineContent;
|
|
Ptr<TemplateTextBody> mWorkingTextSpan;
|
|
};
|