diff --git a/taglib/toolkit/tbytevectorlist.cpp b/taglib/toolkit/tbytevectorlist.cpp index 33e10ad6..8171781d 100644 --- a/taglib/toolkit/tbytevectorlist.cpp +++ b/taglib/toolkit/tbytevectorlist.cpp @@ -72,6 +72,11 @@ ByteVectorList::ByteVectorList(const ByteVectorList &l) : { } +ByteVectorList::ByteVectorList(std::initializer_list init) : + List(init) +{ +} + ByteVectorList &ByteVectorList::operator=(const ByteVectorList &l) { if(this == &l) @@ -81,6 +86,12 @@ ByteVectorList &ByteVectorList::operator=(const ByteVectorList &l) return *this; } +ByteVectorList &ByteVectorList::operator=(std::initializer_list init) +{ + List::operator=(init); + return *this; +} + ByteVector ByteVectorList::toByteVector(const ByteVector &separator) const { ByteVector v; @@ -93,3 +104,18 @@ ByteVector ByteVectorList::toByteVector(const ByteVector &separator) const return v; } + +//////////////////////////////////////////////////////////////////////////////// +// related functions +//////////////////////////////////////////////////////////////////////////////// + +std::ostream &operator<<(std::ostream &s, const ByteVectorList &l) +{ + for(auto it = l.begin(); it != l.end(); ++it) { + if(it != l.begin()) { + s << ' '; + } + s << *it; + } + return s; +} diff --git a/taglib/toolkit/tbytevectorlist.h b/taglib/toolkit/tbytevectorlist.h index f899f11c..c81f6f19 100644 --- a/taglib/toolkit/tbytevectorlist.h +++ b/taglib/toolkit/tbytevectorlist.h @@ -59,7 +59,13 @@ namespace TagLib { */ ByteVectorList(const ByteVectorList &l); + /*! + * Construct a ByteVectorList with the contents of the braced initializer list. + */ + ByteVectorList(std::initializer_list init); + ByteVectorList &operator=(const ByteVectorList &); + ByteVectorList &operator=(std::initializer_list init); /*! * Convert the ByteVectorList to a ByteVector separated by \a separator. By @@ -83,4 +89,10 @@ namespace TagLib { } // namespace TagLib +/*! + * \related TagLib::ByteVectorList + * Send the ByteVectorList to an output stream. + */ +std::ostream TAGLIB_EXPORT &operator<<(std::ostream &s, const TagLib::ByteVectorList &l); + #endif diff --git a/taglib/toolkit/tlist.h b/taglib/toolkit/tlist.h index 5c98bf08..d7a9ed25 100644 --- a/taglib/toolkit/tlist.h +++ b/taglib/toolkit/tlist.h @@ -73,7 +73,7 @@ namespace TagLib { List(const List &l); /*! - * Construct a List with the contents of the braced initiliazer list + * Construct a List with the contents of the braced initializer list. */ List(std::initializer_list init); diff --git a/taglib/toolkit/tmap.h b/taglib/toolkit/tmap.h index fc582eb7..eb515d4a 100644 --- a/taglib/toolkit/tmap.h +++ b/taglib/toolkit/tmap.h @@ -212,6 +212,17 @@ namespace TagLib { */ void swap(Map &m); + /*! + * Compares this map with \a m and returns true if all of the elements are + * the same. + */ + bool operator==(const Map &m) const; + + /*! + * Compares this map with \a m and returns true if the maps differ. + */ + bool operator!=(const Map &m) const; + protected: /* * If this List is being shared via implicit sharing, do a deep copy of the diff --git a/taglib/toolkit/tmap.tcc b/taglib/toolkit/tmap.tcc index 99115c1f..067491db 100644 --- a/taglib/toolkit/tmap.tcc +++ b/taglib/toolkit/tmap.tcc @@ -205,6 +205,18 @@ void Map::swap(Map &m) swap(d, m.d); } +template +bool Map::operator==(const Map &m) const +{ + return d->map == m.d->map; +} + +template +bool Map::operator!=(const Map &m) const +{ + return d->map != m.d->map; +} + //////////////////////////////////////////////////////////////////////////////// // protected members //////////////////////////////////////////////////////////////////////////////// diff --git a/taglib/toolkit/tstringlist.cpp b/taglib/toolkit/tstringlist.cpp index 5c833314..224afc2c 100644 --- a/taglib/toolkit/tstringlist.cpp +++ b/taglib/toolkit/tstringlist.cpp @@ -61,6 +61,11 @@ StringList::StringList(const StringList &l) : { } +StringList::StringList(std::initializer_list init) : + List(init) +{ +} + StringList &StringList::operator=(const StringList &l) { if(this == &l) @@ -70,6 +75,12 @@ StringList &StringList::operator=(const StringList &l) return *this; } +StringList &StringList::operator=(std::initializer_list init) +{ + List::operator=(init); + return *this; +} + StringList::StringList(const String &s) { append(s); diff --git a/taglib/toolkit/tstringlist.h b/taglib/toolkit/tstringlist.h index 820b0af7..0396cde0 100644 --- a/taglib/toolkit/tstringlist.h +++ b/taglib/toolkit/tstringlist.h @@ -58,7 +58,13 @@ namespace TagLib { */ StringList(const StringList &l); + /*! + * Construct a StringList with the contents of the braced initializer list. + */ + StringList(std::initializer_list init); + StringList &operator=(const StringList &); + StringList &operator=(std::initializer_list init); /*! * Constructs a StringList with \a s as a member.