MCPcopy Create free account
hub / github.com/Icinga/icinga2 / CodeGenValidatorSubrules

Method CodeGenValidatorSubrules

tools/mkclass/classcompiler.cpp:1298–1331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1296}
1297
1298void ClassCompiler::CodeGenValidatorSubrules(const std::string& name, const std::string& klass, const std::vector<Rule>& rules)
1299{
1300 int i = 0;
1301
1302 for (const Rule& rule : rules) {
1303 if (rule.Attributes & RARequired)
1304 continue;
1305
1306 i++;
1307
1308 if (!rule.Rules.empty()) {
1309 ValidatorType subtype;
1310
1311 if (rule.Type == "Array")
1312 subtype = ValidatorArray;
1313 else if (rule.Type == "Dictionary")
1314 subtype = ValidatorDictionary;
1315 else {
1316 std::cerr << "Invalid sub-validator type: " << rule.Type << std::endl;
1317 std::exit(EXIT_FAILURE);
1318 }
1319
1320 std::ostringstream namebuf;
1321 namebuf << name << "_" << i;
1322
1323 CodeGenValidatorSubrules(namebuf.str(), klass, rule.Rules);
1324
1325 FieldType ftype;
1326 ftype.IsName = false;
1327 ftype.TypeName = "Value";
1328 CodeGenValidator(namebuf.str(), klass, rule.Rules, rule.Pattern, ftype, subtype);
1329 }
1330 }
1331}
1332
1333void ClassCompiler::HandleValidator(const Validator& validator, const ClassDebugInfo&)
1334{

Callers

nothing calls this directly

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected