Eneboo - Documentación para desarrolladores
src/qt/include/qptrvector.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qptrvector.h   3.3.8   edited Jan 11 14:38 $
00003 **
00004 ** Definition of QPtrVector pointer based template 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 QPTRVECTOR_H
00039 #define QPTRVECTOR_H
00040 
00041 #ifndef QT_H
00042 #include "qgvector.h"
00043 #endif // QT_H
00044 
00045 template<class type>
00046 class QPtrVector
00047 #ifdef Q_QDOC
00048         : public QPtrCollection
00049 #else
00050         : public QGVector
00051 #endif
00052 {
00053 public:
00054     QPtrVector()                                { }
00055     QPtrVector( uint size ) : QGVector(size) { }
00056     QPtrVector( const QPtrVector<type> &v ) : QGVector( v ) { }
00057     ~QPtrVector()                               { clear(); }
00058     QPtrVector<type> &operator=(const QPtrVector<type> &v)
00059                         { return (QPtrVector<type>&)QGVector::operator=(v); }
00060     bool operator==( const QPtrVector<type> &v ) const { return QGVector::operator==(v); }
00061     type **data()   const               { return (type **)QGVector::data(); }
00062     uint  size()    const               { return QGVector::size(); }
00063     uint  count()   const               { return QGVector::count(); }
00064     bool  isEmpty() const               { return QGVector::count() == 0; }
00065     bool  isNull()  const               { return QGVector::size() == 0; }
00066     bool  resize( uint size )           { return QGVector::resize(size); }
00067     bool  insert( uint i, const type *d){ return QGVector::insert(i,(Item)d); }
00068     bool  remove( uint i )              { return QGVector::remove(i); }
00069     type *take( uint i )                { return (type *)QGVector::take(i); }
00070     void  clear()                       { QGVector::clear(); }
00071     bool  fill( const type *d, int size=-1 )
00072                                         { return QGVector::fill((Item)d,size);}
00073     void  sort()                        { QGVector::sort(); }
00074     int   bsearch( const type *d ) const{ return QGVector::bsearch((Item)d); }
00075     int   findRef( const type *d, uint i=0 ) const
00076                                         { return QGVector::findRef((Item)d,i);}
00077     int   find( const type *d, uint i= 0 ) const
00078                                         { return QGVector::find((Item)d,i); }
00079     uint  containsRef( const type *d ) const
00080                                 { return QGVector::containsRef((Item)d); }
00081     uint  contains( const type *d ) const
00082                                         { return QGVector::contains((Item)d); }
00083     type *operator[]( int i ) const     { return (type *)QGVector::at(i); }
00084     type *at( uint i ) const            { return (type *)QGVector::at(i); }
00085     void  toList( QGList *list ) const  { QGVector::toList(list); }
00086 
00087 #ifdef Q_QDOC
00088 protected:
00089     virtual int compareItems( QPtrCollection::Item d1, QPtrCollection::Item d2 );
00090     virtual QDataStream& read( QDataStream &s, QPtrCollection::Item &d );
00091     virtual QDataStream& write( QDataStream &s, QPtrCollection::Item d ) const;
00092 #endif
00093 
00094 private:
00095     void  deleteItem( Item d );
00096 };
00097 
00098 #if !defined(Q_BROKEN_TEMPLATE_SPECIALIZATION)
00099 template<> inline void QPtrVector<void>::deleteItem( QPtrCollection::Item )
00100 {
00101 }
00102 #endif
00103 
00104 template<class type> inline void QPtrVector<type>::deleteItem( QPtrCollection::Item d )
00105 {
00106     if ( del_item ) delete (type *)d;
00107 }
00108 
00109 #ifndef QT_NO_COMPAT
00110 #define QVector QPtrVector
00111 #endif
00112 
00113 #define Q_DEFINED_QPTRVECTOR
00114 #include "qwinexport.h"
00115 #endif // QVECTOR_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'