// // This method is used to insert a named type into the current schema item. This is done by making copies // of the relevant members and inserting them into this instance void SchemaItem::insertSchemaType(const std::shared_ptr<SchemaItem> pTypeItem) { // // To insert a schema type (for example a previously defined complexType name="" XSD definition) // loop through each set of configurable pieces of the input type, make a copy of each, and add it to // this element. // // Children std::vector<std::shared_ptr<SchemaItem>> typeChildren; pTypeItem->getChildren(typeChildren); for (auto childIt = typeChildren.begin(); childIt != typeChildren.end(); ++childIt) { std::shared_ptr<SchemaItem> pNewItem = std::make_shared<SchemaItem>(*(*childIt)); addChild(pNewItem); } // // Attributes std::vector< std::shared_ptr<SchemaValue>> typeAttributes; pTypeItem->getAttributes(typeAttributes); for (auto attrIt = typeAttributes.begin(); attrIt != typeAttributes.end(); ++attrIt) { std::shared_ptr<SchemaValue> pNewAttr = std::make_shared<SchemaValue>(*(*attrIt)); addAttribute(pNewAttr); } // // Type main value if (pTypeItem->getItemSchemaValue() != nullptr) { std::shared_ptr<SchemaValue> pNewItemCfgValue = std::make_shared<SchemaValue>(*(pTypeItem->getItemSchemaValue())); setItemSchemaValue(pNewItemCfgValue); } // // Unique attribute sets for (auto setIt = pTypeItem->m_uniqueAttributeValueSetDefs.begin(); setIt != pTypeItem->m_uniqueAttributeValueSetDefs.end(); ++setIt) { m_uniqueAttributeValueSetDefs.insert({ setIt->first, setIt->second }); } // // Unique attribute reference sets for (auto it = pTypeItem->m_uniqueAttributeValueSetReferences.begin(); it != pTypeItem->m_uniqueAttributeValueSetReferences.end(); ++it) { m_uniqueAttributeValueSetReferences.insert({ it->first, it->second }); } }
// // This method is used to insert a named type into the current schema item. This is done by making copies // of the relevant members and inserting them into this instance void SchemaItem::insertSchemaType(const std::shared_ptr<SchemaItem> pTypeItem) { // // Attributes std::vector< std::shared_ptr<SchemaValue>> typeAttributes; pTypeItem->getAttributes(typeAttributes); for (auto attrIt = typeAttributes.begin(); attrIt != typeAttributes.end(); ++attrIt) { std::shared_ptr<SchemaValue> pNewAttr = std::make_shared<SchemaValue>(*(*attrIt)); addAttribute(pNewAttr); } // // Type main value if (pTypeItem->getItemSchemaValue() != nullptr) { std::shared_ptr<SchemaValue> pNewItemCfgValue = std::make_shared<SchemaValue>(*(pTypeItem->getItemSchemaValue())); setItemSchemaValue(pNewItemCfgValue); } // // Unique attribute sets for (auto setIt = pTypeItem->m_uniqueAttributeValueSetDefs.begin(); setIt != pTypeItem->m_uniqueAttributeValueSetDefs.end(); ++setIt) { m_uniqueAttributeValueSetDefs.insert({ setIt->first, setIt->second }); } // // Unique attribute reference sets for (auto it = pTypeItem->m_uniqueAttributeValueSetReferences.begin(); it != pTypeItem->m_uniqueAttributeValueSetReferences.end(); ++it) { m_uniqueAttributeValueSetReferences.insert({ it->first, it->second }); } // // Children std::vector<std::shared_ptr<SchemaItem>> typeChildren; pTypeItem->getChildren(typeChildren); for (auto childIt = typeChildren.begin(); childIt != typeChildren.end(); ++childIt) { std::shared_ptr<SchemaItem> pNewItem = std::make_shared<SchemaItem>(*(*childIt)); addChild(pNewItem); } }