You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
142 lines
4.9 KiB
142 lines
4.9 KiB
'\" t
|
|
.TH QValueStack 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
|
|
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
|
|
.\" license file included in the distribution for a complete license
|
|
.\" statement.
|
|
.\"
|
|
.ad l
|
|
.nh
|
|
.SH NAME
|
|
QValueStack \- Value-based template class that provides a stack
|
|
.SH SYNOPSIS
|
|
All the functions in this class are reentrant when TQt is built with thread support.</p>
|
|
.PP
|
|
\fC#include <ntqvaluestack.h>\fR
|
|
.PP
|
|
Inherits QValueList<T>.
|
|
.PP
|
|
.SS "Public Members"
|
|
.in +1c
|
|
.ti -1c
|
|
.BI "\fBQValueStack\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "\fB~QValueStack\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBpush\fR ( const T & d )"
|
|
.br
|
|
.ti -1c
|
|
.BI "T \fBpop\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "T & \fBtop\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "const T & \fBtop\fR () const"
|
|
.br
|
|
.in -1c
|
|
.SH DESCRIPTION
|
|
The QValueStack class is a value-based template class that provides a stack.
|
|
.PP
|
|
Define a template instance QValueStack<X> to create a stack of values that all have the class X. QValueStack is part of the TQt Template Library.
|
|
.PP
|
|
Note that QValueStack does not store pointers to the members of the stack; it holds a copy of every member. That is why these kinds of classes are called "value based"; QPtrStack, QPtrList, QDict, etc., are "pointer based".
|
|
.PP
|
|
A stack is a last in, first out (LIFO) structure. Items are added to the top of the stack with push() and retrieved from the top with pop(). The top() function provides access to the topmost item without removing it.
|
|
.PP
|
|
Example:
|
|
.PP
|
|
.nf
|
|
.br
|
|
QValueStack<int> stack;
|
|
.br
|
|
stack.push( 1 );
|
|
.br
|
|
stack.push( 2 );
|
|
.br
|
|
stack.push( 3 );
|
|
.br
|
|
while ( ! stack.isEmpty() )
|
|
.br
|
|
cout << "Item: " << stack.pop() << endl;
|
|
.br
|
|
.br
|
|
// Output:
|
|
.br
|
|
// Item: 3
|
|
.br
|
|
// Item: 2
|
|
.br
|
|
// Item: 1
|
|
.br
|
|
.fi
|
|
.PP
|
|
QValueStack is a specialized QValueList provided for convenience. All of QValueList's functionality also applies to QPtrStack, for example the facility to iterate over all elements using QValueStack<T>::Iterator. See QValueListIterator for further details.
|
|
.PP
|
|
Some classes cannot be used within a QValueStack, for example everything derived from QObject and thus all classes that implement widgets. Only values can be used in a QValueStack. To qualify as a value, the class must provide
|
|
.TP
|
|
a copy constructor;
|
|
.TP
|
|
an assignment operator;
|
|
.TP
|
|
a default constructor, i.e. a constructor that does not take any arguments.
|
|
.PP
|
|
Note that C++ defaults to field-by-field assignment operators and copy constructors if no explicit version is supplied. In many cases this is sufficient.
|
|
.PP
|
|
See also TQt Template Library Classes, Implicitly and Explicitly Shared Classes, and Non-GUI Classes.
|
|
.SH MEMBER FUNCTION DOCUMENTATION
|
|
.SH "QValueStack::QValueStack ()"
|
|
Constructs an empty stack.
|
|
.SH "QValueStack::~QValueStack ()"
|
|
Destroys the stack. References to the values in the stack and all iterators of this stack become invalidated. Because QValueStack is highly tuned for performance, you won't see warnings if you use invalid iterators because it is impossible for an iterator to check whether or not it is valid.
|
|
.SH "T QValueStack::pop ()"
|
|
Removes the top item from the stack and returns it.
|
|
.PP
|
|
See also top() and push().
|
|
.SH "void QValueStack::push ( const T & d )"
|
|
Adds element, \fId\fR, to the top of the stack. Last in, first out.
|
|
.PP
|
|
This function is equivalent to append().
|
|
.PP
|
|
See also pop() and top().
|
|
.SH "T & QValueStack::top ()"
|
|
Returns a reference to the top item of the stack or the item referenced by end() if no such item exists. Note that you must not change the value the end() iterator points to.
|
|
.PP
|
|
This function is equivalent to last().
|
|
.PP
|
|
See also pop(), push(), and QValueList::fromLast().
|
|
.SH "const T & QValueStack::top () const"
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
.PP
|
|
Returns a reference to the top item of the stack or the item referenced by end() if no such item exists.
|
|
.PP
|
|
This function is equivalent to last().
|
|
.PP
|
|
See also pop(), push(), and QValueList::fromLast().
|
|
|
|
.SH "SEE ALSO"
|
|
.BR http://doc.trolltech.com/ntqvaluestack.html
|
|
.BR http://www.trolltech.com/faq/tech.html
|
|
.SH COPYRIGHT
|
|
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
|
|
license file included in the distribution for a complete license
|
|
statement.
|
|
.SH AUTHOR
|
|
Generated automatically from the source code.
|
|
.SH BUGS
|
|
If you find a bug in Qt, please report it as described in
|
|
.BR http://doc.trolltech.com/bughowto.html .
|
|
Good bug reports help us to help you. Thank you.
|
|
.P
|
|
The definitive TQt documentation is provided in HTML format; it is
|
|
located at $TQTDIR/doc/html and can be read using TQt Assistant or with
|
|
a web browser. This man page is provided as a convenience for those
|
|
users who prefer man pages, although this format is not officially
|
|
supported by Trolltech.
|
|
.P
|
|
If you find errors in this manual page, please report them to
|
|
.BR qt-bugs@trolltech.com .
|
|
Please include the name of the manual page (tqvaluestack.3qt) and the Qt
|
|
version (3.3.8).
|