summaryrefslogtreecommitdiff
path: root/src/factories/IncludeFactory.h
blob: 6d39a96aecb56b85e9b9f40f12b29776216e33d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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;
    };
};