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

#include <qvector.h>

Inheritance diagram for QVector< type >:
QGVector QCollection QStrVec QStrIVec

Public Member Functions

 QVector ()
 
 QVector (uint size)
 
 QVector (const QVector< type > &v)
 
 ~QVector ()
 
QVector< type > & operator= (const QVector< type > &v)
 
type ** data () const
 
uint size () const
 
uint count () const
 
bool isEmpty () const
 
bool isNull () const
 
bool resize (uint size)
 
bool insert (uint i, const type *d)
 
bool remove (uint i)
 
typetake (uint i)
 
void clear ()
 
bool fill (const type *d, int size=-1)
 
void sort ()
 
int bsearch (const type *d) const
 
int findRef (const type *d, uint i=0) const
 
int find (const type *d, uint i=0) const
 
uint containsRef (const type *d) const
 
uint contains (const type *d) const
 
typeoperator[] (int i) const
 
typeat (uint i) const
 
void toList (QGList *list) const
 
- Public Member Functions inherited from QGVector
QDataStreamread (QDataStream &)
 
QDataStreamwrite (QDataStream &) const
 
virtual int compareItems (Item, Item)
 
- Public Member Functions inherited from QCollection
bool autoDelete () const
 
void setAutoDelete (bool enable)
 

Private Member Functions

void deleteItem (Item d)
 

Additional Inherited Members

- Public Types inherited from QCollection
typedef void * Item
 
- Protected Member Functions inherited from QGVector
 QGVector ()
 
 QGVector (uint size)
 
 QGVector (const QGVector &v)
 
 ~QGVector ()
 
QGVectoroperator= (const QGVector &v)
 
Itemdata () const
 
uint size () const
 
bool insert (uint index, Item)
 
bool remove (uint index)
 
Item take (uint index)
 
bool resize (uint newsize)
 
bool fill (Item, int flen)
 
void sort ()
 
int bsearch (Item) const
 
int findRef (Item, uint index) const
 
int find (Item, uint index) const
 
uint containsRef (Item) const
 
uint contains (Item) const
 
Item at (uint index) const
 
bool insertExpand (uint index, Item)
 
void toList (QGList *) const
 
virtual QDataStreamread (QDataStream &, Item &)
 
