1QValueStack(3qt)                                              QValueStack(3qt)
2
3
4

NAME

6       QValueStack - Value-based template class that provides a stack
7

SYNOPSIS

9       All the functions in this class are reentrant when Qt is built with
10       thread support.</p>
11
12       #include <qvaluestack.h>
13
14       Inherits QValueList<T>.
15
16   Public Members
17       QValueStack ()
18       ~QValueStack ()
19       void push ( const T & d )
20       T pop ()
21       T & top ()
22       const T & top () const
23

DESCRIPTION

25       The QValueStack class is a value-based template class that provides a
26       stack.
27
28       Define a template instance QValueStack<X> to create a stack of values
29       that all have the class X. QValueStack is part of the Qt Template
30       Library.
31
32       Note that QValueStack does not store pointers to the members of the
33       stack; it holds a copy of every member. That is why these kinds of
34       classes are called "value based"; QPtrStack, QPtrList, QDict, etc., are
35       "pointer based".
36
37       A stack is a last in, first out (LIFO) structure. Items are added to
38       the top of the stack with push() and retrieved from the top with pop().
39       The top() function provides access to the topmost item without removing
40       it.
41
42       Example:
43
44               QValueStack<int> stack;
45               stack.push( 1 );
46               stack.push( 2 );
47               stack.push( 3 );
48               while ( ! stack.isEmpty() )
49                   cout << "Item: " << stack.pop() << endl;
50               // Output:
51               //      Item: 3
52               //      Item: 2
53               //      Item: 1
54
55       QValueStack is a specialized QValueList provided for convenience. All
56       of QValueList's functionality also applies to QPtrStack, for example
57       the facility to iterate over all elements using
58       QValueStack<T>::Iterator. See QValueListIterator for further details.
59
60       Some classes cannot be used within a QValueStack, for example
61       everything derived from QObject and thus all classes that implement
62       widgets. Only values can be used in a QValueStack. To qualify as a
63       value, the class must provide
64
65       a copy constructor;
66
67       an assignment operator;
68
69       a default constructor, i.e. a constructor that does not take any
70       arguments.
71
72       Note that C++ defaults to field-by-field assignment operators and copy
73       constructors if no explicit version is supplied. In many cases this is
74       sufficient.
75
76       See also Qt Template Library Classes, Implicitly and Explicitly Shared
77       Classes, and Non-GUI Classes.
78

MEMBER FUNCTION DOCUMENTATION

QValueStack::QValueStack ()

81       Constructs an empty stack.
82

QValueStack::~QValueStack ()

84       Destroys the stack. References to the values in the stack and all
85       iterators of this stack become invalidated. Because QValueStack is
86       highly tuned for performance, you won't see warnings if you use invalid
87       iterators because it is impossible for an iterator to check whether or
88       not it is valid.
89

T QValueStack::pop ()

91       Removes the top item from the stack and returns it.
92
93       See also top() and push().
94

void QValueStack::push ( const T & d )

96       Adds element, d, to the top of the stack. Last in, first out.
97
98       This function is equivalent to append().
99
100       See also pop() and top().
101

T & QValueStack::top ()

103       Returns a reference to the top item of the stack or the item referenced
104       by end() if no such item exists. Note that you must not change the
105       value the end() iterator points to.
106
107       This function is equivalent to last().
108
109       See also pop(), push(), and QValueList::fromLast().
110

const T & QValueStack::top () const

112       This is an overloaded member function, provided for convenience. It
113       behaves essentially like the above function.
114
115       Returns a reference to the top item of the stack or the item referenced
116       by end() if no such item exists.
117
118       This function is equivalent to last().
119
120       See also pop(), push(), and QValueList::fromLast().
121
122

SEE ALSO

124       http://doc.trolltech.com/qvaluestack.html
125       http://www.trolltech.com/faq/tech.html
126
128       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
129       license file included in the distribution for a complete license
130       statement.
131

AUTHOR

133       Generated automatically from the source code.
134

BUGS

136       If you find a bug in Qt, please report it as described in
137       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
138       help you. Thank you.
139
140       The definitive Qt documentation is provided in HTML format; it is
141       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
142       web browser. This man page is provided as a convenience for those users
143       who prefer man pages, although this format is not officially supported
144       by Trolltech.
145
146       If you find errors in this manual page, please report them to qt-
147       bugs@trolltech.com.  Please include the name of the manual page
148       (qvaluestack.3qt) and the Qt version (3.3.8).
149
150
151
152Trolltech AS                    2 February 2007               QValueStack(3qt)
Impressum