|
Packit |
1c1d7e |
/****************************************************************************
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** Definition of QStack template/macro class
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** Created : 920917
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** This file is part of the tools module of the Qt GUI Toolkit.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** This file may be distributed under the terms of the Q Public License
|
|
Packit |
1c1d7e |
** as defined by Trolltech AS of Norway and appearing in the file
|
|
Packit |
1c1d7e |
** LICENSE.QPL included in the packaging of this file.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** This file may be distributed and/or modified under the terms of the
|
|
Packit |
1c1d7e |
** GNU General Public License version 2 as published by the Free Software
|
|
Packit |
1c1d7e |
** Foundation and appearing in the file LICENSE.GPL included in the
|
|
Packit |
1c1d7e |
** packaging of this file.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
|
Packit |
1c1d7e |
** licenses may use this file in accordance with the Qt Commercial License
|
|
Packit |
1c1d7e |
** Agreement provided with the Software.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
|
Packit |
1c1d7e |
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
|
Packit |
1c1d7e |
** information about Qt Commercial License Agreements.
|
|
Packit |
1c1d7e |
** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
|
Packit |
1c1d7e |
** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** Contact info@trolltech.com if any conditions of this licensing are
|
|
Packit |
1c1d7e |
** not clear to you.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
**********************************************************************/
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#ifndef QSTACK_H
|
|
Packit |
1c1d7e |
#define QSTACK_H
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#ifndef QT_H
|
|
Packit |
1c1d7e |
#include "qglist.h"
|
|
Packit |
1c1d7e |
#endif // QT_H
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
template<class type> class QStack : private QGList
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
public:
|
|
Packit |
1c1d7e |
QStack() {}
|
|
Packit |
1c1d7e |
QStack( const QStack<type> &s ) : QGList(s) {}
|
|
Packit |
1c1d7e |
~QStack() { clear(); }
|
|
Packit |
1c1d7e |
QStack<type> &operator=(const QStack<type> &s)
|
|
Packit |
1c1d7e |
{ return (QStack<type>&)QGList::operator=(s); }
|
|
Packit |
1c1d7e |
bool autoDelete() const { return QCollection::autoDelete(); }
|
|
Packit |
1c1d7e |
void setAutoDelete( bool del ) { QCollection::setAutoDelete(del); }
|
|
Packit |
1c1d7e |
uint count() const { return QGList::count(); }
|
|
Packit |
1c1d7e |
bool isEmpty() const { return QGList::count() == 0; }
|
|
Packit |
1c1d7e |
void push( const type *d ) { QGList::insertAt(0,Item(d)); }
|
|
Packit |
1c1d7e |
type *pop() { return (type *)QGList::takeFirst(); }
|
|
Packit |
1c1d7e |
bool remove() { return QGList::removeFirst(); }
|
|
Packit |
1c1d7e |
void clear() { QGList::clear(); }
|
|
Packit |
1c1d7e |
type *bottom() const { return (type *)QGList::clast(); }
|
|
Packit |
1c1d7e |
type *top() const { return (type *)QGList::cfirst(); }
|
|
Packit |
1c1d7e |
operator type *() const { return (type *)QGList::cfirst(); }
|
|
Packit |
1c1d7e |
type *current() const { return (type *)QGList::cfirst(); }
|
|
Packit |
1c1d7e |
private:
|
|
Packit |
1c1d7e |
void deleteItem( Item d ) { if ( del_item ) delete (type *)d; }
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#endif // QSTACK_H
|