Moved C++ tools out
This commit is contained in:
32
archive/dawntools/vnscenetool/events/VNMarkerParser.cpp
Normal file
32
archive/dawntools/vnscenetool/events/VNMarkerParser.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "VNMarkerParser.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
std::vector<std::string> VNMarkerParser::getRequiredAttributes() {
|
||||
return { "name" };
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> VNMarkerParser::getOptionalAttributes() {
|
||||
return {};
|
||||
}
|
||||
|
||||
int32_t VNMarkerParser::onParse(
|
||||
Xml *node,
|
||||
std::map<std::string, std::string> values,
|
||||
struct VNMarker *out,
|
||||
std::string *error
|
||||
) {
|
||||
// Ensure name only contains letters, and numbers, no spaces or symbols
|
||||
if(!std::regex_match(values["name"], std::regex("^[a-zA-Z0-9]+$"))) {
|
||||
*error = "Marker name " + values["name"] + " must only contain letters and numbers.";
|
||||
return -1;
|
||||
}
|
||||
|
||||
out->name = values["name"];
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user