mirror of
https://github.com/taglib/taglib.git
synced 2025-05-25 20:20:25 -04:00
Avoid unnecessary detaching of containers
If only a constant iterator is needed, make the container const if possible, otherwise use cbegin() and cend() to get a constant iterator without detaching the container. These fixes are needed so that `auto` can deduce the correct iterator type.
This commit is contained in:
parent
b273505c28
commit
63922f2676
@ -259,7 +259,7 @@ void taglib_tag_free_strings()
|
||||
if(!stringManagementEnabled)
|
||||
return;
|
||||
|
||||
for(List<char *>::ConstIterator it = strings.begin(); it != strings.end(); ++it)
|
||||
for(List<char *>::ConstIterator it = strings.cbegin(); it != strings.cend(); ++it)
|
||||
free(*it);
|
||||
strings.clear();
|
||||
}
|
||||
|
@ -56,14 +56,14 @@ int main(int argc, char *argv[])
|
||||
TagLib::PropertyMap tags = f.file()->properties();
|
||||
|
||||
unsigned int longest = 0;
|
||||
for(TagLib::PropertyMap::ConstIterator i = tags.begin(); i != tags.end(); ++i) {
|
||||
for(TagLib::PropertyMap::ConstIterator i = tags.cbegin(); i != tags.cend(); ++i) {
|
||||
if (i->first.size() > longest) {
|
||||
longest = i->first.size();
|
||||
}
|
||||
}
|
||||
|
||||
cout << "-- TAG (properties) --" << endl;
|
||||
for(TagLib::PropertyMap::ConstIterator i = tags.begin(); i != tags.end(); ++i) {
|
||||
for(TagLib::PropertyMap::ConstIterator i = tags.cbegin(); i != tags.cend(); ++i) {
|
||||
for(TagLib::StringList::ConstIterator j = i->second.begin(); j != i->second.end(); ++j) {
|
||||
cout << left << std::setw(longest) << i->first << " - " << '"' << *j << '"' << endl;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ int main(int argc, char *argv[])
|
||||
TagLib::String value = argv[i + 1];
|
||||
|
||||
TagLib::List<TagLib::FileRef>::ConstIterator it;
|
||||
for(it = fileList.begin(); it != fileList.end(); ++it) {
|
||||
for(it = fileList.cbegin(); it != fileList.cend(); ++it) {
|
||||
|
||||
TagLib::Tag *t = (*it).tag();
|
||||
|
||||
@ -178,7 +178,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
TagLib::List<TagLib::FileRef>::ConstIterator it;
|
||||
for(it = fileList.begin(); it != fileList.end(); ++it)
|
||||
for(it = fileList.cbegin(); it != fileList.cend(); ++it)
|
||||
(*it).file()->save();
|
||||
|
||||
return 0;
|
||||
|
@ -181,11 +181,11 @@ int APE::Item::size() const
|
||||
switch(d->type) {
|
||||
case Text:
|
||||
if(!d->text.isEmpty()) {
|
||||
StringList::ConstIterator it = d->text.begin();
|
||||
StringList::ConstIterator it = d->text.cbegin();
|
||||
|
||||
result += it->data(String::UTF8).size();
|
||||
it++;
|
||||
for(; it != d->text.end(); ++it)
|
||||
for(; it != d->text.cend(); ++it)
|
||||
result += 1 + it->data(String::UTF8).size();
|
||||
}
|
||||
break;
|
||||
@ -268,11 +268,11 @@ ByteVector APE::Item::render() const
|
||||
return data;
|
||||
|
||||
if(d->type == Text) {
|
||||
StringList::ConstIterator it = d->text.begin();
|
||||
StringList::ConstIterator it = d->text.cbegin();
|
||||
|
||||
value.append(it->data(String::UTF8));
|
||||
it++;
|
||||
for(; it != d->text.end(); ++it) {
|
||||
for(; it != d->text.cend(); ++it) {
|
||||
value.append('\0');
|
||||
value.append(it->data(String::UTF8));
|
||||
}
|
||||
|
@ -265,13 +265,13 @@ PropertyMap APE::Tag::setProperties(const PropertyMap &origProps)
|
||||
toRemove.append(remIt->first);
|
||||
}
|
||||
|
||||
for(StringList::ConstIterator removeIt = toRemove.begin(); removeIt != toRemove.end(); removeIt++)
|
||||
for(StringList::ConstIterator removeIt = toRemove.cbegin(); removeIt != toRemove.cend(); removeIt++)
|
||||
removeItem(*removeIt);
|
||||
|
||||
// now sync in the "forward direction"
|
||||
PropertyMap::ConstIterator it = properties.begin();
|
||||
PropertyMap::ConstIterator it = properties.cbegin();
|
||||
PropertyMap invalid;
|
||||
for(; it != properties.end(); ++it) {
|
||||
for(; it != properties.cend(); ++it) {
|
||||
const String &tagName = it->first;
|
||||
if(!checkKey(tagName))
|
||||
invalid.insert(it->first, it->second);
|
||||
@ -382,7 +382,7 @@ ByteVector APE::Tag::render() const
|
||||
ByteVector data;
|
||||
unsigned int itemCount = 0;
|
||||
|
||||
for(ItemListMap::ConstIterator it = d->itemListMap.begin(); it != d->itemListMap.end(); ++it) {
|
||||
for(ItemListMap::ConstIterator it = d->itemListMap.cbegin(); it != d->itemListMap.cend(); ++it) {
|
||||
data.append(it->second.render());
|
||||
itemCount++;
|
||||
}
|
||||
|
@ -409,7 +409,7 @@ void ASF::File::FilePrivate::HeaderExtensionObject::parse(ASF::File *file, unsig
|
||||
ByteVector ASF::File::FilePrivate::HeaderExtensionObject::render(ASF::File *file)
|
||||
{
|
||||
data.clear();
|
||||
for(List<BaseObject *>::ConstIterator it = objects.begin(); it != objects.end(); ++it) {
|
||||
for(List<BaseObject *>::ConstIterator it = objects.cbegin(); it != objects.cend(); ++it) {
|
||||
data.append((*it)->render(file));
|
||||
}
|
||||
data = ByteVector("\x11\xD2\xD3\xAB\xBA\xA9\xcf\x11\x8E\xE6\x00\xC0\x0C\x20\x53\x65\x06\x00", 18) + ByteVector::fromUInt(data.size(), false) + data;
|
||||
@ -601,7 +601,7 @@ bool ASF::File::save()
|
||||
}
|
||||
|
||||
ByteVector data;
|
||||
for(List<FilePrivate::BaseObject *>::ConstIterator it = d->objects.begin(); it != d->objects.end(); ++it) {
|
||||
for(List<FilePrivate::BaseObject *>::ConstIterator it = d->objects.cbegin(); it != d->objects.cend(); ++it) {
|
||||
data.append((*it)->render(this));
|
||||
}
|
||||
|
||||
|
@ -287,8 +287,8 @@ PropertyMap ASF::Tag::properties() const
|
||||
props["COMMENT"] = d->comment;
|
||||
}
|
||||
|
||||
ASF::AttributeListMap::ConstIterator it = d->attributeListMap.begin();
|
||||
for(; it != d->attributeListMap.end(); ++it) {
|
||||
ASF::AttributeListMap::ConstIterator it = d->attributeListMap.cbegin();
|
||||
for(; it != d->attributeListMap.cend(); ++it) {
|
||||
const String key = translateKey(it->first);
|
||||
if(!key.isEmpty()) {
|
||||
AttributeList::ConstIterator it2 = it->second.begin();
|
||||
@ -327,7 +327,7 @@ PropertyMap ASF::Tag::setProperties(const PropertyMap &props)
|
||||
}
|
||||
}
|
||||
|
||||
PropertyMap origProps = properties();
|
||||
const PropertyMap origProps = properties();
|
||||
PropertyMap::ConstIterator it = origProps.begin();
|
||||
for(; it != origProps.end(); ++it) {
|
||||
if(!props.contains(it->first) || props[it->first].isEmpty()) {
|
||||
|
@ -74,8 +74,8 @@ namespace
|
||||
if(::strlen(fileName) == 0)
|
||||
return nullptr;
|
||||
#endif
|
||||
ResolverList::ConstIterator it = fileTypeResolvers.begin();
|
||||
for(; it != fileTypeResolvers.end(); ++it) {
|
||||
ResolverList::ConstIterator it = fileTypeResolvers.cbegin();
|
||||
for(; it != fileTypeResolvers.cend(); ++it) {
|
||||
File *file = (*it)->createFile(fileName, readAudioProperties, audioPropertiesStyle);
|
||||
if(file)
|
||||
return file;
|
||||
@ -87,8 +87,8 @@ namespace
|
||||
File *detectByResolvers(IOStream* stream, bool readAudioProperties,
|
||||
AudioProperties::ReadStyle audioPropertiesStyle)
|
||||
{
|
||||
for(ResolverList::ConstIterator it = fileTypeResolvers.begin();
|
||||
it != fileTypeResolvers.end(); ++it) {
|
||||
for(ResolverList::ConstIterator it = fileTypeResolvers.cbegin();
|
||||
it != fileTypeResolvers.cend(); ++it) {
|
||||
if(const FileRef::StreamTypeResolver *streamResolver =
|
||||
dynamic_cast<const FileRef::StreamTypeResolver*>(*it)) {
|
||||
if(File *file = streamResolver->createFileFromStream(
|
||||
|
@ -47,7 +47,7 @@ namespace
|
||||
{
|
||||
typedef List<FLAC::MetadataBlock *> BlockList;
|
||||
typedef BlockList::Iterator BlockIterator;
|
||||
typedef BlockList::Iterator BlockConstIterator;
|
||||
typedef BlockList::ConstIterator BlockConstIterator;
|
||||
|
||||
enum { FlacXiphIndex = 0, FlacID3v2Index = 1, FlacID3v1Index = 2 };
|
||||
|
||||
@ -209,7 +209,7 @@ bool FLAC::File::save()
|
||||
// Render data for the metadata blocks
|
||||
|
||||
ByteVector data;
|
||||
for(BlockConstIterator it = d->blocks.begin(); it != d->blocks.end(); ++it) {
|
||||
for(BlockConstIterator it = d->blocks.cbegin(); it != d->blocks.cend(); ++it) {
|
||||
ByteVector blockData = (*it)->render();
|
||||
ByteVector blockHeader = ByteVector::fromUInt(blockData.size());
|
||||
blockHeader[0] = (*it)->code();
|
||||
@ -333,7 +333,7 @@ Ogg::XiphComment *FLAC::File::xiphComment(bool create)
|
||||
List<FLAC::Picture *> FLAC::File::pictureList()
|
||||
{
|
||||
List<Picture *> pictures;
|
||||
for(BlockConstIterator it = d->blocks.begin(); it != d->blocks.end(); ++it) {
|
||||
for(BlockConstIterator it = d->blocks.cbegin(); it != d->blocks.cend(); ++it) {
|
||||
Picture *picture = dynamic_cast<Picture *>(*it);
|
||||
if(picture) {
|
||||
pictures.append(picture);
|
||||
|
@ -163,7 +163,7 @@ PropertyMap Mod::Tag::setProperties(const PropertyMap &origProps)
|
||||
|
||||
// for each tag that has been set above, remove the first entry in the corresponding
|
||||
// value list. The others will be returned as unsupported by this format.
|
||||
for(StringList::ConstIterator it = oneValueSet.begin(); it != oneValueSet.end(); ++it) {
|
||||
for(StringList::ConstIterator it = oneValueSet.cbegin(); it != oneValueSet.cend(); ++it) {
|
||||
if(properties[*it].size() == 1)
|
||||
properties.erase(*it);
|
||||
else
|
||||
|
@ -139,7 +139,7 @@ MP4::Atom::find(const char *name1, const char *name2, const char *name3, const c
|
||||
if(name1 == nullptr) {
|
||||
return this;
|
||||
}
|
||||
for(AtomList::ConstIterator it = children.begin(); it != children.end(); ++it) {
|
||||
for(AtomList::ConstIterator it = children.cbegin(); it != children.cend(); ++it) {
|
||||
if((*it)->name == name1) {
|
||||
return (*it)->find(name2, name3, name4);
|
||||
}
|
||||
@ -151,7 +151,7 @@ MP4::AtomList
|
||||
MP4::Atom::findall(const char *name, bool recursive)
|
||||
{
|
||||
MP4::AtomList result;
|
||||
for(AtomList::ConstIterator it = children.begin(); it != children.end(); ++it) {
|
||||
for(AtomList::ConstIterator it = children.cbegin(); it != children.cend(); ++it) {
|
||||
if((*it)->name == name) {
|
||||
result.append(*it);
|
||||
}
|
||||
@ -169,7 +169,7 @@ MP4::Atom::path(MP4::AtomList &path, const char *name1, const char *name2, const
|
||||
if(name1 == nullptr) {
|
||||
return true;
|
||||
}
|
||||
for(AtomList::ConstIterator it = children.begin(); it != children.end(); ++it) {
|
||||
for(AtomList::ConstIterator it = children.cbegin(); it != children.cend(); ++it) {
|
||||
if((*it)->name == name1) {
|
||||
return (*it)->path(path, name2, name3);
|
||||
}
|
||||
@ -199,7 +199,7 @@ MP4::Atoms::~Atoms()
|
||||
MP4::Atom *
|
||||
MP4::Atoms::find(const char *name1, const char *name2, const char *name3, const char *name4)
|
||||
{
|
||||
for(AtomList::ConstIterator it = atoms.begin(); it != atoms.end(); ++it) {
|
||||
for(AtomList::ConstIterator it = atoms.cbegin(); it != atoms.cend(); ++it) {
|
||||
if((*it)->name == name1) {
|
||||
return (*it)->find(name2, name3, name4);
|
||||
}
|
||||
@ -211,7 +211,7 @@ MP4::AtomList
|
||||
MP4::Atoms::path(const char *name1, const char *name2, const char *name3, const char *name4)
|
||||
{
|
||||
MP4::AtomList path;
|
||||
for(AtomList::ConstIterator it = atoms.begin(); it != atoms.end(); ++it) {
|
||||
for(AtomList::ConstIterator it = atoms.cbegin(); it != atoms.cend(); ++it) {
|
||||
if((*it)->name == name1) {
|
||||
if(!(*it)->path(path, name2, name3, name4)) {
|
||||
path.clear();
|
||||
|
@ -61,7 +61,7 @@ MP4::Tag::Tag(TagLib::File *file, MP4::Atoms *atoms) :
|
||||
return;
|
||||
}
|
||||
|
||||
for(AtomList::ConstIterator it = ilst->children.begin(); it != ilst->children.end(); ++it) {
|
||||
for(AtomList::ConstIterator it = ilst->children.cbegin(); it != ilst->children.cend(); ++it) {
|
||||
MP4::Atom *atom = *it;
|
||||
file->seek(atom->offset + 8);
|
||||
if(atom->name == "----") {
|
||||
@ -164,7 +164,7 @@ MP4::Tag::parseData2(const MP4::Atom *atom, int expectedFlags, bool freeForm)
|
||||
ByteVectorList
|
||||
MP4::Tag::parseData(const MP4::Atom *atom, int expectedFlags, bool freeForm)
|
||||
{
|
||||
AtomDataList data = parseData2(atom, expectedFlags, freeForm);
|
||||
const AtomDataList data = parseData2(atom, expectedFlags, freeForm);
|
||||
ByteVectorList result;
|
||||
for(AtomDataList::ConstIterator it = data.begin(); it != data.end(); ++it) {
|
||||
result.append(it->data);
|
||||
@ -244,7 +244,7 @@ MP4::Tag::parseBool(const MP4::Atom *atom)
|
||||
void
|
||||
MP4::Tag::parseText(const MP4::Atom *atom, int expectedFlags)
|
||||
{
|
||||
ByteVectorList data = parseData(atom, expectedFlags);
|
||||
const ByteVectorList data = parseData(atom, expectedFlags);
|
||||
if(!data.isEmpty()) {
|
||||
StringList value;
|
||||
for(ByteVectorList::ConstIterator it = data.begin(); it != data.end(); ++it) {
|
||||
@ -257,7 +257,7 @@ MP4::Tag::parseText(const MP4::Atom *atom, int expectedFlags)
|
||||
void
|
||||
MP4::Tag::parseFreeForm(const MP4::Atom *atom)
|
||||
{
|
||||
AtomDataList data = parseData2(atom, -1, true);
|
||||
const AtomDataList data = parseData2(atom, -1, true);
|
||||
if(data.size() > 2) {
|
||||
AtomDataList::ConstIterator itBegin = data.begin();
|
||||
|
||||
@ -418,7 +418,7 @@ ByteVector
|
||||
MP4::Tag::renderText(const ByteVector &name, const MP4::Item &item, int flags) const
|
||||
{
|
||||
ByteVectorList data;
|
||||
StringList value = item.toStringList();
|
||||
const StringList value = item.toStringList();
|
||||
for(StringList::ConstIterator it = value.begin(); it != value.end(); ++it) {
|
||||
data.append(it->data(String::UTF8));
|
||||
}
|
||||
@ -429,7 +429,7 @@ ByteVector
|
||||
MP4::Tag::renderCovr(const ByteVector &name, const MP4::Item &item) const
|
||||
{
|
||||
ByteVector data;
|
||||
MP4::CoverArtList value = item.toCoverArtList();
|
||||
const MP4::CoverArtList value = item.toCoverArtList();
|
||||
for(MP4::CoverArtList::ConstIterator it = value.begin(); it != value.end(); ++it) {
|
||||
data.append(renderAtom("data", ByteVector::fromUInt(it->format()) +
|
||||
ByteVector(4, '\0') + it->data()));
|
||||
@ -458,13 +458,13 @@ MP4::Tag::renderFreeForm(const String &name, const MP4::Item &item) const
|
||||
}
|
||||
}
|
||||
if(type == TypeUTF8) {
|
||||
StringList value = item.toStringList();
|
||||
const StringList value = item.toStringList();
|
||||
for(StringList::ConstIterator it = value.begin(); it != value.end(); ++it) {
|
||||
data.append(renderAtom("data", ByteVector::fromUInt(type) + ByteVector(4, '\0') + it->data(String::UTF8)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
ByteVectorList value = item.toByteVectorList();
|
||||
const ByteVectorList value = item.toByteVectorList();
|
||||
for(ByteVectorList::ConstIterator it = value.begin(); it != value.end(); ++it) {
|
||||
data.append(renderAtom("data", ByteVector::fromUInt(type) + ByteVector(4, '\0') + *it));
|
||||
}
|
||||
@ -476,7 +476,7 @@ bool
|
||||
MP4::Tag::save()
|
||||
{
|
||||
ByteVector data;
|
||||
for(MP4::ItemMap::ConstIterator it = d->items.begin(); it != d->items.end(); ++it) {
|
||||
for(MP4::ItemMap::ConstIterator it = d->items.cbegin(); it != d->items.cend(); ++it) {
|
||||
const String name = it->first;
|
||||
if(name.startsWith("----")) {
|
||||
data.append(renderFreeForm(name, it->second));
|
||||
@ -587,7 +587,7 @@ MP4::Tag::updateOffsets(offset_t delta, offset_t offset)
|
||||
{
|
||||
MP4::Atom *moov = d->atoms->find("moov");
|
||||
if(moov) {
|
||||
MP4::AtomList stco = moov->findall("stco", true);
|
||||
const MP4::AtomList stco = moov->findall("stco", true);
|
||||
for(MP4::AtomList::ConstIterator it = stco.begin(); it != stco.end(); ++it) {
|
||||
MP4::Atom *atom = *it;
|
||||
if(atom->offset > offset) {
|
||||
@ -608,7 +608,7 @@ MP4::Tag::updateOffsets(offset_t delta, offset_t offset)
|
||||
}
|
||||
}
|
||||
|
||||
MP4::AtomList co64 = moov->findall("co64", true);
|
||||
const MP4::AtomList co64 = moov->findall("co64", true);
|
||||
for(MP4::AtomList::ConstIterator it = co64.begin(); it != co64.end(); ++it) {
|
||||
MP4::Atom *atom = *it;
|
||||
if(atom->offset > offset) {
|
||||
@ -632,7 +632,7 @@ MP4::Tag::updateOffsets(offset_t delta, offset_t offset)
|
||||
|
||||
MP4::Atom *moof = d->atoms->find("moof");
|
||||
if(moof) {
|
||||
MP4::AtomList tfhd = moof->findall("tfhd", true);
|
||||
const MP4::AtomList tfhd = moof->findall("tfhd", true);
|
||||
for(MP4::AtomList::ConstIterator it = tfhd.begin(); it != tfhd.end(); ++it) {
|
||||
MP4::Atom *atom = *it;
|
||||
if(atom->offset > offset) {
|
||||
@ -689,10 +689,10 @@ MP4::Tag::saveExisting(ByteVector data, const AtomList &path)
|
||||
offset_t length = ilst->length;
|
||||
|
||||
MP4::Atom *meta = *(--it);
|
||||
AtomList::ConstIterator index = meta->children.find(ilst);
|
||||
AtomList::ConstIterator index = meta->children.cfind(ilst);
|
||||
|
||||
// check if there is an atom before 'ilst', and possibly use it as padding
|
||||
if(index != meta->children.begin()) {
|
||||
if(index != meta->children.cbegin()) {
|
||||
AtomList::ConstIterator prevIndex = index;
|
||||
prevIndex--;
|
||||
MP4::Atom *prev = *prevIndex;
|
||||
@ -704,7 +704,7 @@ MP4::Tag::saveExisting(ByteVector data, const AtomList &path)
|
||||
// check if there is an atom after 'ilst', and possibly use it as padding
|
||||
AtomList::ConstIterator nextIndex = index;
|
||||
nextIndex++;
|
||||
if(nextIndex != meta->children.end()) {
|
||||
if(nextIndex != meta->children.cend()) {
|
||||
MP4::Atom *next = *nextIndex;
|
||||
if(next->name == "free") {
|
||||
length += next->length;
|
||||
@ -986,7 +986,7 @@ namespace
|
||||
PropertyMap MP4::Tag::properties() const
|
||||
{
|
||||
PropertyMap props;
|
||||
for(MP4::ItemMap::ConstIterator it = d->items.begin(); it != d->items.end(); ++it) {
|
||||
for(MP4::ItemMap::ConstIterator it = d->items.cbegin(); it != d->items.cend(); ++it) {
|
||||
const String key = translateKey(it->first);
|
||||
if(!key.isEmpty()) {
|
||||
if(key == "TRACKNUMBER" || key == "DISCNUMBER") {
|
||||
@ -1031,7 +1031,7 @@ PropertyMap MP4::Tag::setProperties(const PropertyMap &props)
|
||||
}
|
||||
}
|
||||
|
||||
PropertyMap origProps = properties();
|
||||
const PropertyMap origProps = properties();
|
||||
for(PropertyMap::ConstIterator it = origProps.begin(); it != origProps.end(); ++it) {
|
||||
if(!props.contains(it->first) || props[it->first].isEmpty()) {
|
||||
d->items.erase(reverseKeyMap[it->first]);
|
||||
|
@ -186,7 +186,7 @@ void ChapterFrame::removeEmbeddedFrame(Frame *frame, bool del)
|
||||
|
||||
void ChapterFrame::removeEmbeddedFrames(const ByteVector &id)
|
||||
{
|
||||
FrameList l = d->embeddedFrameListMap[id];
|
||||
const FrameList l = d->embeddedFrameListMap[id];
|
||||
for(FrameList::ConstIterator it = l.begin(); it != l.end(); ++it)
|
||||
removeEmbeddedFrame(*it, true);
|
||||
}
|
||||
@ -205,8 +205,8 @@ String ChapterFrame::toString() const
|
||||
|
||||
if(!d->embeddedFrameList.isEmpty()) {
|
||||
StringList frameIDs;
|
||||
for(FrameList::ConstIterator it = d->embeddedFrameList.begin();
|
||||
it != d->embeddedFrameList.end(); ++it)
|
||||
for(FrameList::ConstIterator it = d->embeddedFrameList.cbegin();
|
||||
it != d->embeddedFrameList.cend(); ++it)
|
||||
frameIDs.append((*it)->frameID());
|
||||
s += ", sub-frames: [ " + frameIDs.toString(", ") + " ]";
|
||||
}
|
||||
@ -227,8 +227,8 @@ ChapterFrame *ChapterFrame::findByElementID(const ID3v2::Tag *tag, const ByteVec
|
||||
{
|
||||
ID3v2::FrameList comments = tag->frameList("CHAP");
|
||||
|
||||
for(ID3v2::FrameList::ConstIterator it = comments.begin();
|
||||
it != comments.end();
|
||||
for(ID3v2::FrameList::ConstIterator it = comments.cbegin();
|
||||
it != comments.cend();
|
||||
++it)
|
||||
{
|
||||
ChapterFrame *frame = dynamic_cast<ChapterFrame *>(*it);
|
||||
@ -293,7 +293,7 @@ ByteVector ChapterFrame::renderFields() const
|
||||
data.append(ByteVector::fromUInt(d->endTime, true));
|
||||
data.append(ByteVector::fromUInt(d->startOffset, true));
|
||||
data.append(ByteVector::fromUInt(d->endOffset, true));
|
||||
FrameList l = d->embeddedFrameList;
|
||||
const FrameList l = d->embeddedFrameList;
|
||||
for(FrameList::ConstIterator it = l.begin(); it != l.end(); ++it) {
|
||||
(*it)->header()->setVersion(header()->version());
|
||||
data.append((*it)->render());
|
||||
|
@ -125,7 +125,7 @@ PropertyMap CommentsFrame::asProperties() const
|
||||
|
||||
CommentsFrame *CommentsFrame::findByDescription(const ID3v2::Tag *tag, const String &d) // static
|
||||
{
|
||||
ID3v2::FrameList comments = tag->frameList("COMM");
|
||||
const ID3v2::FrameList comments = tag->frameList("COMM");
|
||||
|
||||
for(ID3v2::FrameList::ConstIterator it = comments.begin();
|
||||
it != comments.end();
|
||||
|
@ -121,8 +121,8 @@ ByteVector EventTimingCodesFrame::renderFields() const
|
||||
ByteVector v;
|
||||
|
||||
v.append(static_cast<char>(d->timestampFormat));
|
||||
for(SynchedEventList::ConstIterator it = d->synchedEvents.begin();
|
||||
it != d->synchedEvents.end();
|
||||
for(SynchedEventList::ConstIterator it = d->synchedEvents.cbegin();
|
||||
it != d->synchedEvents.cend();
|
||||
++it) {
|
||||
const SynchedEvent &entry = *it;
|
||||
v.append(static_cast<char>(entry.type));
|
||||
|
@ -78,8 +78,8 @@ List<RelativeVolumeFrame::ChannelType> RelativeVolumeFrame::channels() const
|
||||
{
|
||||
List<ChannelType> l;
|
||||
|
||||
Map<ChannelType, ChannelData>::ConstIterator it = d->channels.begin();
|
||||
for(; it != d->channels.end(); ++it)
|
||||
Map<ChannelType, ChannelData>::ConstIterator it = d->channels.cbegin();
|
||||
for(; it != d->channels.cend(); ++it)
|
||||
l.append((*it).first);
|
||||
|
||||
return l;
|
||||
@ -162,9 +162,9 @@ ByteVector RelativeVolumeFrame::renderFields() const
|
||||
data.append(d->identification.data(String::Latin1));
|
||||
data.append(textDelimiter(String::Latin1));
|
||||
|
||||
Map<ChannelType, ChannelData>::ConstIterator it = d->channels.begin();
|
||||
Map<ChannelType, ChannelData>::ConstIterator it = d->channels.cbegin();
|
||||
|
||||
for(; it != d->channels.end(); ++it) {
|
||||
for(; it != d->channels.cend(); ++it) {
|
||||
ChannelType type = (*it).first;
|
||||
const ChannelData &channel = (*it).second;
|
||||
|
||||
|
@ -206,8 +206,8 @@ ByteVector SynchronizedLyricsFrame::renderFields() const
|
||||
String::Type encoding = d->textEncoding;
|
||||
|
||||
encoding = checkTextEncoding(d->description, encoding);
|
||||
for(SynchedTextList::ConstIterator it = d->synchedText.begin();
|
||||
it != d->synchedText.end();
|
||||
for(SynchedTextList::ConstIterator it = d->synchedText.cbegin();
|
||||
it != d->synchedText.cend();
|
||||
++it) {
|
||||
encoding = checkTextEncoding(it->text, encoding);
|
||||
}
|
||||
@ -218,8 +218,8 @@ ByteVector SynchronizedLyricsFrame::renderFields() const
|
||||
v.append(static_cast<char>(d->type));
|
||||
v.append(d->description.data(encoding));
|
||||
v.append(textDelimiter(encoding));
|
||||
for(SynchedTextList::ConstIterator it = d->synchedText.begin();
|
||||
it != d->synchedText.end();
|
||||
for(SynchedTextList::ConstIterator it = d->synchedText.cbegin();
|
||||
it != d->synchedText.cend();
|
||||
++it) {
|
||||
const SynchedText &entry = *it;
|
||||
v.append(entry.text.data(encoding));
|
||||
|
@ -213,7 +213,7 @@ void TableOfContentsFrame::removeEmbeddedFrame(Frame *frame, bool del)
|
||||
|
||||
void TableOfContentsFrame::removeEmbeddedFrames(const ByteVector &id)
|
||||
{
|
||||
FrameList l = d->embeddedFrameListMap[id];
|
||||
const FrameList l = d->embeddedFrameListMap[id];
|
||||
for(FrameList::ConstIterator it = l.begin(); it != l.end(); ++it)
|
||||
removeEmbeddedFrame(*it, true);
|
||||
}
|
||||
@ -230,8 +230,8 @@ String TableOfContentsFrame::toString() const
|
||||
|
||||
if(!d->embeddedFrameList.isEmpty()) {
|
||||
StringList frameIDs;
|
||||
for(FrameList::ConstIterator it = d->embeddedFrameList.begin();
|
||||
it != d->embeddedFrameList.end(); ++it)
|
||||
for(FrameList::ConstIterator it = d->embeddedFrameList.cbegin();
|
||||
it != d->embeddedFrameList.cend(); ++it)
|
||||
frameIDs.append((*it)->frameID());
|
||||
s += ", sub-frames: [ " + frameIDs.toString(", ") + " ]";
|
||||
}
|
||||
@ -251,7 +251,7 @@ PropertyMap TableOfContentsFrame::asProperties() const
|
||||
TableOfContentsFrame *TableOfContentsFrame::findByElementID(const ID3v2::Tag *tag,
|
||||
const ByteVector &eID) // static
|
||||
{
|
||||
ID3v2::FrameList tablesOfContents = tag->frameList("CTOC");
|
||||
const ID3v2::FrameList tablesOfContents = tag->frameList("CTOC");
|
||||
|
||||
for(ID3v2::FrameList::ConstIterator it = tablesOfContents.begin();
|
||||
it != tablesOfContents.end();
|
||||
@ -267,7 +267,7 @@ TableOfContentsFrame *TableOfContentsFrame::findByElementID(const ID3v2::Tag *ta
|
||||
|
||||
TableOfContentsFrame *TableOfContentsFrame::findTopLevel(const ID3v2::Tag *tag) // static
|
||||
{
|
||||
ID3v2::FrameList tablesOfContents = tag->frameList("CTOC");
|
||||
const ID3v2::FrameList tablesOfContents = tag->frameList("CTOC");
|
||||
|
||||
for(ID3v2::FrameList::ConstIterator it = tablesOfContents.begin();
|
||||
it != tablesOfContents.end();
|
||||
@ -337,13 +337,13 @@ ByteVector TableOfContentsFrame::renderFields() const
|
||||
flags += 1;
|
||||
data.append(flags);
|
||||
data.append(static_cast<char>(entryCount()));
|
||||
ByteVectorList::ConstIterator it = d->childElements.begin();
|
||||
while(it != d->childElements.end()) {
|
||||
ByteVectorList::ConstIterator it = d->childElements.cbegin();
|
||||
while(it != d->childElements.cend()) {
|
||||
data.append(*it);
|
||||
data.append('\0');
|
||||
it++;
|
||||
}
|
||||
FrameList l = d->embeddedFrameList;
|
||||
const FrameList l = d->embeddedFrameList;
|
||||
for(FrameList::ConstIterator it = l.begin(); it != l.end(); ++it) {
|
||||
(*it)->header()->setVersion(header()->version());
|
||||
data.append((*it)->render());
|
||||
|
@ -211,7 +211,7 @@ void TextIdentificationFrame::parseFields(const ByteVector &data)
|
||||
while(dataLength % byteAlign != 0)
|
||||
dataLength++;
|
||||
|
||||
ByteVectorList l = ByteVectorList::split(data.mid(1, dataLength), textDelimiter(d->textEncoding), byteAlign);
|
||||
const ByteVectorList l = ByteVectorList::split(data.mid(1, dataLength), textDelimiter(d->textEncoding), byteAlign);
|
||||
|
||||
d->fieldList.clear();
|
||||
|
||||
@ -256,13 +256,13 @@ ByteVector TextIdentificationFrame::renderFields() const
|
||||
|
||||
v.append(static_cast<char>(encoding));
|
||||
|
||||
for(StringList::ConstIterator it = d->fieldList.begin(); it != d->fieldList.end(); it++) {
|
||||
for(StringList::ConstIterator it = d->fieldList.cbegin(); it != d->fieldList.cend(); it++) {
|
||||
|
||||
// Since the field list is null delimited, if this is not the first
|
||||
// element in the list, append the appropriate delimiter for this
|
||||
// encoding.
|
||||
|
||||
if(it != d->fieldList.begin())
|
||||
if(it != d->fieldList.cbegin())
|
||||
v.append(textDelimiter(encoding));
|
||||
|
||||
v.append((*it).data(encoding));
|
||||
@ -290,7 +290,7 @@ PropertyMap TextIdentificationFrame::makeTIPLProperties() const
|
||||
map.unsupportedData().append(frameID());
|
||||
return map;
|
||||
}
|
||||
StringList l = fieldList();
|
||||
const StringList l = fieldList();
|
||||
for(StringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
|
||||
bool found = false;
|
||||
for(size_t i = 0; i < involvedPeopleSize; ++i)
|
||||
@ -317,7 +317,7 @@ PropertyMap TextIdentificationFrame::makeTMCLProperties() const
|
||||
map.unsupportedData().append(frameID());
|
||||
return map;
|
||||
}
|
||||
StringList l = fieldList();
|
||||
const StringList l = fieldList();
|
||||
for(StringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
|
||||
String instrument = it->upper();
|
||||
if(instrument.isEmpty()) {
|
||||
@ -417,7 +417,7 @@ PropertyMap UserTextIdentificationFrame::asProperties() const
|
||||
{
|
||||
PropertyMap map;
|
||||
String tagName = txxxToKey(description());
|
||||
StringList v = fieldList();
|
||||
const StringList v = fieldList();
|
||||
for(StringList::ConstIterator it = v.begin(); it != v.end(); ++it)
|
||||
if(it != v.begin())
|
||||
map.insert(tagName, *it);
|
||||
@ -427,7 +427,7 @@ PropertyMap UserTextIdentificationFrame::asProperties() const
|
||||
UserTextIdentificationFrame *UserTextIdentificationFrame::find(
|
||||
ID3v2::Tag *tag, const String &description) // static
|
||||
{
|
||||
FrameList l = tag->frameList("TXXX");
|
||||
const FrameList l = tag->frameList("TXXX");
|
||||
for(FrameList::ConstIterator it = l.begin(); it != l.end(); ++it) {
|
||||
UserTextIdentificationFrame *f = dynamic_cast<UserTextIdentificationFrame *>(*it);
|
||||
if(f && f->description() == description)
|
||||
|
@ -103,7 +103,7 @@ PropertyMap UniqueFileIdentifierFrame::asProperties() const
|
||||
|
||||
UniqueFileIdentifierFrame *UniqueFileIdentifierFrame::findByOwner(const ID3v2::Tag *tag, const String &o) // static
|
||||
{
|
||||
ID3v2::FrameList comments = tag->frameList("UFID");
|
||||
const ID3v2::FrameList comments = tag->frameList("UFID");
|
||||
|
||||
for(ID3v2::FrameList::ConstIterator it = comments.begin();
|
||||
it != comments.end();
|
||||
|
@ -127,7 +127,7 @@ PropertyMap UnsynchronizedLyricsFrame::asProperties() const
|
||||
|
||||
UnsynchronizedLyricsFrame *UnsynchronizedLyricsFrame::findByDescription(const ID3v2::Tag *tag, const String &d) // static
|
||||
{
|
||||
ID3v2::FrameList lyrics = tag->frameList("USLT");
|
||||
const ID3v2::FrameList lyrics = tag->frameList("USLT");
|
||||
|
||||
for(ID3v2::FrameList::ConstIterator it = lyrics.begin(); it != lyrics.end(); ++it){
|
||||
UnsynchronizedLyricsFrame *frame = dynamic_cast<UnsynchronizedLyricsFrame *>(*it);
|
||||
|
@ -179,7 +179,7 @@ PropertyMap UserUrlLinkFrame::asProperties() const
|
||||
|
||||
UserUrlLinkFrame *UserUrlLinkFrame::find(ID3v2::Tag *tag, const String &description) // static
|
||||
{
|
||||
FrameList l = tag->frameList("WXXX");
|
||||
const FrameList l = tag->frameList("WXXX");
|
||||
for(FrameList::ConstIterator it = l.begin(); it != l.end(); ++it) {
|
||||
UserUrlLinkFrame *f = dynamic_cast<UserUrlLinkFrame *>(*it);
|
||||
if(f && f->description() == description)
|
||||
|
@ -58,7 +58,7 @@ namespace
|
||||
StringList fields = frame->fieldList();
|
||||
StringList newfields;
|
||||
|
||||
for(StringList::ConstIterator it = fields.begin(); it != fields.end(); ++it) {
|
||||
for(StringList::ConstIterator it = fields.cbegin(); it != fields.cend(); ++it) {
|
||||
String s = *it;
|
||||
int offset = 0;
|
||||
int end = 0;
|
||||
@ -144,7 +144,7 @@ Frame *FrameFactory::createFrame(const ByteVector &origData, const Header *tagHe
|
||||
}
|
||||
#endif
|
||||
|
||||
for(ByteVector::ConstIterator it = frameID.begin(); it != frameID.end(); it++) {
|
||||
for(ByteVector::ConstIterator it = frameID.cbegin(); it != frameID.cend(); it++) {
|
||||
if( (*it < 'A' || *it > 'Z') && (*it < '0' || *it > '9') ) {
|
||||
delete header;
|
||||
return nullptr;
|
||||
|
@ -202,7 +202,7 @@ void Header::parse(const ByteVector &data)
|
||||
// note that we're doing things a little out of order here -- the size is
|
||||
// later in the bytestream than the version
|
||||
|
||||
ByteVector sizeData = data.mid(6, 4);
|
||||
const ByteVector sizeData = data.mid(6, 4);
|
||||
|
||||
if(sizeData.size() != 4) {
|
||||
d->tagSize = 0;
|
||||
|
@ -378,7 +378,7 @@ void ID3v2::Tag::removeFrame(Frame *frame, bool del)
|
||||
|
||||
void ID3v2::Tag::removeFrames(const ByteVector &id)
|
||||
{
|
||||
FrameList l = d->frameListMap[id];
|
||||
const FrameList l = d->frameListMap[id];
|
||||
for(FrameList::ConstIterator it = l.begin(); it != l.end(); ++it)
|
||||
removeFrame(*it, true);
|
||||
}
|
||||
@ -402,7 +402,7 @@ void ID3v2::Tag::removeUnsupportedProperties(const StringList &properties)
|
||||
continue; // invalid specification
|
||||
ByteVector id = frameID.data(String::Latin1);
|
||||
// delete all unknown frames of given type
|
||||
FrameList l = frameList(id);
|
||||
const FrameList l = frameList(id);
|
||||
for(FrameList::ConstIterator fit = l.begin(); fit != l.end(); fit++)
|
||||
if (dynamic_cast<const UnknownFrame *>(*fit) != nullptr)
|
||||
removeFrame(*fit);
|
||||
@ -461,7 +461,7 @@ PropertyMap ID3v2::Tag::setProperties(const PropertyMap &origProps)
|
||||
properties.erase(frameProperties);
|
||||
}
|
||||
}
|
||||
for(FrameList::ConstIterator it = framesToDelete.begin(); it != framesToDelete.end(); ++it)
|
||||
for(FrameList::ConstIterator it = framesToDelete.cbegin(); it != framesToDelete.cend(); ++it)
|
||||
removeFrame(*it);
|
||||
|
||||
// now create remaining frames:
|
||||
@ -472,7 +472,7 @@ PropertyMap ID3v2::Tag::setProperties(const PropertyMap &origProps)
|
||||
if(!tmclProperties.isEmpty())
|
||||
addFrame(TextIdentificationFrame::createTMCLFrame(tmclProperties));
|
||||
// now create the "one key per frame" frames
|
||||
for(PropertyMap::ConstIterator it = properties.begin(); it != properties.end(); ++it)
|
||||
for(PropertyMap::ConstIterator it = properties.cbegin(); it != properties.cend(); ++it)
|
||||
addFrame(Frame::createTextualFrame(it->first, it->second));
|
||||
return PropertyMap(); // ID3 implements the complete PropertyMap interface, so an empty map is returned
|
||||
}
|
||||
@ -502,7 +502,7 @@ void ID3v2::Tag::downgradeFrames(FrameList *frames, FrameList *newFrames) const
|
||||
ID3v2::TextIdentificationFrame *frameTMCL = nullptr;
|
||||
ID3v2::TextIdentificationFrame *frameTCON = nullptr;
|
||||
|
||||
for(FrameList::ConstIterator it = d->frameList.begin(); it != d->frameList.end(); it++) {
|
||||
for(FrameList::ConstIterator it = d->frameList.cbegin(); it != d->frameList.cend(); it++) {
|
||||
ID3v2::Frame *frame = *it;
|
||||
ByteVector frameID = frame->header()->frameID();
|
||||
|
||||
@ -591,7 +591,7 @@ void ID3v2::Tag::downgradeFrames(FrameList *frames, FrameList *newFrames) const
|
||||
}
|
||||
|
||||
if(frameTCON) {
|
||||
StringList genres = frameTCON->fieldList();
|
||||
const StringList genres = frameTCON->fieldList();
|
||||
String combined;
|
||||
String genreText;
|
||||
const bool hasMultipleGenres = genres.size() > 1;
|
||||
@ -647,7 +647,7 @@ ByteVector ID3v2::Tag::render(Version version) const
|
||||
|
||||
// Loop through the frames rendering them and adding them to the tagData.
|
||||
|
||||
for(FrameList::ConstIterator it = frameList.begin(); it != frameList.end(); it++) {
|
||||
for(FrameList::ConstIterator it = frameList.cbegin(); it != frameList.cend(); it++) {
|
||||
(*it)->header()->setVersion(version == v3 ? 3 : 4);
|
||||
if((*it)->header()->frameID().size() != 4) {
|
||||
debug("An ID3v2 frame of unsupported or unknown type \'"
|
||||
|
@ -95,7 +95,7 @@ ByteVector Ogg::File::packet(unsigned int i)
|
||||
|
||||
// Look for the first page in which the requested packet starts.
|
||||
|
||||
List<Page *>::ConstIterator it = d->pages.begin();
|
||||
List<Page *>::ConstIterator it = d->pages.cbegin();
|
||||
while((*it)->containsPacket(i) == Page::DoesNotContainPacket)
|
||||
++it;
|
||||
|
||||
@ -160,7 +160,7 @@ bool Ogg::File::save()
|
||||
}
|
||||
|
||||
Map<unsigned int, ByteVector>::ConstIterator it;
|
||||
for(it = d->dirtyPackets.begin(); it != d->dirtyPackets.end(); ++it)
|
||||
for(it = d->dirtyPackets.cbegin(); it != d->dirtyPackets.cend(); ++it)
|
||||
writePacket(it->first, it->second);
|
||||
|
||||
d->dirtyPackets.clear();
|
||||
@ -236,7 +236,7 @@ void Ogg::File::writePacket(unsigned int i, const ByteVector &packet)
|
||||
|
||||
// Look for the pages where the requested packet should belong to.
|
||||
|
||||
List<Page *>::ConstIterator it = d->pages.begin();
|
||||
List<Page *>::ConstIterator it = d->pages.cbegin();
|
||||
while((*it)->containsPacket(i) == Page::DoesNotContainPacket)
|
||||
++it;
|
||||
|
||||
|
@ -211,7 +211,7 @@ ByteVectorList Ogg::Page::packets() const
|
||||
|
||||
d->file->seek(d->fileOffset + d->header.size());
|
||||
|
||||
List<int> packetSizes = d->header.packetSizes();
|
||||
const List<int> packetSizes = d->header.packetSizes();
|
||||
|
||||
List<int>::ConstIterator it = packetSizes.begin();
|
||||
for(; it != packetSizes.end(); ++it)
|
||||
@ -243,8 +243,8 @@ ByteVector Ogg::Page::render() const
|
||||
debug("Ogg::Page::render() -- this page is empty!");
|
||||
}
|
||||
else {
|
||||
ByteVectorList::ConstIterator it = d->packets.begin();
|
||||
for(; it != d->packets.end(); ++it)
|
||||
ByteVectorList::ConstIterator it = d->packets.cbegin();
|
||||
for(; it != d->packets.cend(); ++it)
|
||||
data.append(*it);
|
||||
}
|
||||
|
||||
|
@ -295,7 +295,7 @@ ByteVector Ogg::PageHeader::lacingValues() const
|
||||
{
|
||||
ByteVector data;
|
||||
|
||||
for(List<int>::ConstIterator it = d->packetSizes.begin(); it != d->packetSizes.end(); ++it) {
|
||||
for(List<int>::ConstIterator it = d->packetSizes.cbegin(); it != d->packetSizes.cend(); ++it) {
|
||||
|
||||
// The size of a packet in an Ogg page is indicated by a series of "lacing
|
||||
// values" where the sum of the values is the packet size in bytes. Each of
|
||||
@ -304,7 +304,7 @@ ByteVector Ogg::PageHeader::lacingValues() const
|
||||
|
||||
data.resize(data.size() + (*it / 255), '\xff');
|
||||
|
||||
if(it != --d->packetSizes.end() || d->lastPacketCompleted)
|
||||
if(it != --d->packetSizes.cend() || d->lastPacketCompleted)
|
||||
data.append(static_cast<unsigned char>(*it % 255));
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ namespace
|
||||
|
||||
typedef List<FLAC::Picture *> PictureList;
|
||||
typedef PictureList::Iterator PictureIterator;
|
||||
typedef PictureList::Iterator PictureConstIterator;
|
||||
typedef PictureList::ConstIterator PictureConstIterator;
|
||||
} // namespace
|
||||
|
||||
class Ogg::XiphComment::XiphCommentPrivate
|
||||
@ -191,7 +191,7 @@ void Ogg::XiphComment::setTrack(unsigned int i)
|
||||
|
||||
bool Ogg::XiphComment::isEmpty() const
|
||||
{
|
||||
for(FieldConstIterator it = d->fieldListMap.begin(); it != d->fieldListMap.end(); ++it) {
|
||||
for(FieldConstIterator it = d->fieldListMap.cbegin(); it != d->fieldListMap.cend(); ++it) {
|
||||
if(!(*it).second.isEmpty())
|
||||
return false;
|
||||
}
|
||||
@ -203,7 +203,7 @@ unsigned int Ogg::XiphComment::fieldCount() const
|
||||
{
|
||||
unsigned int count = 0;
|
||||
|
||||
for(FieldConstIterator it = d->fieldListMap.begin(); it != d->fieldListMap.end(); ++it)
|
||||
for(FieldConstIterator it = d->fieldListMap.cbegin(); it != d->fieldListMap.cend(); ++it)
|
||||
count += (*it).second.size();
|
||||
|
||||
count += d->pictureList.size();
|
||||
@ -225,11 +225,11 @@ PropertyMap Ogg::XiphComment::setProperties(const PropertyMap &properties)
|
||||
{
|
||||
// check which keys are to be deleted
|
||||
StringList toRemove;
|
||||
for(FieldConstIterator it = d->fieldListMap.begin(); it != d->fieldListMap.end(); ++it)
|
||||
for(FieldConstIterator it = d->fieldListMap.cbegin(); it != d->fieldListMap.cend(); ++it)
|
||||
if (!properties.contains(it->first))
|
||||
toRemove.append(it->first);
|
||||
|
||||
for(StringList::ConstIterator it = toRemove.begin(); it != toRemove.end(); ++it)
|
||||
for(StringList::ConstIterator it = toRemove.cbegin(); it != toRemove.cend(); ++it)
|
||||
removeFields(*it);
|
||||
|
||||
// now go through keys in \a properties and check that the values match those in the xiph comment
|
||||
@ -366,13 +366,13 @@ ByteVector Ogg::XiphComment::render(bool addFramingBit) const
|
||||
// std::pair<String, StringList> where the first String is the field name and
|
||||
// the StringList is the values associated with that field.
|
||||
|
||||
FieldListMap::ConstIterator it = d->fieldListMap.begin();
|
||||
for(; it != d->fieldListMap.end(); ++it) {
|
||||
FieldListMap::ConstIterator it = d->fieldListMap.cbegin();
|
||||
for(; it != d->fieldListMap.cend(); ++it) {
|
||||
|
||||
// And now iterate over the values of the current list.
|
||||
|
||||
String fieldName = (*it).first;
|
||||
StringList values = (*it).second;
|
||||
const StringList values = (*it).second;
|
||||
|
||||
StringList::ConstIterator valuesIt = values.begin();
|
||||
for(; valuesIt != values.end(); ++valuesIt) {
|
||||
@ -385,7 +385,7 @@ ByteVector Ogg::XiphComment::render(bool addFramingBit) const
|
||||
}
|
||||
}
|
||||
|
||||
for(PictureConstIterator it = d->pictureList.begin(); it != d->pictureList.end(); ++it) {
|
||||
for(PictureConstIterator it = d->pictureList.cbegin(); it != d->pictureList.cend(); ++it) {
|
||||
ByteVector picture = (*it)->render().toBase64();
|
||||
data.append(ByteVector::fromUInt(picture.size() + 23, false));
|
||||
data.append("METADATA_BLOCK_PICTURE=");
|
||||
|
@ -26,6 +26,8 @@
|
||||
#ifndef TAGLIB_RIFFUTILS_H
|
||||
#define TAGLIB_RIFFUTILS_H
|
||||
|
||||
#include "tbytevector.h"
|
||||
|
||||
// THIS FILE IS NOT A PART OF THE TAGLIB API
|
||||
|
||||
#ifndef DO_NOT_DOCUMENT // tell Doxygen not to document this header
|
||||
|
@ -201,8 +201,8 @@ ByteVector RIFF::Info::Tag::render() const
|
||||
{
|
||||
ByteVector data("INFO");
|
||||
|
||||
FieldListMap::ConstIterator it = d->fieldListMap.begin();
|
||||
for(; it != d->fieldListMap.end(); ++it) {
|
||||
FieldListMap::ConstIterator it = d->fieldListMap.cbegin();
|
||||
for(; it != d->fieldListMap.cend(); ++it) {
|
||||
ByteVector text = stringHandler->render(it->second);
|
||||
if(text.isEmpty())
|
||||
continue;
|
||||
|
@ -141,7 +141,7 @@ PropertyMap Tag::setProperties(const PropertyMap &origProps)
|
||||
|
||||
// for each tag that has been set above, remove the first entry in the corresponding
|
||||
// value list. The others will be returned as unsupported by this format.
|
||||
for(StringList::ConstIterator it = oneValueSet.begin(); it != oneValueSet.end(); ++it) {
|
||||
for(StringList::ConstIterator it = oneValueSet.cbegin(); it != oneValueSet.cend(); ++it) {
|
||||
if(properties[*it].size() == 1)
|
||||
properties.erase(*it);
|
||||
else
|
||||
|
@ -616,6 +616,11 @@ ByteVector::ConstIterator ByteVector::begin() const
|
||||
return d->data->begin() + d->offset;
|
||||
}
|
||||
|
||||
ByteVector::ConstIterator ByteVector::cbegin() const
|
||||
{
|
||||
return d->data->cbegin() + d->offset;
|
||||
}
|
||||
|
||||
ByteVector::Iterator ByteVector::end()
|
||||
{
|
||||
detach();
|
||||
@ -627,6 +632,11 @@ ByteVector::ConstIterator ByteVector::end() const
|
||||
return d->data->begin() + d->offset + d->length;
|
||||
}
|
||||
|
||||
ByteVector::ConstIterator ByteVector::cend() const
|
||||
{
|
||||
return d->data->cbegin() + d->offset + d->length;
|
||||
}
|
||||
|
||||
ByteVector::ReverseIterator ByteVector::rbegin()
|
||||
{
|
||||
detach();
|
||||
|
@ -240,6 +240,11 @@ namespace TagLib {
|
||||
*/
|
||||
ConstIterator begin() const;
|
||||
|
||||
/*!
|
||||
* Returns a ConstIterator that points to the front of the vector.
|
||||
*/
|
||||
ConstIterator cbegin() const;
|
||||
|
||||
/*!
|
||||
* Returns an Iterator that points to the back of the vector.
|
||||
*/
|
||||
@ -250,6 +255,11 @@ namespace TagLib {
|
||||
*/
|
||||
ConstIterator end() const;
|
||||
|
||||
/*!
|
||||
* Returns a ConstIterator that points to the back of the vector.
|
||||
*/
|
||||
ConstIterator cend() const;
|
||||
|
||||
/*!
|
||||
* Returns a ReverseIterator that points to the front of the vector.
|
||||
*/
|
||||
|
@ -88,6 +88,12 @@ namespace TagLib {
|
||||
*/
|
||||
ConstIterator begin() const;
|
||||
|
||||
/*!
|
||||
* Returns an STL style constant iterator to the beginning of the list. See
|
||||
* std::list::iterator for the semantics.
|
||||
*/
|
||||
ConstIterator cbegin() const;
|
||||
|
||||
/*!
|
||||
* Returns an STL style iterator to the end of the list. See
|
||||
* std::list::iterator for the semantics.
|
||||
@ -100,6 +106,12 @@ namespace TagLib {
|
||||
*/
|
||||
ConstIterator end() const;
|
||||
|
||||
/*!
|
||||
* Returns an STL style constant iterator to the end of the list. See
|
||||
* std::list::const_iterator for the semantics.
|
||||
*/
|
||||
ConstIterator cend() const;
|
||||
|
||||
/*!
|
||||
* Inserts a copy of \a value before \a it.
|
||||
*/
|
||||
@ -168,6 +180,11 @@ namespace TagLib {
|
||||
*/
|
||||
ConstIterator find(const T &value) const;
|
||||
|
||||
/*!
|
||||
* Find the first occurrence of \a value.
|
||||
*/
|
||||
ConstIterator cfind(const T &value) const;
|
||||
|
||||
/*!
|
||||
* Returns true if the list contains \a value.
|
||||
*/
|
||||
|
@ -119,6 +119,12 @@ typename List<T>::ConstIterator List<T>::begin() const
|
||||
return d->list.begin();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
typename List<T>::ConstIterator List<T>::cbegin() const
|
||||
{
|
||||
return d->list.cbegin();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
typename List<T>::Iterator List<T>::end()
|
||||
{
|
||||
@ -132,6 +138,12 @@ typename List<T>::ConstIterator List<T>::end() const
|
||||
return d->list.end();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
typename List<T>::ConstIterator List<T>::cend() const
|
||||
{
|
||||
return d->list.cend();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
typename List<T>::Iterator List<T>::insert(Iterator it, const T &item)
|
||||
{
|
||||
@ -217,6 +229,12 @@ typename List<T>::ConstIterator List<T>::find(const T &value) const
|
||||
return std::find(d->list.begin(), d->list.end(), value);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
typename List<T>::ConstIterator List<T>::cfind(const T &value) const
|
||||
{
|
||||
return std::find(d->list.cbegin(), d->list.cend(), value);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool List<T>::contains(const T &value) const
|
||||
{
|
||||
|
@ -90,6 +90,12 @@ namespace TagLib {
|
||||
*/
|
||||
ConstIterator begin() const;
|
||||
|
||||
/*!
|
||||
* Returns an STL style iterator to the beginning of the map. See
|
||||
* std::map::const_iterator for the semantics.
|
||||
*/
|
||||
ConstIterator cbegin() const;
|
||||
|
||||
/*!
|
||||
* Returns an STL style iterator to the end of the map. See
|
||||
* std::map::iterator for the semantics.
|
||||
@ -102,6 +108,12 @@ namespace TagLib {
|
||||
*/
|
||||
ConstIterator end() const;
|
||||
|
||||
/*!
|
||||
* Returns an STL style iterator to the end of the map. See
|
||||
* std::map::const_iterator for the semantics.
|
||||
*/
|
||||
ConstIterator cend() const;
|
||||
|
||||
/*!
|
||||
* Inserts \a value under \a key in the map. If a value for \a key already
|
||||
* exists it will be overwritten.
|
||||
|
@ -78,6 +78,12 @@ typename Map<Key, T>::ConstIterator Map<Key, T>::begin() const
|
||||
return d->map.begin();
|
||||
}
|
||||
|
||||
template <class Key, class T>
|
||||
typename Map<Key, T>::ConstIterator Map<Key, T>::cbegin() const
|
||||
{
|
||||
return d->map.cbegin();
|
||||
}
|
||||
|
||||
template <class Key, class T>
|
||||
typename Map<Key, T>::Iterator Map<Key, T>::end()
|
||||
{
|
||||
@ -91,6 +97,12 @@ typename Map<Key, T>::ConstIterator Map<Key, T>::end() const
|
||||
return d->map.end();
|
||||
}
|
||||
|
||||
template <class Key, class T>
|
||||
typename Map<Key, T>::ConstIterator Map<Key, T>::cend() const
|
||||
{
|
||||
return d->map.cend();
|
||||
}
|
||||
|
||||
template <class Key, class T>
|
||||
Map<Key, T> &Map<Key, T>::insert(const Key &key, const T &value)
|
||||
{
|
||||
|
@ -167,7 +167,7 @@ String PropertyMap::toString() const
|
||||
void PropertyMap::removeEmpty()
|
||||
{
|
||||
PropertyMap m;
|
||||
for(ConstIterator it = begin(); it != end(); ++it) {
|
||||
for(ConstIterator it = cbegin(); it != cend(); ++it) {
|
||||
if(!it->second.isEmpty())
|
||||
m.insert(it->first, it->second);
|
||||
}
|
||||
|
@ -309,6 +309,11 @@ String::ConstIterator String::begin() const
|
||||
return d->data.begin();
|
||||
}
|
||||
|
||||
String::ConstIterator String::cbegin() const
|
||||
{
|
||||
return d->data.cbegin();
|
||||
}
|
||||
|
||||
String::Iterator String::end()
|
||||
{
|
||||
detach();
|
||||
@ -320,6 +325,11 @@ String::ConstIterator String::end() const
|
||||
return d->data.end();
|
||||
}
|
||||
|
||||
String::ConstIterator String::cend() const
|
||||
{
|
||||
return d->data.cend();
|
||||
}
|
||||
|
||||
int String::find(const String &s, int offset) const
|
||||
{
|
||||
return static_cast<int>(d->data.find(s.d->data, offset));
|
||||
|
@ -252,6 +252,11 @@ namespace TagLib {
|
||||
*/
|
||||
ConstIterator begin() const;
|
||||
|
||||
/*!
|
||||
* Returns a const iterator pointing to the beginning of the string.
|
||||
*/
|
||||
ConstIterator cbegin() const;
|
||||
|
||||
/*!
|
||||
* Returns an iterator pointing to the end of the string (the position
|
||||
* after the last character).
|
||||
@ -264,6 +269,12 @@ namespace TagLib {
|
||||
*/
|
||||
ConstIterator end() const;
|
||||
|
||||
/*!
|
||||
* Returns a const iterator pointing to the end of the string (the position
|
||||
* after the last character).
|
||||
*/
|
||||
ConstIterator cend() const;
|
||||
|
||||
/*!
|
||||
* Finds the first occurrence of pattern \a s in this string starting from
|
||||
* \a offset. If the pattern is not found, -1 is returned.
|
||||
|
@ -333,8 +333,8 @@ public:
|
||||
unsigned int read(TagLib::File &file, unsigned int limit) override
|
||||
{
|
||||
unsigned int sumcount = 0;
|
||||
for(List<Reader*>::ConstIterator i = m_readers.begin();
|
||||
limit > 0 && i != m_readers.end(); ++ i) {
|
||||
for(List<Reader*>::ConstIterator i = m_readers.cbegin();
|
||||
limit > 0 && i != m_readers.cend(); ++ i) {
|
||||
unsigned int count = (*i)->read(file, limit);
|
||||
limit -= count;
|
||||
sumcount += count;
|
||||
|
Loading…
Reference in New Issue
Block a user