virtual QDataStreamwrite (QDataStream &, 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 QVector< type >

Definition at line 46 of file qvector.h.

Constructor & Destructor Documentation

template<class type>
QVector< type >::QVector ( )
inline

Definition at line 49 of file qvector.h.

49 {}
template<class type>
QVector< type >::QVector ( uint  size)
inline

Definition at line 50 of file qvector.h.

50 : QGVector(size) {}
uint size() const
Definition: qvector.h:56
template<class type>
QVector< type >::QVector ( const QVector< type > &  v)
inline

Definition at line 51 of file qvector.h.

51 : QGVector(v) {}
template<class type>
QVector< type >::~QVector ( )
inline

Definition at line 52 of file qvector.h.

52 { clear(); }
void clear()
Definition: qvector.h:64

Member Function Documentation

template<class type>
type* QVector< type >::at ( uint  i) const
inline

Definition at line 78 of file qvector.h.

78 { return (type *)QGVector::at(i); }
Item at(uint index) const
Definition: qgvector.h:85
template<class type>
int QVector< type >::bsearch ( const type d) const
inline

Definition at line 68 of file qvector.h.

68 { return QGVector::bsearch((Item)d); }
int bsearch(Item) const
Definition: qgvector.cpp:439
void * Item
Definition: qcollection.h:60
template<class type>
void QVector< 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 QGVector.

Definition at line 64 of file qvector.h.

64 { QGVector::clear(); }
void clear()
Definition: qgvector.cpp:313
template<class type>
uint QVector< type >::contains ( const type d) const
inline

Definition at line 75 of file qvector.h.

76  { return QGVector::contains((Item)d); }
uint contains(Item) const
Definition: qgvector.cpp:536
void * Item
Definition: qcollection.h:60
template<class type>
uint QVector< type >::containsRef ( const type d) const
inline

Definition at line 73 of file qvector.h.

74  { return QGVector::containsRef((Item)d); }
uint containsRef(Item) const
Definition: qgvector.cpp:522
void * Item
Definition: qcollection.h:60
template<class type>
uint QVector< type >::count ( ) const
inlinevirtual

Returns the number of objects in the collection.

Reimplemented from QGVector.

Definition at line 57 of file qvector.h.

57 { return QGVector::count(); }
uint count() const
Definition: qgvector.h:66
template<class type>
type** QVector< type >::data ( ) const
inline

Definition at line 55 of file qvector.h.

55 { return (type **)QGVector::data(); }
Item * data() const
Definition: qgvector.h:64
template<class type>
void QVector< type >::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 81 of file qvector.h.

81 { if ( del_item ) delete (type *)d; }
bool del_item
Definition: qcollection.h:67
template<class type>
bool QVector< type >::fill ( const type d,
int  size = -1 
)
inline

Definition at line 65 of file qvector.h.

66  { return QGVector::fill((Item)d,size);}
bool fill(Item, int flen)
Definition: qgvector.cpp:377
uint size() const
Definition: qvector.h:56
void * Item
Definition: qcollection.h:60
template<class type>
int QVector< type >::find ( const type d,
uint  i = 0 
) const
inline

Definition at line 71 of file qvector.h.

72  { return QGVector::find((Item)d,i); }
int find(Item, uint index) const
Definition: qgvector.cpp:501
void * Item
Definition: qcollection.h:60
template<class type>
int QVector< type >::findRef ( const type d,
uint  i = 0 
) const
inline

Definition at line 69 of file qvector.h.

70  { return QGVector::findRef((Item)d,i);}
int findRef(Item, uint index) const
Definition: qgvector.cpp:482
void * Item
Definition: qcollection.h:60
template<class type>
bool QVector< type >::insert ( uint  i,
const type d 
)
inline

Definition at line 61 of file qvector.h.

61 { return QGVector::insert(i,(Item)d); }
bool insert(uint index, Item)
Definition: qgvector.cpp:246
void * Item
Definition: qcollection.h:60
template<class type>
bool QVector< type >::isEmpty ( ) const
inline

Definition at line 58 of file qvector.h.

58 { return QGVector::count() == 0; }
uint count() const
Definition: qgvector.h:66
template<class type>
bool QVector< type >::isNull ( ) const
inline

Definition at line 59 of file qvector.h.

59 { return QGVector::size() == 0; }
uint size() const
Definition: qgvector.h:65
template<class type>
QVector<type>& QVector< type >::operator= ( const QVector< type > &  v)
inline

Definition at line 53 of file qvector.h.

54  { return (QVector<type>&)QGVector::operator=(v); }
QGVector & operator=(const QGVector &v)
Definition: qgvector.cpp:207
template<class type>
type* QVector< type >::operator[] ( int  i) const
inline

Definition at line 77 of file qvector.h.

77 { return (type *)QGVector::at(i); }
Item at(uint index) const
Definition: qgvector.h:85
template<class type>
bool QVector< type >::remove ( uint  i)
inline

Definition at line 62 of file qvector.h.

62 { return QGVector::remove(i); }
bool remove(uint index)
Definition: qgvector.cpp:273
template<class type>
bool QVector< type >::resize ( uint  size)
inline

Definition at line 60 of file qvector.h.

60 { return QGVector::resize(size); }
bool resize(uint newsize)
Definition: qgvector.cpp:330
uint size() const
Definition: qvector.h:56
template<class type>
uint QVector< type >::size ( ) const
inline

Definition at line 56 of file qvector.h.

56 { return QGVector::size(); }
uint size() const
Definition: qgvector.h:65
template<class type>
void QVector< type >::sort ( )
inline

Definition at line 67 of file qvector.h.

67 { QGVector::sort(); }
void sort()
Definition: qgvector.cpp:410
template<class type>
type* QVector< type >::take ( uint  i)
inline

Definition at line 63 of file qvector.h.

63 { return (type *)QGVector::take(i); }
Item take(uint index)
Definition: qgvector.cpp:293
template<class type>
void QVector< type >::toList ( QGList list) const
inline

Definition at line 79 of file qvector.h.

79 { QGVector::toList(list); }
void toList(QGList *) const
Definition: qgvector.cpp:568

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