-rw-r--r-- | qmake/include/qmap.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/qmake/include/qmap.h b/qmake/include/qmap.h index 269bd6b..4bc0a2f 100644 --- a/qmake/include/qmap.h +++ b/qmake/include/qmap.h @@ -755,129 +755,133 @@ private: void detachInternal(); friend class QDeepCopy< QMap<Key,T> >; }; template<class Key, class T> Q_INLINE_TEMPLATES QMap<Key,T>& QMap<Key,T>::operator= ( const QMap<Key,T>& m ) { m.sh->ref(); if ( sh->deref() ) delete sh; sh = m.sh; return *this; } template<class Key, class T> Q_INLINE_TEMPLATES Q_TYPENAME QMap<Key,T>::insert_pair QMap<Key,T>::insert( const Q_TYPENAME QMap<Key,T>::value_type& x ) { detach(); size_type n = size(); iterator it = sh->insertSingle( x.first ); bool inserted = FALSE; if ( n < size() ) { inserted = TRUE; it.data() = x.second; } return QPair<iterator,bool>( it, inserted ); } template<class Key, class T> Q_INLINE_TEMPLATES void QMap<Key,T>::erase( const Key& k ) { detach(); iterator it( sh->find( k ).node ); if ( it != end() ) sh->remove( it ); } template<class Key, class T> Q_INLINE_TEMPLATES Q_TYPENAME QMap<Key,T>::size_type QMap<Key,T>::count( const Key& k ) const { const_iterator it( sh->find( k ).node ); if ( it != end() ) { size_type c = 0; while ( it != end() ) { ++it; ++c; } return c; } return 0; } template<class Key, class T> Q_INLINE_TEMPLATES T& QMap<Key,T>::operator[] ( const Key& k ) { detach(); QMapNode<Key,T>* p = sh->find( k ).node; if ( p != sh->end().node ) return p->data; return insert( k, T() ).data(); } template<class Key, class T> Q_INLINE_TEMPLATES void QMap<Key,T>::clear() { if ( sh->count == 1 ) sh->clear(); else { sh->deref(); sh = new QMapPrivate<Key,T>; } } template<class Key, class T> Q_INLINE_TEMPLATES Q_TYPENAME QMap<Key,T>::iterator QMap<Key,T>::insert( const Key& key, const T& value, bool overwrite ) { detach(); size_type n = size(); iterator it = sh->insertSingle( key ); if ( overwrite || n < size() ) it.data() = value; return it; } template<class Key, class T> Q_INLINE_TEMPLATES void QMap<Key,T>::remove( const Key& k ) { detach(); iterator it( sh->find( k ).node ); if ( it != end() ) sh->remove( it ); } template<class Key, class T> Q_INLINE_TEMPLATES void QMap<Key,T>::detachInternal() { sh->deref(); sh = new QMapPrivate<Key,T>( sh ); } #ifndef QT_NO_DATASTREAM template<class Key, class T> Q_INLINE_TEMPLATES QDataStream& operator>>( QDataStream& s, QMap<Key,T>& m ) { m.clear(); Q_UINT32 c; s >> c; for( Q_UINT32 i = 0; i < c; ++i ) { Key k; T t; s >> k >> t; m.insert( k, t ); if ( s.atEnd() ) break; } return s; } template<class Key, class T> Q_INLINE_TEMPLATES QDataStream& operator<<( QDataStream& s, const QMap<Key,T>& m ) { s << (Q_UINT32)m.size(); QMapConstIterator<Key,T> it = m.begin(); for( ; it != m.end(); ++it ) s << it.key() << it.data(); return s; } #endif +#ifdef QT_QWINEXPORT +#define Q_DEFINED_QMAP +#include "qwinexport.h" +#endif /* QT_QWINEXPORT */ #endif // QMAP_H |