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); } } } }