Iterating through and removing Frames

Festus Hagen festushagenlists at yahoo.com
Tue Dec 4 06:52:27 UTC 2012


Hi all,

I have been searching for an example or info leading to the correct method to do the following with out success.
(hopefully it's readable)

            for(ID3v2::FrameList::ConstIterator it = id3v2tag->frameList().begin();
                    it != id3v2tag->frameList().end(); it++) {
                if (    (*it)->frameID() != "TIT2"
                     && (*it)->frameID() != "TPE1"
                     && (*it)->frameID() != "TALB"
                     && (*it)->frameID() != "TRCK"
                     ) {
                    id3v2tag->removeFrames((*it)->frameID());
                    bSave = true;
                }
            }
            if (bSave)
            f.save(MPEG::File::ID3v2);

Obviously it doesn't work.
Could someone please give me a kick in the right direction.

I believe I understand whats wrong, I just don't know how to overcome it.
The iterator gets invalidated when a frame(s) is deleted ??

Thanks
fh : )_~


More information about the taglib-devel mailing list