Moved C++ tools out
This commit is contained in:
39
archive/dawntools/vnscenetool/events/VNSetEventParser.cpp
Normal file
39
archive/dawntools/vnscenetool/events/VNSetEventParser.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "VNSetEventParser.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
std::vector<std::string> VNSetEventParser::getRequiredAttributes() {
|
||||
return { "property", "type" };
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> VNSetEventParser::getOptionalAttributes() {
|
||||
return {
|
||||
{ "to", "" },
|
||||
{ "value", "" }
|
||||
};
|
||||
}
|
||||
|
||||
int32_t VNSetEventParser::onParse(
|
||||
Xml *node,
|
||||
std::map<std::string, std::string> values,
|
||||
struct VNSetEvent *out,
|
||||
std::string *error
|
||||
) {
|
||||
if(values["to"] != "") {
|
||||
out->to = values["to"];
|
||||
} else if(values["value"] != "") {
|
||||
out->to = values["value"];
|
||||
} else {
|
||||
*error = "Either 'to' or 'value' must be specified";
|
||||
return -1;
|
||||
}
|
||||
|
||||
out->type = values["type"];
|
||||
out->property = values["property"];
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user