// Copyright (c) 2023 Dominic Masters // // This software is released under the MIT License. // https://opensource.org/licenses/MIT #include "SceneParser.hpp" using namespace Dawn; std::vector SceneParser::getRequiredAttributes() { return { "name" }; } std::map SceneParser::getOptionalAttributes() { return { { "extend", "" } }; } int32_t SceneParser::onParse( Xml *node, std::map values, struct Scene *out, std::string *error ) { int32_t ret; //Create the scene item out->name = values["name"]; out->extend = values["extend"]; //Parse the children auto itChildren = node->children.begin(); while(itChildren != node->children.end()) { Xml *child = *itChildren; if(child->node == "item") { struct SceneItem item; item.registry = out->registry; ret = (SceneItemParser()).parse(child, &item, error); if(ret != 0) return 1; out->items.push_back(item); } else if(child->node == "code") { struct SceneCode code; ret = (SceneCodeParser()).parse(child, &code, error); if(ret != 0) return ret; out->code.push_back(code); } ++itChildren; } return 0; }