Dawn/archive/dawntools/vnscenetool/events/VNWaitEventParser.cpp
2023-10-31 21:15:03 -05:00

35 lines
804 B
C++

// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "VNWaitEventParser.hpp"
using namespace Dawn;
std::vector<std::string> VNWaitEventParser::getRequiredAttributes() {
return { };
}
std::map<std::string, std::string> VNWaitEventParser::getOptionalAttributes() {
return { { "duration", "" }, { "time", "" } };
}
int32_t VNWaitEventParser::onParse(
Xml *node,
std::map<std::string, std::string> values,
VNWaitEvent *out,
std::string *error
) {
//Get the duration
if(!values["duration"].empty()) {
out->duration = values["duration"];
} else if(!values["time"].empty()) {
out->duration = values["time"];
} else {
*error = "No duration specified.";
return -1;
}
return 0;
}