// Copyright (c) 2023 Dominic Masters // // This software is released under the MIT License. // https://opensource.org/licenses/MIT #pragma once #include "util/DawnTool.hpp" #include "util/Directory.hpp" #include "util/XmlParser.hpp" #include "util/CodeGen.hpp" #include namespace Dawn { enum PrefabcComponentParserRulesetType { STRIN }; struct PrefabComponentParserRuleset { std::string name; std::string include; std::map optional; }; struct PrefabRegistry { std::string sources; struct PrefabComponentParserRuleset getRuleset(std::string type); }; struct PrefabComponent { struct PrefabRegistry *registry; std::string include; std::string type; std::map values; std::string ref; }; struct Prefab { struct PrefabRegistry *registry; std::string name; std::string type; std::vector components; }; class PrefabTool : public DawnTool { protected: std::vector getRequiredFlags() override; std::map getOptionalFlags() override; public: int32_t start(); }; class PrefabParser : public XmlParser { protected: std::vector getRequiredAttributes() override; std::map getOptionalAttributes() override; int32_t onParse( Xml *node, std::map values, struct Prefab *out, std::string *error ) override; }; class PrefabComponentParser : public XmlParser { protected: std::vector getRequiredAttributes() override; std::map getOptionalAttributes() override; int32_t onParse( Xml *node, std::map values, struct PrefabComponent *out, std::string *error ) override; }; class PrefabGen : public CodeGen { public: static void generate( std::vector *out, struct Prefab *prefab, std::string tabs ); }; }