tmap.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     copyright            : (C) 2003 by Scott Wheeler
00003     email                : wheeler@kde.org
00004  ***************************************************************************/
00005 
00006 /***************************************************************************
00007  *   This library is free software; you can redistribute it and/or modify  *
00008  *   it  under the terms of the GNU Lesser General Public License version  *
00009  *   2.1 as published by the Free Software Foundation.                     *
00010  *                                                                         *
00011  *   This library is distributed in the hope that it will be useful, but   *
00012  *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00014  *   Lesser General Public License for more details.                       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with this library; if not, write to the Free Software   *
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
00019  *   USA                                                                   *
00020  ***************************************************************************/
00021 
00022 #ifndef TAGLIB_MAP_H
00023 #define TAGLIB_MAP_H
00024 
00025 #include "taglib.h"
00026 
00027 #include <map>
00028 
00029 namespace TagLib {
00030 
00032 
00039   template <class Key, class T> class Map
00040   {
00041   public:
00042 #ifndef DO_NOT_DOCUMENT
00043     typedef typename std::map<Key, T>::iterator Iterator;
00044     typedef typename std::map<Key, T>::const_iterator ConstIterator;
00045 #endif
00046 
00050     Map();
00051 
00057     Map(const Map<Key, T> &m);
00058 
00062     virtual ~Map();
00063 
00068     Iterator begin();
00069 
00074     ConstIterator begin() const;
00075 
00080     Iterator end();
00081 
00086     ConstIterator end() const;
00087 
00092     void insert(const Key &key, const T &value);
00093 
00098     void clear();
00099 
00105     uint size() const;
00106 
00112     bool isEmpty() const;
00113 
00117     Iterator find(const Key &key);
00118 
00122     ConstIterator find(const Key &key) const;
00123 
00127     bool contains(const Key &key) const;
00128 
00132     void erase(Iterator it);
00133 
00139     const T &operator[](const Key &key) const;
00140 
00146     T &operator[](const Key &key);
00147 
00153     Map<Key, T> &operator=(const Map<Key, T> &m);
00154 
00155   protected:
00156     /*
00157      * If this List is being shared via implicit sharing, do a deep copy of the
00158      * data and separate from the shared members.  This should be called by all
00159      * non-const subclass members.
00160      */
00161     void detach();
00162 
00163   private:
00164 #ifndef DO_NOT_DOCUMENT
00165     template <class KeyP, class TP> class MapPrivate;
00166     MapPrivate<Key, T> *d;
00167 #endif
00168   };
00169 
00170 }
00171 
00172 // Since GCC doesn't support the "export" keyword, we have to include the
00173 // implementation.
00174 
00175 #include "tmap.tcc"
00176 
00177 #endif