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

Function validatePortName

src/xml_parsing.cpp:131–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131void validatePortName(const std::string& name, int line_number)
132{
133 const auto line_str = std::to_string(line_number);
134 if(name.empty())
135 {
136 throw RuntimeError("Error at line ", line_str, ": Port name cannot be empty");
137 }
138 if(std::isdigit(static_cast<unsigned char>(name[0])) != 0)
139 {
140 throw RuntimeError("Error at line ", line_str, ": Port name '", name,
141 "' cannot start with a digit");
142 }
143 if(char c = findForbiddenChar(name); c != '\0')
144 {
145 throw RuntimeError("Error at line ", line_str, ": Port name '", name,
146 "' contains forbidden character ", formatForbiddenChar(c));
147 }
148 if(IsReservedAttribute(name))
149 {
150 throw RuntimeError("Error at line ", line_str, ": Port name '", name,
151 "' is a reserved attribute name");
152 }
153}
154
155void validateInstanceName(const std::string& name, int line_number)
156{

Callers 1

parseSubtreeModelPortsFunction · 0.85

Calls 6

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

Tested by

no test coverage detected