source: trunk/src/xmlpatterns/api/qabstractxmlforwarditerator.cpp@ 68

Last change on this file since 68 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 8.5 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the QtXmlPatterns module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42/*!
43 \class QAbstractXmlForwardIterator
44 \brief The QAbstractXmlForwardIterator class is a base class for forward iterators.
45 \reentrant
46 \since 4.4
47 \ingroup xml-tools
48 \internal
49
50 This abstract base class is for creating iterators for
51 traversing custom data structures modeled to look like XML.
52 An item can be instantiated in QAbstractXmlForwardIterator if:
53 \list
54
55 \o It has a default constructor, a copy constructor, and an
56 assignment operator, and
57
58 \o It has an appropriate qIsForwardIteratorEnd() function.
59 \endlist
60
61 @ingroup Patternist_iterators
62 @author Frans Englich <[email protected]>
63 */
64
65/*!
66 \typedef QAbstractXmlForwardIterator::Ptr
67
68 A smart pointer wrapping an instance of a QAbstractXmlForwardIterator subclass.
69 */
70
71/*!
72 \typedef QAbstractXmlForwardIterator::List
73 A QList containing QAbstractXmlForwardIterator::Ptr instances.
74 */
75
76/*!
77 \typedef QAbstractXmlForwardIterator::Vector
78 A QVector containing QAbstractXmlForwardIterator::Ptr instances.
79 */
80
81/*!
82 \fn QAbstractXmlForwardIterator::QAbstractXmlForwardIterator()
83
84 Default constructor.
85 */
86
87/*!
88 \fn QAbstractXmlForwardIterator::~QAbstractXmlForwardIterator()
89
90 Destructor.
91 */
92
93/*!
94 \fn T QAbstractXmlForwardIterator::next() = 0;
95
96 Returns the next item in the sequence, or
97 a null object if the end has been reached.
98 */
99
100/*!
101 \fn T QAbstractXmlForwardIterator::current() const = 0;
102
103 Returns the current item in the sequence. If this function is called
104 before the first call to next(), a null object is returned. If the
105 end of the sequence has been reached, a null object is returned.
106 */
107
108/*!
109 \fn qint64 QAbstractXmlForwardIterator::position() const = 0;
110
111 Returns the current position in the sequence represented
112 by \e this.
113
114 The first position is 1, not 0. If next() hasn't been called, 0 is
115 returned. If \e this has reached the end, -1 is returned.
116 */
117
118/*!
119 \fn bool qIsForwardIteratorEnd(const T &unit)
120 \since 4.4
121 \relates QAbstractXmlForwardIterator
122
123 The Callback QAbstractXmlForwardIterator uses for determining
124 whether \a unit is the end of a sequence.
125
126 If \a unit is a value that would signal the end of a sequence
127 (typically a default constructed value), this function returns \c
128 true, otherwise \c false.
129
130 This implementation works for any type that has a boolean operator.
131 For example, this function should work satisfactory for pointers.
132 */
133
134/*!
135 \fn qint64 QAbstractXmlForwardIterator::count()
136 \internal
137
138 Determines the number of items this QAbstractXmlForwardIterator
139 represents.
140
141 Note that this function is not \c const. It modifies the
142 QAbstractXmlForwardIterator. The reason for this is efficiency. If
143 this QAbstractXmlForwardIterator must not be changed, get a copy()
144 before performing the count.
145
146 The default implementation simply calls next() until the end is
147 reached. Hence, it may be of interest to override this function if
148 the sub-class knows a better way of computing its count.
149
150 The number of items in the sequence is returned.
151 */
152
153/*!
154 \fn QAbstractXmlForwardIterator<T>::Ptr QAbstractXmlForwardIterator::toReversed();
155 \internal
156
157 Returns a reverse iterator for the sequence.
158
159 This function may modify the iterator, it can be considered a
160 function that evaluates this QAbstractXmlForwardIterator. It is not
161 a \e getter, but potentially alters the iterator in the same way the
162 next() function does. If this QAbstractXmlForwardIterator must not
163 be modified, such that it can be used for evaluation with next(),
164 use a copy().