1 /****************************************************************************
4 ** QStack class documentation
6 ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
8 ** This file is part of the Qt GUI Toolkit.
10 ** This file may be distributed under the terms of the Q Public License
11 ** as defined by Trolltech AS of Norway and appearing in the file
12 ** LICENSE.QPL included in the packaging of this file.
14 ** This file may be distributed and/or modified under the terms of the
15 ** GNU General Public License version 2 as published by the Free Software
16 ** Foundation and appearing in the file LICENSE.GPL included in the
17 ** packaging of this file.
19 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
20 ** licenses may use this file in accordance with the Qt Commercial License
21 ** Agreement provided with the Software.
23 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
24 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
27 ** information about Qt Commercial License Agreements.
28 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
29 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
31 ** Contact info@trolltech.com if any conditions of this licensing are
34 **********************************************************************/
37 /*****************************************************************************
39 *****************************************************************************/
42 \class QStack qstack.h
43 \brief The QStack class is a template class that provides a stack.
48 QStack is implemented as a template class. Define a template
49 instance QStack\<X\> to create a stack that operates on pointers to
52 A stack is a Last In, First Out (LIFO) structure. Items are added to
53 the top of the stack with push() and retrieved from the top
56 \sa \link collection.html Collection Classes\endlink
59 /*! \fn QStack::QStack ()
60 Creates and empty stack.
63 /*! \fn QStack::QStack (const QStack<type>& s)
64 Creates a stack by making a shallow copy of another stack.
67 /*! \fn QStack::~QStack ()
68 Destroys the stack. All items will be deleted if autoDelete() is TRUE.
71 /*! \fn QStack<type>& QStack::operator= (const QStack<type>& s)
72 Sets the contents of this stack by making a shallow copy of another stack.
73 Elements currently in this stack will be deleted if autoDelete() is TRUE.
76 /*! \fn bool QStack::isEmpty () const
77 Returns TRUE is the stack contains no elements to be \link pop() popped\endlink.
80 /*! \fn void QStack::push (const type* d)
81 Adds an element to the top of the stack. Last in, first out.
84 /*! \fn type* QStack::pop ()
85 Removes the top item from the stack and returns it.
88 /*! \fn bool QStack::remove ()
89 Removes the top item from the stack and deletes it if
90 autoDelete() is TRUE. Returns TRUE if there was an item to pop.
95 /*! \fn void QStack::clear()
96 Removes all items from the stack, deleting them if
102 /*! \fn uint QStack::count() const
103 Returns the number of items in the stack.
108 /*! \fn type* QStack::top () const
109 Returns a reference to the top item on the stack (most recently pushed).
110 The stack is not changed.
113 /*! \fn QStack::operator type* ()const
114 Returns a reference to the top item on the stack (most recently pushed).
115 The stack is not changed.
118 /*! \fn type* QStack::current () const
119 Returns a reference to the top item on the stack (most recently pushed).
120 The stack is not changed.
123 /*! \fn bool QStack::autoDelete() const
125 The same as QCollection::autoDelete().
130 /*! \fn void QStack::setAutoDelete( bool enable )
132 The same as QCollection::setAutoDelete().