本文整理汇总了C++中NamedList::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ NamedList::empty方法的具体用法?C++ NamedList::empty怎么用?C++ NamedList::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NamedList
的用法示例。
在下文中一共展示了NamedList::empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generateActionPointMapping
ActionPointMapping MetaSprite::generateActionPointMapping(const NamedList<ActionPointFunction>& apFunctions, ErrorList& err)
{
bool valid = true;
auto addError = [&](const std::string msg) {
err.addError(std::move(msg));
valid = false;
};
auto addApfError = [&](const ActionPointFunction& apf, const std::string msg) {
err.addError(std::make_unique<ListItemError>(&apf, std::move(msg)));
valid = false;
};
ActionPointMapping ret;
if (apFunctions.empty()) {
addError("Expected at least one action point function");
return ret;
}
if (apFunctions.size() > MAX_ACTION_POINT_FUNCTIONS) {
addError("Too many action point functions (max " + std::to_string(MAX_ACTION_POINT_FUNCTIONS) + ")");
return ret;
}
ret.reserve(apFunctions.size());
for (unsigned i = 0; i < apFunctions.size(); i++) {
const unsigned romValue = (i + 1) * 2;
assert(romValue <= 255 - 2);
const ActionPointFunction& apf = apFunctions.at(i);
if (not apf.name.isValid()) {
addApfError(apf, "Missing action point function name");
}
auto success = ret.emplace(apf.name, romValue);
if (success.second == false) {
addApfError(apf, "Action point function name already exists: " + apf.name);
}
}
if (not valid) {
ret.clear();
}
return ret;
}