本文整理汇总了C++中Status::addUniqueMsg方法的典型用法代码示例。如果您正苦于以下问题:C++ Status::addUniqueMsg方法的具体用法?C++ Status::addUniqueMsg怎么用?C++ Status::addUniqueMsg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Status
的用法示例。
在下文中一共展示了Status::addUniqueMsg方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: validate
void EnvironmentNode::validate(Status &status, bool includeChildren, bool includeHiddenNodes) const
{
if (!m_pSchemaItem->isHidden() || includeHiddenNodes)
{
//
// Check node value
if (m_pLocalValue)
{
m_pLocalValue->validate(status, m_id);
}
//
// Check any attributes
for (auto attrIt = m_attributes.begin(); attrIt != m_attributes.end(); ++attrIt)
{
attrIt->second->validate(status, m_id);
//
// If this value must be unique, make sure it is
if (attrIt->second->getSchemaValue()->isUniqueValue())
{
bool found = false;
std::vector<std::string> allValues;
attrIt->second->getAllValuesForSiblings(allValues);
std::set<std::string> unquieValues;
for (auto it = allValues.begin(); it != allValues.end() && !found; ++it)
{
auto ret = unquieValues.insert(*it);
found = !ret.second;
}
if (found)
{
status.addUniqueMsg(statusMsg::error, m_id, attrIt->second->getName(), "Attribute value must be unique");
}
}
//
// Does this value need to be from another set of values?
if (attrIt->second->getSchemaValue()->isFromUniqueValueSet())
{
bool found = false;
std::vector<std::string> allValues;
attrIt->second->getSchemaValue()->getAllKeyRefValues(allValues);
for (auto it = allValues.begin(); it != allValues.end() && !found; ++it)
found = *it == attrIt->second->getValue();
if (!found)
{
status.addMsg(statusMsg::error, m_id, attrIt->second->getName(), "Attribute value must be from a unique set");
}
}
}
//
// Now check all children
if (includeChildren)
{
for (auto childIt = m_children.begin(); childIt != m_children.end(); ++childIt)
{
childIt->second->validate(status, includeChildren, includeHiddenNodes);
}
}
}
}