2023-03-14 22:27:46 -07:00

46 lines
993 B
C++

// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "common.hpp"
namespace Dawn {
struct LabelInfo {
std::string text = "";
std::string fontSize = "";
};
class LabelParser : public XmlParser<struct LabelInfo> {
protected:
std::vector<std::string> getRequiredAttributes() {
return std::vector<std::string>();
}
std::map<std::string, std::string> getOptionalAttributes() {
return {
{ "fontSize", "" }
};
}
int32_t onParse(
Xml *node,
std::map<std::string, std::string> values,
struct LabelInfo *out,
std::string *error
) {
int32_t ret = 0;
if(values["fontSize"].size() > 0) {
out->fontSize = values["fontSize"];
}
if(node->value.size() > 0) {
out->text = node->value;
}
return ret;
}
};
}