Eneboo - Documentación para desarrolladores
src/qt/src/tools/qgvector.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qgvector.h   3.3.8   edited Jan 11 14:38 $
00003 **
00004 ** Definition of QGVector class
00005 **
00006 ** Created : 930907
00007 **
00008 ** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
00009 **
00010 ** This file is part of the tools module of the Qt GUI Toolkit.
00011 **
00012 ** This file may be distributed under the terms of the Q Public License
00013 ** as defined by Trolltech ASA of Norway and appearing in the file
00014 ** LICENSE.QPL included in the packaging of this file.
00015 **
00016 ** This file may be distributed and/or modified under the terms of the
00017 ** GNU General Public License version 2 as published by the Free Software
00018 ** Foundation and appearing in the file LICENSE.GPL included in the
00019 ** packaging of this file.
00020 **
00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
00022 ** licenses may use this file in accordance with the Qt Commercial License
00023 ** Agreement provided with the Software.
00024 **
00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00027 **
00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00029 **   information about Qt Commercial License Agreements.
00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00032 **
00033 ** Contact info@trolltech.com if any conditions of this licensing are
00034 ** not clear to you.
00035 **
00036 **********************************************************************/
00037 
00038 #ifndef QGVECTOR_H
00039 #define QGVECTOR_H
00040 
00041 #ifndef QT_H
00042 #include "qptrcollection.h"
00043 #endif // QT_H
00044 
00045 
00046 class Q_EXPORT QGVector : public QPtrCollection // generic vector
00047 {
00048 friend class QGList;                            // needed by QGList::toVector
00049 public:
00050 #ifndef QT_NO_DATASTREAM
00051     QDataStream &read( QDataStream & );         // read vector from stream
00052     QDataStream &write( QDataStream & ) const;  // write vector to stream
00053 #endif
00054     virtual int compareItems( Item, Item );
00055 
00056 protected:
00057     QGVector();                                 // create empty vector
00058     QGVector( uint size );                      // create vector with nullptrs
00059     QGVector( const QGVector &v );              // make copy of other vector
00060    ~QGVector();
00061 
00062     QGVector &operator=( const QGVector &v );   // assign from other vector
00063     bool operator==( const QGVector &v ) const;
00064 
00065     Item         *data()    const       { return vec; }
00066     uint  size()    const       { return len; }
00067     uint  count()   const       { return numItems; }
00068 
00069     bool  insert( uint index, Item );           // insert item at index
00070     bool  remove( uint index );                 // remove item
00071     Item          take( uint index );                   // take out item
00072 
00073     void  clear();                              // clear vector
00074     bool  resize( uint newsize );               // resize vector
00075 
00076     bool  fill( Item, int flen );               // resize and fill vector
00077 
00078     void  sort();                               // sort vector
00079     int   bsearch( Item ) const;                        // binary search (when sorted)
00080 
00081     int   findRef( Item, uint index ) const;    // find exact item in vector
00082     int   find( Item, uint index ) const;       // find equal item in vector
00083     uint  containsRef( Item ) const;            // get number of exact matches
00084     uint  contains( Item ) const;               // get number of equal matches
00085 
00086     Item          at( uint index ) const                // return indexed item
00087     {
00088 #if defined(QT_CHECK_RANGE)
00089         if ( index >= len )
00090             warningIndexRange( index );
00091 #endif
00092         return vec[index];
00093     }
00094 
00095     bool insertExpand( uint index, Item );      // insert, expand if necessary
00096 
00097     void toList( QGList * ) const;              // put items in list
00098 
00099 #ifndef QT_NO_DATASTREAM
00100     virtual QDataStream &read( QDataStream &, Item & );
00101     virtual QDataStream &write( QDataStream &, Item ) const;
00102 #endif
00103 private:
00104     Item         *vec;
00105     uint  len;
00106     uint  numItems;
00107 
00108     static void warningIndexRange( uint );
00109 };
00110 
00111 
00112 /*****************************************************************************
00113   QGVector stream functions
00114  *****************************************************************************/
00115 
00116 #ifndef QT_NO_DATASTREAM
00117 Q_EXPORT QDataStream &operator>>( QDataStream &, QGVector & );
00118 Q_EXPORT QDataStream &operator<<( QDataStream &, const QGVector & );
00119 #endif
00120 
00121 #endif // QGVECTOR_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'