/** * @brief Construct data of the Entity from an XML object * * <p> Constructs the EntityGroup's own member variables only from the input XML object. </p> * * <p> Do not consider about constructing children Entity objects' data in EntityGroup::construct(). * Those children Entity objects' data will constructed by their own construct() method. Even insertion * of XML objects representing children are done by abstract method of EntityGroup::toXML(). </p> * * <p> Constructs only data of EntityGroup's own. </p> * * \par [Inherited] * @copydoc Entity::construct() */ virtual void construct(std::shared_ptr<library::XML> xml) { clear(); if (xml->has(CHILD_TAG()) == false) return; std::shared_ptr<library::XMLList> &xmlList = xml->get(CHILD_TAG()); if (std::is_same<container_type, std::vector<container_type::value_type, container_type::allocator_type>>::value == true) { //FOR RESERVE assign(xmlList->size(), nullptr); erase(begin(), end()); } for (size_t i = 0; i < xmlList->size(); i++) { std::shared_ptr<library::XML> &xmlElement = xmlList->at(i); entity_type *entity = createChild(xmlElement); if (entity != nullptr) { entity->construct(xmlList->at(i)); emplace_back(entity); } } };
void erase(const typename container_type::value_type::key_type &key) { for (auto it = begin(); it != end(); ) if (it->key() == key) it = erase(it); else it++; };
range_size_type merge_and_replace(container_type& set, iterator_pair sequence, const range_type& new_range) { ASSERT( sequence.first != sequence.second ); if ( sequence.first->begin() <= new_range.begin() && sequence.first->end() >= new_range.end() ) return 0; range_size_type old_sum = m_length_sum; range_size_type low = min( sequence.first->begin(), new_range.begin() ); range_size_type high = max( ( --sequence.second )->end(), new_range.end() ); for ( ++sequence.second; sequence.first != sequence.second; ) { range_size_type length = sequence.first->size(); set.erase( sequence.first++ ); m_length_sum -= length; } set.insert( sequence.second, range_type( low, high ) ); m_length_sum += high - low; return m_length_sum - old_sum; }
iterator erase(iterator it) { return values.erase(it); }