Public Member Functions | Private Member Functions | List of all members
QIntDict< type > Class Template Reference

#include <qintdict.h>

Inheritance diagram for QIntDict< type >:
QGDict QCollection

Public Member Functions

 QIntDict (int size=17)
 
 QIntDict (const QIntDict< type > &d)
 
 ~QIntDict ()
 
QIntDict< type > & operator= (const QIntDict< type > &d)
 
uint count () const
 
uint size () const
 
bool isEmpty () const
 
void insert (long k, const type *d)
 
void replace (long k, const type *d)
 
bool remove (long k)
 
typetake (long k)
 
typefind (long k) const
 
typeoperator[] (long k) const
 
void clear ()
 
void resize (uint n)
 
void statistics () const
 
- Public Member Functions inherited from QGDict
uint size () const
 
QCollection::Item look_string (const QString &key, QCollection::Item, int)
 
QCollection::Item look_ascii (const char *key, QCollection::Item, int)
 
QCollection::Item look_int (long key, QCollection::Item, int)
 
QCollection::Item look_ptr (void *key, QCollection::Item, int)
 
QDataStreamread (QDataStream &)
 
QDataStreamwrite (QDataStream &) const
 
- Public Member Functions inherited from QCollection
bool autoDelete () const
 
void setAutoDelete (bool enable)
 

Private Member Functions

void deleteItem (Item d)
 
template<>
void deleteItem (QCollection::Item)
 

Additional Inherited Members

- Public Types inherited from QCollection
typedef void * Item
 
- Protected Types inherited from QGDict
enum  KeyType { StringKey, AsciiKey, IntKey, PtrKey }
 
- Protected Member Functions inherited from QGDict
 QGDict (uint len, KeyType kt, bool cs, bool ck)
 
 QGDict (const QGDict &)
 
 ~QGDict ()
 
QGDictoperator= (const QGDict &)
 
bool remove_string (const QString &key, QCollection::Item item=0)
 
bool remove_ascii (const char *key, QCollection::Item item=0)
 
bool remove_int (long key, QCollection::Item item=0)
 
bool remove_ptr (void *key, QCollection::Item item=0)
 
QCollection::Item take_string (const QString &key)
 
QCollection::Item take_ascii (const char *key)
 
QCollection::Item take_int (long key)
 
QCollection::Item take_ptr (void *key)
 
void resize (uint)
 
int hashKeyString (const QString &)
 
int hashKeyAscii (const char *)
 
void statistics () const
 
virtual QDataStreamread (QDataStream &, QCollection::Item &)
 
virtual QDataStreamwrite (QDataStream &, QCollection::Item) const
 
- Protected Member Functions inherited from QCollection
 QCollection ()
 
 QCollection (const QCollection &)
 
virtual ~QCollection ()
 
virtual Item newItem (Item)
 
- Protected Attributes inherited from QCollection
bool del_item
 

Detailed Description

template<class type>
class QIntDict< type >

Definition at line 46 of file qintdict.h.

Constructor & Destructor Documentation

template<class type>
QIntDict< type >::QIntDict ( int  size = 17)
inline

Definition at line 49 of file qintdict.h.

49 : QGDict(size,IntKey,0,0) {}
QGDict(uint len, KeyType kt, bool cs, bool ck)
Definition: qgdict.cpp:222
uint size() const
Definition: qintdict.h:55
template<class type>
QIntDict< type >::QIntDict ( const QIntDict< type > &  d)
inline

Definition at line 50 of file qintdict.h.

50 : QGDict(d) {}
QGDict(uint len, KeyType kt, bool cs, bool ck)
Definition: qgdict.cpp:222
template<class type>
QIntDict< type >::~QIntDict ( )
inline

Definition at line 51 of file qintdict.h.

51 { clear(); }
void clear()
Definition: qintdict.h:67

Member Function Documentation

template<class type>
void QIntDict< type >::clear ( )
inlinevirtual

Removes all objects from the collection. The objects will be deleted if auto-delete has been enabled.

See also
setAutoDelete()

Reimplemented from QGDict.

Definition at line 67 of file qintdict.h.

67 { QGDict::clear(); }
void clear()
Definition: qgdict.cpp:857
template<class type>
uint QIntDict< type >::count ( ) const
inlinevirtual

Returns the number of objects in the collection.

Reimplemented from QGDict.

Definition at line 54 of file qintdict.h.

54 { return QGDict::count(); }
uint count() const
Definition: qgdict.h:107
template<class type >
void QIntDict< type >::deleteItem ( QCollection::Item  d)
inlineprivatevirtual

Virtual function that deletes an item that is about to be removed from the collection.

The default implementation deletes d pointer if and only if auto-delete has been enabled.

This function is always reimplemented in the collection template classes.

Warning
If you reimplement this function you must also reimplement the destructor and call the virtual function clear() from your destructor. This is due to the way virtual functions and destructors work in C++: virtual functions in derived classes cannot be called from a destructor. If you do not do this your deleteItem() function will not be called when the container is destructed.
See also
newItem(), setAutoDelete()

Reimplemented from QCollection.

Definition at line 80 of file qintdict.h.

81 {
82  if ( del_item ) delete (type *)d;
83 }
bool del_item
Definition: qcollection.h:67
template<>
void QIntDict< void >::deleteItem ( QCollection::Item  d)
inlineprivatevirtual

Virtual function that deletes an item that is about to be removed from the collection.

The default implementation deletes d pointer if and only if auto-delete has been enabled.

This function is always reimplemented in the collection template classes.

Warning
If you reimplement this function you must also reimplement the destructor and call the virtual function clear() from your destructor. This is due to the way virtual functions and destructors work in C++: virtual functions in derived classes cannot be called from a destructor. If you do not do this your deleteItem() function will not be called when the container is destructed.
See also
newItem(), setAutoDelete()

Reimplemented from QCollection.

Definition at line 75 of file qintdict.h.

76 {
77 }
template<class type>
type* QIntDict< type >::find ( long  k) const
inline

Definition at line 63 of file qintdict.h.

64  { return (type *)((QGDict*)this)->QGDict::look_int(k,0,0); }
The QGDict class is an internal class for implementing QDict template classes.
Definition: qgdict.h:104
template<class type>
void QIntDict< type >::insert ( long  k,
const type d 
)
inline

Definition at line 57 of file qintdict.h.

58  { QGDict::look_int(k,(Item)d,1); }
QCollection::Item look_int(long key, QCollection::Item, int)
Definition: qgdict.cpp:461
void * Item
Definition: qcollection.h:60
template<class type>
bool QIntDict< type >::isEmpty ( ) const
inline

Definition at line 56 of file qintdict.h.

56 { return QGDict::count() == 0; }
uint count() const
Definition: qgdict.h:107
template<class type>
QIntDict<type>& QIntDict< type >::operator= ( const QIntDict< type > &  d)
inline

Definition at line 52 of file qintdict.h.

53  { return (QIntDict<type>&)QGDict::operator=(d); }
QGDict & operator=(const QGDict &)
Definition: qgdict.cpp:309
template<class type>
type* QIntDict< type >::operator[] ( long  k) const
inline

Definition at line 65 of file qintdict.h.

66  { return (type *)((QGDict*)this)->QGDict::look_int(k,0,0); }
The QGDict class is an internal class for implementing QDict template classes.
Definition: qgdict.h:104
template<class type>
bool QIntDict< type >::remove ( long  k)
inline

Definition at line 61 of file qintdict.h.

61 { return QGDict::remove_int(k); }
bool remove_int(long key, QCollection::Item item=0)
Definition: qgdict.cpp:762
template<class type>
void QIntDict< type >::replace ( long  k,
const type d 
)
inline

Definition at line 59 of file qintdict.h.

60  { QGDict::look_int(k,(Item)d,2); }
QCollection::Item look_int(long key, QCollection::Item, int)
Definition: qgdict.cpp:461
void * Item
Definition: qcollection.h:60
template<class type>
void QIntDict< type >::resize ( uint  n)
inline

Definition at line 68 of file qintdict.h.

68 { QGDict::resize(n); }
void resize(uint)
Definition: qgdict.cpp:527
std::void_t< T > n
template<class type>
uint QIntDict< type >::size ( ) const
inline

Definition at line 55 of file qintdict.h.

55 { return QGDict::size(); }
uint size() const
Definition: qgdict.h:108
template<class type>
void QIntDict< type >::statistics ( ) const
inline

Definition at line 69 of file qintdict.h.

69 { QGDict::statistics(); }
void statistics() const
Definition: qgdict.cpp:930
template<class type>
type* QIntDict< type >::take ( long  k)
inline

Definition at line 62 of file qintdict.h.

62 { return (type*)QGDict::take_int(k); }
QCollection::Item take_int(long key)
Definition: qgdict.cpp:822

The documentation for this class was generated from the following file: