1QPtrStack(3qt) QPtrStack(3qt)
2
3
4
6 QPtrStack - Template class that provides a stack
7
9 #include <qptrstack.h>
10
11 Public Members
12 QPtrStack ()
13 QPtrStack ( const QPtrStack<type> & s )
14 ~QPtrStack ()
15 QPtrStack<type> & operator= ( const QPtrStack<type> & s )
16 bool autoDelete () const
17 void setAutoDelete ( bool enable )
18 uint count () const
19 bool isEmpty () const
20 void push ( const type * d )
21 type * pop ()
22 bool remove ()
23 void clear ()
24 type * top () const
25 operator type * () const
26 type * current () const
27
28 Protected Members
29 virtual QDataStream & read ( QDataStream & s, QPtrCollection::Item &
30 item )
31 virtual QDataStream & write ( QDataStream & s, QPtrCollection::Item
32 item ) const
33
35 The QPtrStack class is a template class that provides a stack.
36
37 QValueStack is an STL-compatible alternative to this class.
38
39 Define a template instance QPtrStack<X> to create a stack that operates
40 on pointers to X, (X*).
41
42 A stack is a last in, first out (LIFO) structure. Items are added to
43 the top of the stack with push() and retrieved from the top with pop().
44 Use top() to get a reference to the top element without changing the
45 stack.
46
47 You can control the stack's deletion policy with setAutoDelete().
48
49 For compatibility with the QPtrCollection classes current() and
50 remove() are provided; they both operate on the top().
51
52 See also QPtrList, QPtrQueue, and Non-GUI Classes.
53
56 Creates an empty stack.
57
59 Creates a stack by making a shallow copy of another stack s.
60
62 Destroys the stack. All items will be deleted if autoDelete() is TRUE.
63
65 The same as QPtrCollection::autoDelete().
66
67 See also setAutoDelete().
68
70 Removes all items from the stack, deleting them if autoDelete() is
71 TRUE.
72
73 See also remove().
74
76 Returns the number of items in the stack.
77
78 See also isEmpty().
79
81 Returns a pointer to the top item on the stack (most recently pushed).
82 The stack is not changed. Returns 0 if the stack is empty.
83
85 Returns TRUE if the stack contains no elements; otherwise returns
86 FALSE.
87
89 Returns a pointer to the top item on the stack (most recently pushed).
90 The stack is not changed. Returns 0 if the stack is empty.
91
93 Sets the contents of this stack by making a shallow copy of another
94 stack s. Elements currently in this stack will be deleted if
95 autoDelete() is TRUE.
96
98 Removes the top item from the stack and returns it. The stack must not
99 be empty.
100
102 Adds an element d to the top of the stack. Last in, first out.
103
105 [virtual protected]
106 Reads a stack item, item, from the stream s and returns a reference to
107 the stream.
108
109 The default implementation sets item to 0.
110
111 See also write().
112
114 Removes the top item from the stack and deletes it if autoDelete() is
115 TRUE. Returns TRUE if there was an item to pop; otherwise returns
116 FALSE.
117
118 See also clear().
119
121 Defines whether this stack auto-deletes its contents. The same as
122 QPtrCollection::setAutoDelete().
123
124 If enable is TRUE the stack auto-deletes its contents; if enable is
125 FALSE the stack does not delete its contents.
126
127 See also autoDelete().
128
130 Returns a pointer to the top item on the stack (most recently pushed).
131 The stack is not changed. Returns 0 if the stack is empty.
132
134 const [virtual protected]
135 Writes a stack item, item, to the stream s and returns a reference to
136 the stream.
137
138 The default implementation does nothing.
139
140 See also read().
141
142
144 http://doc.trolltech.com/qptrstack.html
145 http://www.trolltech.com/faq/tech.html
146
148 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
149 license file included in the distribution for a complete license
150 statement.
151
153 Generated automatically from the source code.
154
156 If you find a bug in Qt, please report it as described in
157 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
158 help you. Thank you.
159
160 The definitive Qt documentation is provided in HTML format; it is
161 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
162 web browser. This man page is provided as a convenience for those users
163 who prefer man pages, although this format is not officially supported
164 by Trolltech.
165
166 If you find errors in this manual page, please report them to qt-
167 bugs@trolltech.com. Please include the name of the manual page
168 (qptrstack.3qt) and the Qt version (3.3.8).
169
170
171
172Trolltech AS 2 February 2007 QPtrStack(3qt)