// Copyright (c) 2023 Dominic Masters // // This software is released under the MIT License. // https://opensource.org/licenses/MIT #include "VNTextEventParser.hpp" using namespace Dawn; std::vector VNTextParser::getRequiredAttributes() { return { "lang" }; } std::map VNTextParser::getOptionalAttributes() { return { }; } int32_t VNTextParser::onParse( Xml *node, std::map values, struct VNText *out, std::string *error ) { out->language = values["lang"]; out->text = node->value; return 0; } // // // // // // // // // // // // // // // // // // // // // // // // // // // std::vector VNTextEventParser::getRequiredAttributes() { return { }; } std::map VNTextEventParser::getOptionalAttributes() { return { }; } int32_t VNTextEventParser::onParse( Xml *node, std::map values, struct VNTextEvent *out, std::string *error ) { int32_t ret; auto itChildren = node->children.begin(); while(itChildren != node->children.end()) { Xml *child = *itChildren; // Parse strings if(child->node == "string") { VNText text; ret = (VNTextParser()).parse(child, &text, error); if(ret != 0) return ret; out->texts.push_back(text); } else { *error = "Unknown child node '" + child->node + "'"; return -1; } itChildren++; } return 0; }