MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / validateModelName

Function validateModelName

src/xml_parsing.cpp:111–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111void validateModelName(const std::string& name, int line_number)
112{
113 const auto line_str = std::to_string(line_number);
114 if(name.empty())
115 {
116 throw RuntimeError("Error at line ", line_str,
117 ": Model/Node type name cannot be empty");
118 }
119 if(name == "Root" || name == "root")
120 {
121 throw RuntimeError("Error at line ", line_str,
122 ": 'Root' is a reserved name and cannot be used as a node type");
123 }
124 if(char c = findForbiddenChar(name); c != '\0')
125 {
126 throw RuntimeError("Error at line ", line_str, ": Model name '", name,
127 "' contains forbidden character ", formatForbiddenChar(c));
128 }
129}
130
131void validatePortName(const std::string& name, int line_number)
132{

Callers 1

VerifyXMLFunction · 0.85

Calls 5

RuntimeErrorClass · 0.85
findForbiddenCharFunction · 0.85
formatForbiddenCharFunction · 0.85
to_stringFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected