本文整理汇总了C++中StringVector::c_array方法的典型用法代码示例。如果您正苦于以下问题:C++ StringVector::c_array方法的具体用法?C++ StringVector::c_array怎么用?C++ StringVector::c_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringVector
的用法示例。
在下文中一共展示了StringVector::c_array方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
int
main(int argc, char ** argv)
{
bool ok;
Configuration * cfg;
Configuration * schemaCfg;
Config2Cpp util("config2cpp");
StringVector namesList;
StringVector recipeUserTypes;
StringVector wildcardedNamesAndTypes;
StringVector recipeIgnoreRules;
StringVector unmatchedPatterns;
StringVector schema;
SchemaValidator sv;
const char * scope;
int i;
int len;
const char * overrideSchema[] = {
"@typedef keyword = enum[\"@optional\", \"@required\"]",
"user_types = list[string]",
"wildcarded_names_and_types = table[keyword,keyword, "
"string,wildcarded-name, string,type]",
"ignore_rules = list[string]",
0 // null-terminated array
};
ok = util.parseCmdLineArgs(argc, argv);
cfg = Configuration::create();
schemaCfg = Configuration::create();
if (ok && util.wantSchema()) {
try {
cfg->parse(util.cfgFileName());
cfg->listFullyScopedNames("", "", Configuration::CFG_SCOPE_AND_VARS,
true, namesList);
if (util.schemaOverrideCfg() != 0) {
schemaCfg->parse(util.schemaOverrideCfg());
scope = util.schemaOverrideScope();
sv.parseSchema(overrideSchema);
sv.validate(schemaCfg, scope, "");
schemaCfg->lookupList(scope, "user_types", recipeUserTypes);
schemaCfg->lookupList(scope, "wildcarded_names_and_types",
wildcardedNamesAndTypes);
schemaCfg->lookupList(scope, "ignore_rules", recipeIgnoreRules);
}
calculateSchema(cfg, namesList, recipeUserTypes,
wildcardedNamesAndTypes, recipeIgnoreRules, schema);
checkForUnmatchedPatterns(cfg, namesList, wildcardedNamesAndTypes,
unmatchedPatterns);
} catch(const ConfigurationException & ex) {
fprintf(stderr, "%s\n", ex.c_str());
ok = false;
}
len = unmatchedPatterns.length();
if (len != 0) {
fprintf(stderr, "%s %s\n",
"Error: the following patterns in the schema",
"recipe did not match anything");
for (i = 0; i < len; i++) {
fprintf(stderr, "\t'%s'\n", unmatchedPatterns[i]);
}
ok = false;
}
}
if (ok) {
ok = util.generateFiles(schema.c_array(), schema.length());
}
cfg->destroy();
if (ok) {
return 0;
} else {
return 1;
}
}