Blame qtools/qstrvec.h

Packit Service 50c9f2
/****************************************************************************
Packit Service 50c9f2
** 
Packit Service 50c9f2
**
Packit Service 50c9f2
** Definition of QStrVec and QStrIVec classes
Packit Service 50c9f2
**
Packit Service 50c9f2
** Created : 931203
Packit Service 50c9f2
**
Packit Service 50c9f2
** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
Packit Service 50c9f2
**
Packit Service 50c9f2
** This file is part of the tools module of the Qt GUI Toolkit.
Packit Service 50c9f2
**
Packit Service 50c9f2
** This file may be distributed under the terms of the Q Public License
Packit Service 50c9f2
** as defined by Trolltech AS of Norway and appearing in the file
Packit Service 50c9f2
** LICENSE.QPL included in the packaging of this file.
Packit Service 50c9f2
**
Packit Service 50c9f2
** This file may be distributed and/or modified under the terms of the
Packit Service 50c9f2
** GNU General Public License version 2 as published by the Free Software
Packit Service 50c9f2
** Foundation and appearing in the file LICENSE.GPL included in the
Packit Service 50c9f2
** packaging of this file.
Packit Service 50c9f2
**
Packit Service 50c9f2
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
Packit Service 50c9f2
** licenses may use this file in accordance with the Qt Commercial License
Packit Service 50c9f2
** Agreement provided with the Software.
Packit Service 50c9f2
**
Packit Service 50c9f2
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
Packit Service 50c9f2
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Packit Service 50c9f2
**
Packit Service 50c9f2
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
Packit Service 50c9f2
**   information about Qt Commercial License Agreements.
Packit Service 50c9f2
** See http://www.trolltech.com/qpl/ for QPL licensing information.
Packit Service 50c9f2
** See http://www.trolltech.com/gpl/ for GPL licensing information.
Packit Service 50c9f2
**
Packit Service 50c9f2
** Contact info@trolltech.com if any conditions of this licensing are
Packit Service 50c9f2
** not clear to you.
Packit Service 50c9f2
**
Packit Service 50c9f2
**********************************************************************/
Packit Service 50c9f2
Packit Service 50c9f2
#ifndef QSTRVEC_H
Packit Service 50c9f2
#define QSTRVEC_H
Packit Service 50c9f2
Packit Service 50c9f2
#ifndef QT_H
Packit Service 50c9f2
#include "qstring.h"
Packit Service 50c9f2
#include "qvector.h"
Packit Service 50c9f2
#include "qdatastream.h"
Packit Service 50c9f2
#endif // QT_H
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
#if defined(Q_TEMPLATEDLL)
Packit Service 50c9f2
template class Q_EXPORT QVector<char>
Packit Service 50c9f2
#endif
Packit Service 50c9f2
Packit Service 50c9f2
typedef QVector<char> QStrVecBase;
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
class Q_EXPORT QStrVec : public QStrVecBase
Packit Service 50c9f2
{
Packit Service 50c9f2
public:
Packit Service 50c9f2
    QStrVec()  { dc = TRUE; }
Packit Service 50c9f2
    QStrVec( uint size, bool deepc = TRUE ) : QStrVecBase(size) {dc=deepc;}
Packit Service 50c9f2
   ~QStrVec()  { clear(); }
Packit Service 50c9f2
private:
Packit Service 50c9f2
    Item	 newItem( Item d )	{ return dc ? qstrdup( (const char*)d ) : d; }
Packit Service 50c9f2
    void deleteItem( Item d )	{ if ( dc ) delete[] (char*)d; }
Packit Service 50c9f2
    int	 compareItems( Item s1, Item s2 )
Packit Service 50c9f2
				{ return qstrcmp((const char*)s1,
Packit Service 50c9f2
						(const char*)s2); }
Packit Service 50c9f2
#ifndef QT_NO_DATASTREAM
Packit Service 50c9f2
    QDataStream &read( QDataStream &s, Item &d )
Packit Service 50c9f2
				{ s >> (char *&);; return s; }
Packit Service 50c9f2
    QDataStream &write( QDataStream &s, Item d ) const
Packit Service 50c9f2
				{ return s << (const char*)d; }
Packit Service 50c9f2
#endif
Packit Service 50c9f2
    bool dc;
Packit Service 50c9f2
};
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
class Q_EXPORT QStrIVec : public QStrVec	// case insensitive string vec
Packit Service 50c9f2
{
Packit Service 50c9f2
public:
Packit Service 50c9f2
    QStrIVec() {}
Packit Service 50c9f2
    QStrIVec( uint size, bool dc = TRUE ) : QStrVec( size, dc ) {}
Packit Service 50c9f2
   ~QStrIVec() { clear(); }
Packit Service 50c9f2
private:
Packit Service 50c9f2
    int	 compareItems( Item s1, Item s2 )
Packit Service 50c9f2
				{ return qstricmp((const char*)s1,
Packit Service 50c9f2
						 (const char*)s2); }
Packit Service 50c9f2
};
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
#endif // QSTRVEC_H