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

#include <qasciidict.h>

Inheritance diagram for QAsciiDict< type >:
QGDict QCollection

Public Member Functions

 QAsciiDict (int size=17, bool caseSensitive=TRUE, bool copyKeys=TRUE)
 
 QAsciiDict (const QAsciiDict< type > &d)
 
 ~QAsciiDict ()
 
QAsciiDict< type > & operator= (const QAsciiDict< type > &d)
 
uint count () const
 
uint size () const
 
bool isEmpty () const
 
void insert (const char *k, const type *d)
 
void replace (const char *k, const type *d)
 
bool remove (const char *k)
 
typetake (const char *k)
 
typefind (const char *k) const
 
typeoperator[] (const char *k) const
 
void clear ()
 
void resize (uint n)
 
void statistics () const
 
- Public Member Functions inherited from QGDict
uint count () const
 
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 (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 clear ()
 
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 QAsciiDict< type >

Definition at line 46 of file qasciidict.h.

Constructor & Destructor Documentation

template<class type>
QAsciiDict< type >::QAsciiDict ( int  size = 17,
bool  caseSensitive = TRUE,
bool  copyKeys = TRUE 
)
inline

Definition at line 49 of file qasciidict.h.

50  : QGDict(size,AsciiKey,caseSensitive,copyKeys) {}
uint size() const
Definition: qasciidict.h:56
QGDict(uint len, KeyType kt, bool cs, bool ck)
Definition: qgdict.cpp:222
template<class type>
QAsciiDict< type >::QAsciiDict ( const QAsciiDict< type > &  d)
inline

Definition at line 51 of file qasciidict.h.

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

Definition at line 52 of file qasciidict.h.

52 { clear(); }
void clear()
Definition: qasciidict.h:70

Member Function Documentation

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

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

See also
setAutoDelete()

Implements QCollection.

Definition at line 70 of file qasciidict.h.

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

Returns the number of objects in the collection.

Implements QCollection.

Definition at line 55 of file qasciidict.h.

55 { return QGDict::count(); }
uint count() const
Definition: qgdict.h:107
template<class type >
void QAsciiDict< 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 83 of file qasciidict.h.

84 {
85  if ( del_item ) delete (type *)d;
86 }
bool del_item
Definition: qcollection.h:67
template<>
void QAsciiDict< void >::deleteItem ( 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 78 of file qasciidict.h.

79 {
80 }
template<class type>
type* QAsciiDict< type >::find ( const char *  k) const
inline

Definition at line 65 of file qasciidict.h.

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

Definition at line 59 of file qasciidict.h.

60  { QGDict::look_ascii(k,(Item)d,1); }
QCollection::Item look_ascii(const char *key, QCollection::Item, int)
Definition: qgdict.cpp:422
void * Item
Definition: qcollection.h:60
template<class type>
bool QAsciiDict< type >::isEmpty ( ) const
inline

Definition at line 57 of file qasciidict.h.

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

Definition at line 53 of file qasciidict.h.

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

Definition at line 67 of file qasciidict.h.

68  { return (type *)((QGDict*)this)->QGDict::look_ascii(k,0,0); }
The QGDict class is an internal class for implementing QDict template classes.
Definition: qgdict.h:104
template<class type>
bool QAsciiDict< type >::remove ( const char *  k)
inline

Definition at line 63 of file qasciidict.h.

63 { return QGDict::remove_ascii(k); }
bool remove_ascii(const char *key, QCollection::Item item=0)
Definition: qgdict.cpp:747
template<class type>
void QAsciiDict< type >::replace ( const char *  k,
const type d 
)
inline

Definition at line 61 of file qasciidict.h.

62  { QGDict::look_ascii(k,(Item)d,2); }
QCollection::Item look_ascii(const char *key, QCollection::Item, int)
Definition: qgdict.cpp:422
void * Item
Definition: qcollection.h:60
template<class type>
void QAsciiDict< type >::resize ( uint  n)
inline

Definition at line 71 of file qasciidict.h.

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

Definition at line 56 of file qasciidict.h.

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

Definition at line 72 of file qasciidict.h.

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

Definition at line 64 of file qasciidict.h.

64 { return (type *)QGDict::take_ascii(k); }
QCollection::Item take_ascii(const char *key)
Definition: qgdict.cpp:804

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