v1: add the possibility to remove an element using its iterator

only the const iterators are necessary

git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/libebml@132 a6f86f6d-0131-4f8e-9e7b-e335508773d5
This commit is contained in:
Steve Lhomme 2010-04-19 08:33:43 +00:00
parent 6f87f71cae
commit ab093ddf20
2 changed files with 8 additions and 4 deletions

View File

@ -119,10 +119,8 @@ class EBML_DLL_API EbmlMaster : public EbmlElement {
size_t ListSize() const {return ElementList.size();}
inline std::vector<EbmlElement *>::const_iterator begin() {return ElementList.begin();}
inline std::vector<EbmlElement *>::const_iterator end() {return ElementList.end();}
inline std::vector<EbmlElement *>::const_iterator begin() const {return ElementList.begin();}
inline std::vector<EbmlElement *>::const_iterator end() const {return ElementList.end();}
inline EBML_MASTER_ITERATOR begin() const {return ElementList.begin();}
inline EBML_MASTER_ITERATOR end() const {return ElementList.end();}
EbmlElement * operator[](unsigned int position) {return ElementList[position];}
const EbmlElement * operator[](unsigned int position) const {return ElementList[position];}
@ -142,6 +140,7 @@ class EBML_DLL_API EbmlMaster : public EbmlElement {
\brief Remove an element from the list of the master
*/
void Remove(size_t Index);
void Remove(const EBML_MASTER_ITERATOR & Itr);
/*!
\brief remove all elements, even the mandatory ones

View File

@ -480,6 +480,11 @@ void EbmlMaster::Remove(size_t Index)
}
}
void EbmlMaster::Remove(const std::vector<EbmlElement *>::const_iterator & Itr)
{
ElementList.erase(Itr);
}
bool EbmlMaster::VerifyChecksum() const
{
if (!bChecksumUsed)