'\" t .TH TQPtrStack 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 TQPtrStack \- Template class that provides a stack .SH SYNOPSIS \fC#include \fR .PP .SS "Public Members" .in +1c .ti -1c .BI "\fBTQPtrStack\fR ()" .br .ti -1c .BI "\fBTQPtrStack\fR ( const TQPtrStack & s )" .br .ti -1c .BI "\fB~TQPtrStack\fR ()" .br .ti -1c .BI "TQPtrStack & \fBoperator=\fR ( const TQPtrStack & s )" .br .ti -1c .BI "bool \fBautoDelete\fR () const" .br .ti -1c .BI "void \fBsetAutoDelete\fR ( bool enable )" .br .ti -1c .BI "uint \fBcount\fR () const" .br .ti -1c .BI "bool \fBisEmpty\fR () const" .br .ti -1c .BI "void \fBpush\fR ( const type * d )" .br .ti -1c .BI "type * \fBpop\fR ()" .br .ti -1c .BI "bool \fBremove\fR ()" .br .ti -1c .BI "void \fBclear\fR ()" .br .ti -1c .BI "type * \fBtop\fR () const" .br .ti -1c .BI "\fBoperator type *\fR () const" .br .ti -1c .BI "type * \fBcurrent\fR () const" .br .in -1c .SS "Protected Members" .in +1c .ti -1c .BI "virtual QDataStream & \fBread\fR ( QDataStream & s, TQPtrCollection::Item & item )" .br .ti -1c .BI "virtual QDataStream & \fBwrite\fR ( QDataStream & s, TQPtrCollection::Item item ) const" .br .in -1c .SH DESCRIPTION The TQPtrStack class is a template class that provides a stack. .PP TQValueStack is an STL-compatible alternative to this class. .PP Define a template instance TQPtrStack to create a stack that operates on pointers to X, (X*). .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(). Use top() to get a reference to the top element without changing the stack. .PP You can control the stack's deletion policy with setAutoDelete(). .PP For compatibility with the TQPtrCollection classes current() and remove() are provided; they both operate on the top(). .PP See also TQPtrList, TQPtrQueue, and Non-GUI Classes. .SH MEMBER FUNCTION DOCUMENTATION .SH "TQPtrStack::TQPtrStack ()" Creates an empty stack. .SH "TQPtrStack::TQPtrStack ( const TQPtrStack & s )" Creates a stack by making a shallow copy of another stack \fIs\fR. .SH "TQPtrStack::~TQPtrStack ()" Destroys the stack. All items will be deleted if autoDelete() is TRUE. .SH "bool TQPtrStack::autoDelete () const" The same as TQPtrCollection::autoDelete(). .PP See also setAutoDelete(). .SH "void TQPtrStack::clear ()" Removes all items from the stack, deleting them if autoDelete() is TRUE. .PP See also remove(). .SH "uint TQPtrStack::count () const" Returns the number of items in the stack. .PP See also isEmpty(). .SH "type * TQPtrStack::current () const" Returns a pointer to the top item on the stack (most recently pushed). The stack is not changed. Returns 0 if the stack is empty. .SH "bool TQPtrStack::isEmpty () const" Returns TRUE if the stack contains no elements; otherwise returns FALSE. .SH "TQPtrStack::operator type * () const" Returns a pointer to the top item on the stack (most recently pushed). The stack is not changed. Returns 0 if the stack is empty. .SH "TQPtrStack & TQPtrStack::operator= ( const TQPtrStack & s )" Sets the contents of this stack by making a shallow copy of another stack \fIs\fR. Elements currently in this stack will be deleted if autoDelete() is TRUE. .SH "type * TQPtrStack::pop ()" Removes the top item from the stack and returns it. The stack must not be empty. .SH "void TQPtrStack::push ( const type * d )" Adds an element \fId\fR to the top of the stack. Last in, first out. .SH "QDataStream & TQPtrStack::read ( QDataStream & s, TQPtrCollection::Item & item )\fC [virtual protected]\fR" Reads a stack item, \fIitem\fR, from the stream \fIs\fR and returns a reference to the stream. .PP The default implementation sets \fIitem\fR to 0. .PP See also write(). .SH "bool TQPtrStack::remove ()" Removes the top item from the stack and deletes it if autoDelete() is TRUE. Returns TRUE if there was an item to pop; otherwise returns FALSE. .PP See also clear(). .SH "void TQPtrStack::setAutoDelete ( bool enable )" Defines whether this stack auto-deletes its contents. The same as TQPtrCollection::setAutoDelete(). .PP If \fIenable\fR is TRUE the stack auto-deletes its contents; if \fIenable\fR is FALSE the stack does not delete its contents. .PP See also autoDelete(). .SH "type * TQPtrStack::top () const" Returns a pointer to the top item on the stack (most recently pushed). The stack is not changed. Returns 0 if the stack is empty. .SH "QDataStream & TQPtrStack::write ( QDataStream & s, TQPtrCollection::Item item ) const\fC [virtual protected]\fR" Writes a stack item, \fIitem\fR, to the stream \fIs\fR and returns a reference to the stream. .PP The default implementation does nothing. .PP See also read(). .SH "SEE ALSO" .BR http://doc.trolltech.com/tqptrstack.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 (tqptrstack.3qt) and the Qt version (3.3.8).