Commit b69ba35a authored by mk's avatar mk

update 1.8.10

parent d11f894a
include_directories(.)
list(APPEND qtools_src
qbuffer.cpp
qcollection.cpp
qcstring.cpp
qdatastream.cpp
qdatetime.cpp
qdir.cpp
qfile.cpp
qfileinfo.cpp
qgarray.cpp
qgcache.cpp
qgdict.cpp
qglist.cpp
qglobal.cpp
qgstring.cpp
qgvector.cpp
qiodevice.cpp
qregexp.cpp
qstring.cpp
qtextstream.cpp
qtextcodec.cpp
qstringlist.cpp
qxml.cpp
qmap.cpp
qthread.cpp
qmutex.cpp
qutfcodec.cpp
)
if (UNIX)
list(APPEND qtools_src
qfile_unix.cpp
qdir_unix.cpp
qfileinfo_unix.cpp
qthread_unix.cpp
qmutex_unix.cpp
qwaitcondition_unix.cpp
)
endif()
if (WIN32)
list(APPEND qtools_src
qfile_win32.cpp
qdir_win32.cpp
qfileinfo_win32.cpp
qthread_win32.cpp
qmutex_win32.cpp
qwaitcondition_win32.cpp
)
endif()
add_library(qtools
${qtools_src}
)
This diff is collapsed.
This diff is collapsed.
THE Q PUBLIC LICENSE
version 1.0
Copyright (C) 1999-2000 Trolltech AS, Norway.
Everyone is permitted to copy and
distribute this license document.
The intent of this license is to establish freedom to share and change the
software regulated by this license under the open source model.
This license applies to any software containing a notice placed by the
copyright holder saying that it may be distributed under the terms of
the Q Public License version 1.0. Such software is herein referred to as
the Software. This license covers modification and distribution of the
Software, use of third-party application programs based on the Software,
and development of free software which uses the Software.
Granted Rights
1. You are granted the non-exclusive rights set forth in this license
provided you agree to and comply with any and all conditions in this
license. Whole or partial distribution of the Software, or software
items that link with the Software, in any form signifies acceptance of
this license.
2. You may copy and distribute the Software in unmodified form provided
that the entire package, including - but not restricted to - copyright,
trademark notices and disclaimers, as released by the initial developer
of the Software, is distributed.
3. You may make modifications to the Software and distribute your
modifications, in a form that is separate from the Software, such as
patches. The following restrictions apply to modifications:
a. Modifications must not alter or remove any copyright notices in
the Software.
b. When modifications to the Software are released under this
license, a non-exclusive royalty-free right is granted to the
initial developer of the Software to distribute your modification
in future versions of the Software provided such versions remain
available under these terms in addition to any other license(s) of
the initial developer.
4. You may distribute machine-executable forms of the Software or
machine-executable forms of modified versions of the Software, provided
that you meet these restrictions:
a. You must include this license document in the distribution.
b. You must ensure that all recipients of the machine-executable forms
are also able to receive the complete machine-readable source code
to the distributed Software, including all modifications, without
any charge beyond the costs of data transfer, and place prominent
notices in the distribution explaining this.
c. You must ensure that all modifications included in the
machine-executable forms are available under the terms of this
license.
5. You may use the original or modified versions of the Software to
compile, link and run application programs legally developed by you
or by others.
6. You may develop application programs, reusable components and other
software items that link with the original or modified versions of the
Software. These items, when distributed, are subject to the following
requirements:
a. You must ensure that all recipients of machine-executable forms of
these items are also able to receive and use the complete
machine-readable source code to the items without any charge
beyond the costs of data transfer.
b. You must explicitly license all recipients of your items to use
and re-distribute original and modified versions of the items in
both machine-executable and source code forms. The recipients must
be able to do so without any charges whatsoever, and they must be
able to re-distribute to anyone they choose.
c. If the items are not available to the general public, and the
initial developer of the Software requests a copy of the items,
then you must supply one.
Limitations of Liability
In no event shall the initial developers or copyright holders be liable
for any damages whatsoever, including - but not restricted to - lost
revenue or profits or other direct, indirect, special, incidental or
consequential damages, even if they have been advised of the possibility
of such damages, except to the extent invariable law, if any, provides
otherwise.
No Warranty
The Software and this license document are provided AS IS with NO WARRANTY
OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE.
Choice of Law
This license is governed by the Laws of Norway. Disputes shall be settled
by Oslo City Court.
#
#
#
# Copyright (C) 1997-2000 by Dimitri van Heesch.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation under the terms of the GNU General Public License is hereby
# granted. No representations are made about the suitability of this software
# for any purpose. It is provided "as is" without express or implied warranty.
# See the GNU General Public License for more details.
#
# Documents produced by Doxygen are derivative works derived from the
# input used in their production; they are not affected by this license.
#
all: Makefile.qtools Makefile
$(MAKE) -f Makefile.qtools $@
Makefile.qtools: qtools.pro
$(ENV) $(PERL) "$(TMAKE)" qtools.pro >Makefile.qtools
tmake:
$(ENV) $(PERL) "$(TMAKE)" qtools.pro >Makefile.qtools
clean: Makefile.qtools
$(MAKE) -f Makefile.qtools clean
distclean: clean
$(RM) Makefile.qtools
FORCE:
This directory contains a small subset of Troll-Tech's Qt library
The subset is enough to build the doxygen executable, but lacks many of
the features found in the Qt library. See http://www.trolltech.com
for the full package.
This diff is collapsed.
/****************************************************************************
**
**
** Definition of QArray template/macro class
**
** Created : 930906
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of the tools module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef QARRAY_H
#define QARRAY_H
#ifndef QT_H
#include "qgarray.h"
#endif // QT_H
template<class type> class Q_EXPORT QArray : public QGArray
{
public:
typedef type* Iterator;
typedef const type* ConstIterator;
typedef type ValueType;
protected:
QArray( int, int ) : QGArray( 0, 0 ) {}
public:
QArray() {}
QArray( int size ) : QGArray(size*(int)sizeof(type)) {}
QArray( const QArray<type> &a ) : QGArray(a) {}
~QArray() {}
QArray<type> &operator=(const QArray<type> &a)
{ return (QArray<type>&)QGArray::assign(a); }
type *data() const { return (type *)QGArray::data(); }
uint nrefs() const { return QGArray::nrefs(); }
uint size() const { return QGArray::size()/(int)sizeof(type); }
uint count() const { return size(); }
bool isEmpty() const { return QGArray::size() == 0; }
bool isNull() const { return QGArray::data() == 0; }
bool resize( uint size ) { return QGArray::resize(size*(int)sizeof(type)); }
bool truncate( uint pos ) { return QGArray::resize(pos*(int)sizeof(type)); }
bool fill( const type &d, int size = -1 )
{ return QGArray::fill((char*)&d,size,sizeof(type) ); }
void detach() { QGArray::detach(); }
QArray<type> copy() const
{ QArray<type> tmp; return tmp.duplicate(*this); }
QArray<type>& assign( const QArray<type>& a )
{ return (QArray<type>&)QGArray::assign(a); }
QArray<type>& assign( const type *a, uint n )
{ return (QArray<type>&)QGArray::assign((char*)a,n*sizeof(type)); }
QArray<type>& duplicate( const QArray<type>& a )
{ return (QArray<type>&)QGArray::duplicate(a); }
QArray<type>& duplicate( const type *a, uint n )
{ return (QArray<type>&)QGArray::duplicate((char*)a,n*sizeof(type)); }
QArray<type>& setRawData( const type *a, uint n )
{ return (QArray<type>&)QGArray::setRawData((char*)a,
n*sizeof(type)); }
void resetRawData( const type *a, uint n )
{ QGArray::resetRawData((char*)a,n*sizeof(type)); }
int find( const type &d, uint i=0 ) const
{ return QGArray::find((char*)&d,i,sizeof(type)); }
int contains( const type &d ) const
{ return QGArray::contains((char*)&d,sizeof(type)); }
void sort() { QGArray::sort(sizeof(type)); }
int bsearch( const type &d ) const
{ return QGArray::bsearch((const char*)&d,sizeof(type)); }
type& operator[]( int i ) const
{ return (type &)(*(type *)QGArray::at(i*(int)sizeof(type))); }
type& at( uint i ) const
{ return (type &)(*(type *)QGArray::at(i*(int)sizeof(type))); }
operator const type*() const { return (const type *)QGArray::data(); }
bool operator==( const QArray<type> &a ) const { return isEqual(a); }
bool operator!=( const QArray<type> &a ) const { return !isEqual(a); }
Iterator begin() { return data(); }
Iterator end() { return data() + size(); }
ConstIterator begin() const { return data(); }
ConstIterator end() const { return data() + size(); }
};
#endif // QARRAY_H
/****************************************************************************
**
**
** Definition of QAsciiDict template class
**
** Created : 920821
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of the tools module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef QASCIIDICT_H
#define QASCIIDICT_H
#ifndef QT_H
#include "qgdict.h"
#endif // QT_H
template<class type> class Q_EXPORT QAsciiDict : public QGDict
{
public:
QAsciiDict(int size=17, bool caseSensitive=TRUE, bool copyKeys=TRUE )
: QGDict(size,AsciiKey,caseSensitive,copyKeys) {}
QAsciiDict( const QAsciiDict<type> &d ) : QGDict(d) {}
~QAsciiDict() { clear(); }
QAsciiDict<type> &operator=(const QAsciiDict<type> &d)
{ return (QAsciiDict<type>&)QGDict::operator=(d); }
uint count() const { return QGDict::count(); }
uint size() const { return QGDict::size(); }
bool isEmpty() const { return QGDict::count() == 0; }
void insert( const char *k, const type *d )
{ QGDict::look_ascii(k,(Item)d,1); }
void replace( const char *k, const type *d )
{ QGDict::look_ascii(k,(Item)d,2); }
bool remove( const char *k ) { return QGDict::remove_ascii(k); }
type *take( const char *k ) { return (type *)QGDict::take_ascii(k); }
type *find( const char *k ) const
{ return (type *)((QGDict*)this)->QGDict::look_ascii(k,0,0); }
type *operator[]( const char *k ) const
{ return (type *)((QGDict*)this)->QGDict::look_ascii(k,0,0); }
void clear() { QGDict::clear(); }
void resize( uint n ) { QGDict::resize(n); }
void statistics() const { QGDict::statistics(); }
private:
void deleteItem( Item d );
};
#if defined(Q_DELETING_VOID_UNDEFINED)
template<> inline void QAsciiDict<void>::deleteItem( Item )
{
}
#endif
template<class type> inline void QAsciiDict<type>::deleteItem( QCollection::Item d )
{
if ( del_item ) delete (type *)d;
}
template<class type> class Q_EXPORT QAsciiDictIterator : public QGDictIterator
{
public:
QAsciiDictIterator(const QAsciiDict<type> &d)
: QGDictIterator((QGDict &)d) {}
~QAsciiDictIterator() {}
uint count() const { return dict->count(); }
bool isEmpty() const { return dict->count() == 0; }
type *toFirst() { return (type *)QGDictIterator::toFirst(); }
operator type *() const { return (type *)QGDictIterator::get(); }
type *current() const { return (type *)QGDictIterator::get(); }
const char *currentKey() const { return QGDictIterator::getKeyAscii(); }
type *operator()() { return (type *)QGDictIterator::operator()(); }
type *operator++() { return (type *)QGDictIterator::operator++(); }
type *operator+=(uint j) { return (type *)QGDictIterator::operator+=(j);}
};
#endif // QASCIIDICT_H
This diff is collapsed.
/****************************************************************************
**
**
** Definition of QBuffer class
**
** Created : 930812
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of the tools module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef QBUFFER_H
#define QBUFFER_H
#ifndef QT_H
#include "qiodevice.h"
#include "qstring.h"
#endif // QT_H
class Q_EXPORT QBuffer : public QIODevice
{
public:
QBuffer();
QBuffer( QByteArray );
~QBuffer();
QByteArray buffer() const;
bool setBuffer( QByteArray );
bool open( int );
void close();
void flush();
uint size() const;
int at() const;
bool at( int );
int readBlock( char *p, uint );
int writeBlock( const char *p, uint );
int readLine( char *p, uint );
int getch();
int putch( int );
int ungetch( int );
protected:
QByteArray a;
private:
uint a_len;
uint a_inc;
private: // Disabled copy constructor and operator=
#if defined(Q_DISABLE_COPY)
QBuffer( const QBuffer & );
QBuffer &operator=( const QBuffer & );
#endif
};
inline QByteArray QBuffer::buffer() const
{ return a; }
inline uint QBuffer::size() const
{ return a.size(); }
inline int QBuffer::at() const
{ return ioIndex; }
#endif // QBUFFER_H
/****************************************************************************
**
**
** Definition of QCache template class
**
** Created : 950209
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of the tools module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef QCACHE_H
#define QCACHE_H
#ifndef QT_H
#include "qgcache.h"
#endif // QT_H
#define USE_ASCII_STRING
#ifndef USE_ASCII_STRING
template<class type> class Q_EXPORT QCache : public QGCache
{
public:
QCache( const QCache<type> &c ) : QGCache(c) {}
QCache( int maxCost=100, int size=17, bool caseSensitive=TRUE )
: QGCache( maxCost, size, StringKey, caseSensitive, FALSE ) {}
~QCache() { clear(); }
QCache<type> &operator=( const QCache<type> &c )
{ return (QCache<type>&)QGCache::operator=(c); }
int maxCost() const { return QGCache::maxCost(); }
int totalCost() const { return QGCache::totalCost(); }
void setMaxCost( int m ) { QGCache::setMaxCost(m); }
uint count() const { return QGCache::count(); }
uint size() const { return QGCache::size(); }
bool isEmpty() const { return QGCache::count() == 0; }
void clear() { QGCache::clear(); }
bool insert( const QString &k, const type *d, int c=1, int p=0 )
{ return QGCache::insert_string(k,(Item)d,c,p);}
bool remove( const QString &k )
{ return QGCache::remove_string(k); }
type *take( const QString &k )
{ return (type *)QGCache::take_string(k); }
type *find( const QString &k, bool ref=TRUE ) const
{ return (type *)QGCache::find_string(k,ref);}
type *operator[]( const QString &k ) const
{ return (type *)QGCache::find_string(k);}
void statistics() const { QGCache::statistics(); }
int hits() const { return QGCache::hits(); }
int misses() const { return QGCache::misses(); }
private:
void deleteItem( Item d ) { if ( del_item ) delete (type *)d; }
};
#else
template<class type> class Q_EXPORT QCache : public QGCache
{
public:
QCache( const QCache<type> &c ) : QGCache(c) {}
QCache( int maxCost=100, int size=17, bool caseSensitive=TRUE )
: QGCache( maxCost, size, AsciiKey, caseSensitive, TRUE ) {}
~QCache() { clear(); }
QCache<type> &operator=( const QCache<type> &c )
{ return (QCache<type>&)QGCache::operator=(c); }
int maxCost() const { return QGCache::maxCost(); }
int totalCost() const { return QGCache::totalCost(); }
void setMaxCost( int m ) { QGCache::setMaxCost(m); }
uint count() const { return QGCache::count(); }
uint size() const { return QGCache::size(); }
bool isEmpty() const { return QGCache::count() == 0; }
void clear() { QGCache::clear(); }
bool insert( const char *k, const type *d, int c=1, int p=0 )
{ return QGCache::insert_other(k,(Item)d,c,p);}
bool remove( const char *k )
{ return QGCache::remove_other(k); }
type *take( const char *k )
{ return (type *)QGCache::take_other(k); }
type *find( const char *k, bool ref=TRUE ) const
{ return (type *)QGCache::find_other(k,ref);}
type *operator[]( const char *k ) const
{ return (type *)QGCache::find_other(k);}
void statistics() const { QGCache::statistics(); }
int hits() const { return QGCache::hits(); }
int misses() const { return QGCache::misses(); }
private:
void deleteItem( Item d ) { if ( del_item ) delete (type *)d; }
};
#endif
template<class type> class Q_EXPORT QCacheIterator : public QGCacheIterator
{
public:
QCacheIterator( const QCache<type> &c ):QGCacheIterator((QGCache &)c) {}
QCacheIterator( const QCacheIterator<type> &ci)
: QGCacheIterator( (QGCacheIterator &)ci ) {}
QCacheIterator<type> &operator=(const QCacheIterator<type>&ci)
{ return ( QCacheIterator<type>&)QGCacheIterator::operator=( ci ); }
uint count() const { return QGCacheIterator::count(); }
bool isEmpty() const { return QGCacheIterator::count() == 0; }
bool atFirst() const { return QGCacheIterator::atFirst(); }
bool atLast() const { return QGCacheIterator::atLast(); }
type *toFirst() { return (type *)QGCacheIterator::toFirst(); }
type *toLast() { return (type *)QGCacheIterator::toLast(); }
operator type *() const { return (type *)QGCacheIterator::get(); }
type *current() const { return (type *)QGCacheIterator::get(); }
#ifndef USE_ASCII_STRING
QString currentKey() const{ return QGCacheIterator::getKeyString(); }
#else
const char *currentKey() const{ return QGCacheIterator::getKeyAscii(); }
#endif
type *operator()() { return (type *)QGCacheIterator::operator()();}
type *operator++() { return (type *)QGCacheIterator::operator++(); }
type *operator+=(uint j) { return (type *)QGCacheIterator::operator+=(j);}
type *operator--() { return (type *)QGCacheIterator::operator--(); }
type *operator-=(uint j) { return (type *)QGCacheIterator::operator-=(j);}
};
#endif // QCACHE_H
/****************************************************************************
**
**
** Implementation of base class for all collection classes
**
** Created : 920820
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of the tools module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "qcollection.h"
// NOT REVISED
/*!
\class QCollection qcollection.h
\brief The QCollection class is the base class of all Qt collections.
\ingroup collection
\ingroup tools
The QCollection class is an abstract base class for the Qt \link
collection.html collection classes\endlink QDict, QList etc. via QGDict,
QGList etc.
A QCollection knows only about the number of objects in the
collection and the deletion strategy (see setAutoDelete()).
A collection is implemented using the \c Item (generic collection
item) type, which is a \c void*. The template classes that create
the real collections cast the \c Item to the required type.
\sa \link collection.html Collection Classes\endlink
*/
/*! \enum QCollection::Item
This type is the generic "item" in a QCollection.
*/
/*!
\fn QCollection::QCollection()
Constructs a collection. The constructor is protected because
QCollection is an abstract class.
*/
/*!
\fn QCollection::QCollection( const QCollection & source )
Constructs a copy of \a source with autoDelete() set to FALSE. The
constructor is protected because QCollection is an abstract class.
Note that if \a source has autoDelete turned on, copying it is a
good way to get memory leaks, reading freed memory, or both.
*/
/*!
\fn QCollection::~QCollection()
Destroys the collection. The destructor is protected because QCollection
is an abstract class.
*/
/*!
\fn bool QCollection::autoDelete() const
Returns the setting of the auto-delete option (default is FALSE).
\sa setAutoDelete()
*/
/*!
\fn void QCollection::setAutoDelete( bool enable )
Sets the auto-delete option of the collection.
Enabling auto-delete (\e enable is TRUE) will delete objects that
are removed from the collection. This can be useful if the
collection has the only reference to the objects. (Note that the
object can still be copied using the copy constructor - copying such
objects is a good way to get memory leaks, reading freed memory or
both.)
Disabling auto-delete (\e enable is FALSE) will \e not delete objects
that are removed from the collection. This is useful if the objects
are part of many collections.
The default setting is FALSE.
\sa autoDelete()
*/
/*!
\fn virtual uint QCollection::count() const
Returns the number of objects in the collection.
*/
/*!
\fn virtual void QCollection::clear()
Removes all objects from the collection. The objects will be deleted
if auto-delete has been enabled.
\sa setAutoDelete()
*/
/*!
Virtual function that creates a copy of an object that is about to
be inserted into the collection.
The default implementation returns the \e d pointer, i.e. no copy
is made.
This function is seldom reimplemented in the collection template
classes. It is not common practice to make a copy of something
that is being inserted.
\sa deleteItem()
*/
QCollection::Item QCollection::newItem( Item d )
{
return d; // just return reference
}
/*!
Virtual function that deletes an item that is about to be removed from
the collection.
The default implementation deletes \e 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.
\sa newItem(), setAutoDelete()
*/
void QCollection::deleteItem( Item d )
{
if ( del_item )
#if defined(Q_DELETING_VOID_UNDEFINED)
delete (char *)d; // default operation
#else
delete d; // default operation
#endif
}
/****************************************************************************
**
**
** Definition of base class for all collection classes
**
** Created : 920629
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of the tools module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef QCOLLECTION_H
#define QCOLLECTION_H
#ifndef QT_H
#include "qglobal.h"
#endif // QT_H
class QGVector;
class QGList;
class QGDict;
class Q_EXPORT QCollection // inherited by all collections
{
public:
bool autoDelete() const { return del_item; }
void setAutoDelete( bool enable ) { del_item = enable; }
virtual uint count() const = 0;
virtual void clear() = 0; // delete all objects
typedef void *Item; // generic collection item
protected:
QCollection() { del_item = FALSE; } // no deletion of objects
QCollection(const QCollection &) { del_item = FALSE; }
virtual ~QCollection() {}
bool del_item; // default FALSE
virtual Item newItem( Item ); // create object
virtual void deleteItem( Item ); // delete object
};
#endif // QCOLLECTION_H
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/****************************************************************************
**
**
** Macros for pasting tokens; utilized by our generic classes
**
** Created : 920529
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of the tools module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef QGENERIC_H
#define QGENERIC_H
#error "do not include qgeneric.h any more"
#endif // QGENERIC_H
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment