author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 01:19:32 +0300 | |
changeset 37 | 758a864f9613 |
parent 33 | 3e2da88830cd |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the documentation of the Qt Toolkit. |
|
8 |
** |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
9 |
** $QT_BEGIN_LICENSE:FDL$ |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
10 |
** Commercial Usage |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
11 |
** Licensees holding valid Qt Commercial licenses may use this file in |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
12 |
** accordance with the Qt Commercial License Agreement provided with the |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
13 |
** Software or, alternatively, in accordance with the terms contained in a |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
14 |
** written agreement between you and Nokia. |
0 | 15 |
** |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
16 |
** GNU Free Documentation License |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
17 |
** Alternatively, this file may be used under the terms of the GNU Free |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
18 |
** Documentation License version 1.3 as published by the Free Software |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
19 |
** Foundation and appearing in the file included in the packaging of this |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
20 |
** file. |
0 | 21 |
** |
22 |
** If you have questions regarding the use of this file, please contact |
|
23 |
** Nokia at qt-info@nokia.com. |
|
24 |
** $QT_END_LICENSE$ |
|
25 |
** |
|
26 |
****************************************************************************/ |
|
27 |
||
28 |
/*! |
|
29 |
\class Q3ValueStack |
|
30 |
\brief The Q3ValueStack class is a value-based template class that provides a stack. |
|
31 |
\compat |
|
32 |
||
33 |
Define a template instance Q3ValueStack\<X\> to create a stack of |
|
34 |
values that all have the class X. |
|
35 |
||
36 |
Note that Q3ValueStack does not store pointers to the members of |
|
37 |
the stack; it holds a copy of every member. That is why these |
|
38 |
kinds of classes are called "value based"; Q3PtrStack, Q3PtrList, |
|
39 |
Q3Dict, etc., are "pointer based". |
|
40 |
||
41 |
A stack is a last in, first out (LIFO) structure. Items are added |
|
42 |
to the top of the stack with push() and retrieved from the top |
|
43 |
with pop(). The top() function provides access to the topmost item |
|
44 |
without removing it. |
|
45 |
||
46 |
Example: |
|
47 |
\snippet doc/src/snippets/code/doc_src_q3valuestack.qdoc 0 |
|
48 |
||
49 |
Q3ValueStack is a specialized Q3ValueList provided for convenience. |
|
50 |
All of Q3ValueList's functionality also applies to Q3PtrStack, for |
|
51 |
example the facility to iterate over all elements using |
|
52 |
Q3ValueStack<T>::Iterator. See Q3ValueListIterator for further |
|
53 |
details. |
|
54 |
||
55 |
Some classes cannot be used within a Q3ValueStack, for example |
|
56 |
everything derived from QObject and thus all classes that |
|
57 |
implement widgets. Only values can be used in a Q3ValueStack. To |
|
58 |
qualify as a value, the class must provide |
|
59 |
\list |
|
60 |
\i a copy constructor; |
|
61 |
\i an assignment operator; |
|
62 |
\i a default constructor, i.e. a constructor that does not take any arguments. |
|
63 |
\endlist |
|
64 |
||
65 |
Note that C++ defaults to field-by-field assignment operators and |
|
66 |
copy constructors if no explicit version is supplied. In many |
|
67 |
cases this is sufficient. |
|
68 |
*/ |
|
69 |
||
70 |
||
71 |
/*! |
|
72 |
\fn Q3ValueStack::Q3ValueStack() |
|
73 |
||
74 |
Constructs an empty stack. |
|
75 |
*/ |
|
76 |
||
77 |
/*! |
|
78 |
\fn Q3ValueStack::~Q3ValueStack() |
|
79 |
||
80 |
Destroys the stack. References to the values in the stack and all |
|
81 |
iterators of this stack become invalidated. Because Q3ValueStack is |
|
82 |
highly tuned for performance, you won't see warnings if you use |
|
83 |
invalid iterators because it is impossible for an iterator to |
|
84 |
check whether or not it is valid. |
|
85 |
*/ |
|
86 |
||
87 |
||
88 |
/*! |
|
89 |
\fn void Q3ValueStack::push( const T& d ) |
|
90 |
||
91 |
Adds element, \a d, to the top of the stack. Last in, first out. |
|
92 |
||
93 |
This function is equivalent to append(). |
|
94 |
||
95 |
\sa pop(), top() |
|
96 |
*/ |
|
97 |
||
98 |
/*! |
|
99 |
\fn T& Q3ValueStack::top() |
|
100 |
||
101 |
Returns a reference to the top item of the stack or the item |
|
102 |
referenced by end() if no such item exists. Note that you must not |
|
103 |
change the value the end() iterator points to. |
|
104 |
||
105 |
This function is equivalent to last(). |
|
106 |
||
107 |
\sa pop(), push(), Q3ValueList::fromLast() |
|
108 |
*/ |
|
109 |
||
110 |
||
111 |
/*! |
|
112 |
\fn const T& Q3ValueStack::top() const |
|
113 |
||
114 |
\overload |
|
115 |
||
116 |
Returns a reference to the top item of the stack or the item |
|
117 |
referenced by end() if no such item exists. |
|
118 |
||
119 |
This function is equivalent to last(). |
|
120 |
||
121 |
\sa pop(), push(), Q3ValueList::fromLast() |
|
122 |
*/ |
|
123 |
||
124 |
/*! |
|
125 |
\fn T Q3ValueStack::pop() |
|
126 |
||
127 |
Removes the top item from the stack and returns it. |
|
128 |
||
129 |
\sa top() push() |
|
130 |
*/ |
|
131 |
||
132 |
||
133 |
||
134 |
||
135 |