src/corelib/tools/qmap.h File Reference

#include <QtCore/qatomic.h>
#include <QtCore/qiterator.h>
#include <QtCore/qlist.h>
#include <map>
#include <new>

Include dependency graph for qmap.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  QMapData
struct  QMapData::Node
class  QMap< Key, T >
 The QMap class is a template class that provides a skip-list-based dictionary. More...
struct  QMap< Key, T >::Node
struct  QMap< Key, T >::PayloadNode
class  QMap< Key, T >::iterator
 The QMap::iterator class provides an STL-style non-const iterator for QMap and QMultiMap. More...
class  QMap< Key, T >::const_iterator
 The QMap::const_iterator class provides an STL-style const iterator for QMap and QMultiMap. More...
class  QMultiMap< Key, T >
 The QMultiMap class is a convenience QMap subclass that provides multi-valued maps. More...

Functions

template<class Key>
bool qMapLessThanKey (const Key &key1, const Key &key2)
template<class Ptr>
bool qMapLessThanKey (Ptr *key1, Ptr *key2)
template<class Ptr>
bool qMapLessThanKey (const Ptr *key1, const Ptr *key2)
template<class aKey, class aT>
QDataStreamoperator>> (QDataStream &in, QMap< aKey, aT > &map)


Function Documentation

template<class aKey, class aT>
QDataStream& operator>> ( QDataStream in,
QMap< aKey, aT > &  map 
)

Definition at line 355 of file qdatastream.h.

References QMap< Key, T >::clear(), QMap< Key, T >::d, QMap< Key, T >::detach(), i, QMapData::insertInOrder, QMap< Key, T >::insertMulti(), key, n, QDataStream::Ok, QDataStream::resetStatus(), QDataStream::setStatus(), QDataStream::status(), and value.

00357 {
00358     QDataStream::Status oldStatus = in.status();
00359     in.resetStatus();
00360     map.clear();
00361 
00362     quint32 n;
00363     in >> n;
00364 
00365     map.detach();
00366 #if !defined(Q_CC_BOR)
00367     map.d->insertInOrder = true;
00368 #endif
00369     for (quint32 i = 0; i < n; ++i) {
00370         if (in.status() != QDataStream::Ok)
00371             break;
00372 
00373         aKey key;
00374         aT value;
00375         in >> key >> value;
00376         map.insertMulti(key, value);
00377     }
00378 #if !defined(Q_CC_BOR)
00379     map.d->insertInOrder = false;
00380 #endif
00381     if (in.status() != QDataStream::Ok)
00382         map.clear();
00383     if (oldStatus != QDataStream::Ok)
00384         in.setStatus(oldStatus);
00385     return in;
00386 }

Here is the call graph for this function:

template<class Ptr>
bool qMapLessThanKey ( const Ptr *  key1,
const Ptr *  key2 
) [inline]

Definition at line 94 of file qmap.h.

00095 {
00096     Q_ASSERT(sizeof(ulong) == sizeof(const Ptr *));
00097     return reinterpret_cast<ulong>(key1) < reinterpret_cast<ulong>(key2);
00098 }

template<class Ptr>
bool qMapLessThanKey ( Ptr *  key1,
Ptr *  key2 
) [inline]

Definition at line 88 of file qmap.h.

00089 {
00090     Q_ASSERT(sizeof(ulong) == sizeof(Ptr *));
00091     return reinterpret_cast<ulong>(key1) < reinterpret_cast<ulong>(key2);
00092 }

template<class Key>
bool qMapLessThanKey ( const Key &  key1,
const Key &  key2 
) [inline]

Definition at line 82 of file qmap.h.

Referenced by QMap< Key, T >::operator==().

00083 {
00084     return key1 < key2;
00085 }


Generated on Thu Mar 15 13:07:59 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1