diff options
| author | MegaMech <MegaMech@users.noreply.github.com> | 2024-03-24 21:27:07 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-24 21:27:07 -0600 |
| commit | 81f4371c2083c5f31c8abc07592d25c9f69741a6 (patch) | |
| tree | 362abce06cee12f726d175df261c44a12108a279 /src/factories/IncludeFactory.h | |
| parent | cd7dd6f59a9b0ffb867fcd7b80a6c05def701088 (diff) | |
Add Include Factory (#51)
* Add Include Factory
* Fix
* Fixes
* Update
---------
Co-authored-by: = <=>
Diffstat (limited to 'src/factories/IncludeFactory.h')
| -rw-r--r-- | src/factories/IncludeFactory.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/factories/IncludeFactory.h b/src/factories/IncludeFactory.h new file mode 100644 index 0000000..6d39a96 --- /dev/null +++ b/src/factories/IncludeFactory.h @@ -0,0 +1,37 @@ +#pragma once + +#include "BaseFactory.h" + +class IncludeData : public IParsedData { +public: + uint32_t blanks; + + explicit IncludeData(uint32_t blank) : blanks(blank) {} +}; + +class IncludeHeaderExporter : public BaseExporter { + ExportResult Export(std::ostream& write, std::shared_ptr<IParsedData> data, std::string& entryName, YAML::Node& node, std::string* replacement) override; +}; + +class IncludeBinaryExporter : public BaseExporter { + ExportResult Export(std::ostream& write, std::shared_ptr<IParsedData> data, std::string& entryName, YAML::Node& node, std::string* replacement) override; +}; + +class IncludeCodeExporter : public BaseExporter { + ExportResult Export(std::ostream& write, std::shared_ptr<IParsedData> data, std::string& entryName, YAML::Node& node, std::string* replacement) override; +}; + +class IncludeFactory : public BaseFactory { +public: + std::optional<std::shared_ptr<IParsedData>> parse(std::vector<uint8_t>& buffer, YAML::Node& data) override; + inline std::unordered_map<ExportType, std::shared_ptr<BaseExporter>> GetExporters() override { + return { + REGISTER(Code, IncludeCodeExporter) + REGISTER(Header, IncludeHeaderExporter) + REGISTER(Binary, IncludeBinaryExporter) + }; + } + uint32_t GetAlignment() override { + return 8; + }; +};
\ No newline at end of file |
