📄 qvaluestack.3qt
字号:
'\" t.TH QValueStack 3qt "9 December 2002" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQValueStack \- Value-based template class that provides a stack.SH SYNOPSISAll the functions in this class are reentrant when Qt is built with thread support.</p>.PP\fC#include <qvaluestack.h>\fR.PPInherits 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 DESCRIPTIONThe QValueStack class is a value-based template class that provides a stack..PPDefine a template instance QValueStack<X> to create a stack of values that all have the class X. QValueStack is part of the Qt Template Library..PPNote 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"..PPA 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..PPExample:.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.PPQValueStack 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..PPSome 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.TPa copy constructor;.TPan assignment operator;.TPa default constructor, i.e. a constructor that does not take any arguments..PPNote that C++ defaults to field-by-field assignment operators and copy constructors if no explicit version is supplied. In many cases this is sufficient..PPSee also Qt 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..PPSee 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..PPThis function is equivalent to append()..PPSee 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..PPThis function is equivalent to last()..PPSee 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..PPReturns a reference to the top item of the stack or the item referenced by end() if no such item exists..PPThis function is equivalent to last()..PPSee also pop(), push(), and QValueList::fromLast()..SH "SEE ALSO".BR http://doc.trolltech.com/qvaluestack.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf 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..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qvaluestack.3qt) and the Qtversion (3.1.1).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -