tmap.h
Go to the documentation of this file.
/***************************************************************************
copyright : (C) 2002 - 2008 by Scott Wheeler
email : wheeler@kde.org
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifndef TAGLIB_MAP_H
#define TAGLIB_MAP_H
#include <map>
#include <memory>
#include <initializer_list>
#include <utility>
namespace TagLib {
template <class Key, class T> class Map
{
public:
#ifndef DO_NOT_DOCUMENT
#ifdef WANT_CLASS_INSTANTIATION_OF_MAP
// Some STL implementations get snippy over the use of the
// class keyword to distinguish different templates; Sun Studio
// in particular finds multiple specializations in certain rare
// cases and complains about that. GCC doesn't seem to mind,
// and uses the typedefs further below without the class keyword.
// Not all the specializations of Map can use the class keyword
// (when T is not actually a class type), so don't apply this
// generally.
using Iterator = typename std::map<class Key, class T>::iterator;
using ConstIterator = typename std::map<class Key, class T>::const_iterator;
#else
using Iterator = typename std::map<Key, T>::iterator;
using ConstIterator = typename std::map<Key, T>::const_iterator;
#endif
#endif
Map();
Map(const Map<Key, T> &m);
Map(std::initializer_list<std::pair<const Key, T>> init);
~Map();
Iterator begin();
ConstIterator begin() const;
ConstIterator cbegin() const;
Iterator end();
ConstIterator end() const;
ConstIterator cend() const;
Map<Key, T> &insert(const Key &key, const T &value);
Map<Key, T> &clear();
unsigned int size() const;
bool isEmpty() const;
Iterator find(const Key &key);
ConstIterator find(const Key &key) const;
bool contains(const Key &key) const;
Map<Key, T> &erase(Iterator it);
Map<Key, T> &erase(const Key &key);
T value(const Key &key, const T &defaultValue = T()) const;
const T &operator[](const Key &key) const;
T &operator[](const Key &key);
Map<Key, T> &operator=(const Map<Key, T> &m);
Map<Key, T> &operator=(std::initializer_list<std::pair<const Key, T>> init);
void swap(Map<Key, T> &m) noexcept;
bool operator==(const Map<Key, T> &m) const;
bool operator!=(const Map<Key, T> &m) const;
protected:
void detach();
private:
#ifndef DO_NOT_DOCUMENT
template <class KeyP, class TP> class MapPrivate;
std::shared_ptr<MapPrivate<Key, T>> d;
#endif
};
} // namespace TagLib
// Since GCC doesn't support the "export" keyword, we have to include the
// implementation.
#include "tmap.tcc"
#endif
TagLib::Map::~Map
~Map()
TagLib::Map::isEmpty
bool isEmpty() const
TagLib::Map< const String, Item >::value
Item value(const const String &key, const Item &defaultValue=Item()) const
TagLib::Map::operator[]
T & operator[](const Key &key)
TagLib::Map::operator[]
const T & operator[](const Key &key) const
TagLib::Map::cend
ConstIterator cend() const
TagLib::Map::swap
void swap(Map< Key, T > &m) noexcept
TagLib::Map::operator==
bool operator==(const Map< Key, T > &m) const
TagLib::Map::operator!=
bool operator!=(const Map< Key, T > &m) const
TagLib::Map::erase
Map< Key, T > & erase(const Key &key)
TagLib::Map::begin
Iterator begin()
TagLib::Map::insert
Map< Key, T > & insert(const Key &key, const T &value)
TagLib::Map::find
Iterator find(const Key &key)
TagLib::Map::find
ConstIterator find(const Key &key) const
TagLib::Map::size
unsigned int size() const
TagLib::Map::contains
bool contains(const Key &key) const
TagLib::Map::end
ConstIterator end() const
TagLib::Map::operator=
Map< Key, T > & operator=(const Map< Key, T > &m)
TagLib::Map::Map
Map(std::initializer_list< std::pair< const Key, T > > init)
TagLib::Map::clear
Map< Key, T > & clear()
TagLib::Map::Map
Map()
TagLib::Map::begin
ConstIterator begin() const
TagLib::Map::operator=
Map< Key, T > & operator=(std::initializer_list< std::pair< const Key, T > > init)
TagLib::Map::detach
void detach()
TagLib::Map::end
Iterator end()
TagLib::Map::cbegin
ConstIterator cbegin() const
TagLib::Map::Map
Map(const Map< Key, T > &m)
TagLib::Map::erase
Map< Key, T > & erase(Iterator it)
TagLib
A namespace for all TagLib related classes and functions.
Definition apefile.h:41