| TagLib 1.13 |  |

tmap.h
Go to the documentation of this file.
1/***************************************************************************
2 copyright : (C) 2002 - 2008 by Scott Wheeler
3 email : wheeler@kde.org
4 ***************************************************************************/
5
6/***************************************************************************
7 * This library is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU Lesser General Public License version *
9 * 2.1 as published by the Free Software Foundation. *
10 * *
11 * This library is distributed in the hope that it will be useful, but *
12 * WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14 * Lesser General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Lesser General Public *
17 * License along with this library; if not, write to the Free Software *
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
19 * 02110-1301 USA *
20 * *
21 * Alternatively, this file is available under the Mozilla Public *
22 * License Version 1.1. You may obtain a copy of the License at *
23 * http://www.mozilla.org/MPL/ *
24 ***************************************************************************/
25
26#ifndef TAGLIB_MAP_H
27#define TAGLIB_MAP_H
28
29#include <map>
30
31#include "taglib.h"
32
33 namespace TagLib {
34
36
43 template <class Key, class T> class Map
44 {
45 public:
46#ifndef DO_NOT_DOCUMENT
47#ifdef WANT_CLASS_INSTANTIATION_OF_MAP
48 // Some STL implementations get snippy over the use of the
49 // class keyword to distinguish different templates; Sun Studio
50 // in particular finds multiple specializations in certain rare
51 // cases and complains about that. GCC doesn't seem to mind,
52 // and uses the typedefs further below without the class keyword.
53 // Not all the specializations of Map can use the class keyword
54 // (when T is not actually a class type), so don't apply this
55 // generally.
56 typedef typename std::map<class Key, class T>::iterator Iterator;
57 typedef typename std::map<class Key, class T>::const_iterator ConstIterator;
58#else
59 typedef typename std::map<Key, T>::iterator Iterator;
60 typedef typename std::map<Key, T>::const_iterator ConstIterator;
61#endif
62#endif
63
67 Map();
68
74 Map(const Map<Key, T> &m);
75
79 virtual ~Map();
80
85 Iterator begin();
86
91 ConstIterator begin() const;
92
97 Iterator end();
98
103 ConstIterator end() const;
104
109 Map<Key, T> &insert(const Key &key, const T &value);
110
115 Map<Key, T> &clear();
116
122 unsigned int size() const;
123
129 bool isEmpty() const;
130
134 Iterator find(const Key &key);
135
139 ConstIterator find(const Key &key) const;
140
144 bool contains(const Key &key) const;
145
149 Map<Key, T> &erase(Iterator it);
150
154 Map<Key, T> &erase(const Key &key);
155
162 const T value(const Key &key, const T &defaultValue = T()) const;
163
169 const T &operator[](const Key &key) const;
170
176 T &operator[](const Key &key);
177
183 Map<Key, T> &operator=(const Map<Key, T> &m);
184
188 void swap(Map<Key, T> &m);
189
190 protected:
191 /*
192 * If this List is being shared via implicit sharing, do a deep copy of the
193 * data and separate from the shared members. This should be called by all
194 * non-const subclass members.
195 */
196 void detach();
197
198 private:
199#ifndef DO_NOT_DOCUMENT
200 template <class KeyP, class TP> class MapPrivate;
201 MapPrivate<Key, T> *d;
202#endif
203 };
204
205}
206
207// Since GCC doesn't support the "export" keyword, we have to include the
208// implementation.
209
210#include "tmap.tcc"
211
212#endif
TagLib::Map
A generic, implicitly shared map.
Definition: tmap.h:44
TagLib::Map::isEmpty
bool isEmpty() const
TagLib::Map::operator[]
T & operator[](const Key &key)
TagLib::Map::operator[]
const T & operator[](const Key &key) const
TagLib::Map::value
const T value(const Key &key, const T &defaultValue=T()) 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::clear
Map< Key, T > & clear()
TagLib::Map::Map
Map()
TagLib::Map::~Map
virtual ~Map()
TagLib::Map::begin
ConstIterator begin() const
TagLib::Map::detach
void detach()
TagLib::Map::swap
void swap(Map< Key, T > &m)
TagLib::Map::end
Iterator end()
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
taglib.h