summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2011-03-31 13:54:58 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2011-03-31 13:54:58 (GMT)
commit37feac98c573a099502fddfb5703c2359711b4c4 (patch)
tree33d74f9650065de4564bc0d749ca50bd65b13a2c /src/corelib/tools
parent7b18baf23b1e8c663872b2b25b1323798b1d09df (diff)
parentb764d3e6cb114988394e7500236ba087a3385a50 (diff)
downloadQt-37feac98c573a099502fddfb5703c2359711b4c4.zip
Qt-37feac98c573a099502fddfb5703c2359711b4c4.tar.gz
Qt-37feac98c573a099502fddfb5703c2359711b4c4.tar.bz2
Merge remote-tracking branch 'origin/4.7' into qt-master-from-4.7
Conflicts: doc/src/declarative/example-slideswitch.qdoc doc/src/development/qmake-manual.qdoc doc/src/snippets/code/doc_src_qmake-manual.pro doc/src/snippets/code/doc_src_qtscript.qdoc src/corelib/animation/qabstractanimation.cpp src/s60installs/bwins/QtOpenGLu.def src/s60installs/eabi/QtOpenGLu.def src/s60installs/eabi/QtOpenVGu.def tests/auto/qdir/qdir.pro tests/auto/qsslsocket/tst_qsslsocket.cpp tools/qdoc3/doc/qdoc-manual.qdocconf
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qalgorithms.qdoc52
-rw-r--r--src/corelib/tools/qbytearray.cpp2
-rw-r--r--src/corelib/tools/qcache.qdoc6
-rw-r--r--src/corelib/tools/qiterator.qdoc80
-rw-r--r--src/corelib/tools/qmap.cpp2
-rw-r--r--src/corelib/tools/qpair.qdoc6
-rw-r--r--src/corelib/tools/qset.qdoc30
-rw-r--r--src/corelib/tools/qtextboundaryfinder.cpp30
-rw-r--r--src/corelib/tools/qvarlengtharray.qdoc8
9 files changed, 103 insertions, 113 deletions
diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc
index 34918a3..a9b7ddc 100644
--- a/src/corelib/tools/qalgorithms.qdoc
+++ b/src/corelib/tools/qalgorithms.qdoc
@@ -60,14 +60,14 @@
a particular value. If you need that functionality, you can use
qFill():
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 0
qFill() takes a begin iterator, an end iterator, and a value.
In the example above, we pass \c list.begin() and \c list.end()
as the begin and end iterators, but this doesn't have to be
the case:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 1
Different algorithms can have different requirements for the
iterators they accept. For example, qFill() accepts two
@@ -98,13 +98,13 @@
name_table array and return the corresponding Unicode value from
the \c value_table if the entity is recognized:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 2
This kind of code is for advanced users only; for most
applications, a QMap- or QHash-based approach would work just as
well:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 3
\section1 Types of Iterators
@@ -185,7 +185,7 @@
position \a begin2 + 1; and so on.
Example:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 4
\sa qCopyBackward(), {input iterators}, {output iterators}
*/
@@ -201,7 +201,7 @@
at position \a end2 - 2; and so on.
Example:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 5
\sa qCopy(), {bidirectional iterators}
*/
@@ -214,7 +214,7 @@
items compare equal; otherwise returns false.
Example:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 6
This function requires the item type (in the example above,
QString) to implement \c operator==().
@@ -228,7 +228,7 @@
Fills the range [\a begin, \a end) with \a value.
Example:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 7
\sa qCopy(), {forward iterators}
*/
@@ -249,7 +249,7 @@
value isn't found.
Example:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 8
This function requires the item type (in the example above,
QString) to implement \c operator==().
@@ -278,7 +278,7 @@
Example:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 9
This function requires the item type (in the example above,
\c int) to implement \c operator==().
@@ -302,7 +302,7 @@ of \a value in the variable passed as a reference in argument \a n.
Exchanges the values of variables \a var1 and \a var2.
Example:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 10
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 10
*/
/*! \fn void qSort(RandomAccessIterator begin, RandomAccessIterator end)
@@ -312,7 +312,7 @@ of \a value in the variable passed as a reference in argument \a n.
using the quicksort algorithm.
Example:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 11
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 11
The sort algorithm is efficient on large data sets. It operates
in \l {linear-logarithmic time}, O(\e{n} log \e{n}).
@@ -338,13 +338,13 @@ of \a value in the variable passed as a reference in argument \a n.
For example, here's how to sort the strings in a QStringList
in case-insensitive alphabetical order:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 12
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 12
To sort values in reverse order, pass
\l{qGreater()}{qGreater<T>()} as the \a lessThan parameter. For
example:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 13
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 13
If neither of the two items is "less than" the other, the items are
taken to be equal. It is then undefined which one of the two
@@ -356,7 +356,7 @@ of \a value in the variable passed as a reference in argument \a n.
following code shows how to sort a list of strings case
insensitively using QMap:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 14
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 14
\sa QMap
*/
@@ -382,7 +382,7 @@ of \a value in the variable passed as a reference in argument \a n.
property is often useful when sorting user-visible data.
Example:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 15
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 15
The sort algorithm is efficient on large data sets. It operates
in \l {linear-logarithmic time}, O(\e{n} log \e{n}).
@@ -405,7 +405,7 @@ of \a value in the variable passed as a reference in argument \a n.
For example, here's how to sort the strings in a QStringList
in case-insensitive alphabetical order:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 16
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 16
Note that earlier versions of Qt allowed using a lessThan function that took its
arguments by non-const reference. From 4.3 and on this is no longer possible,
@@ -415,7 +415,7 @@ of \a value in the variable passed as a reference in argument \a n.
\l{qGreater()}{qGreater<T>()} as the \a lessThan parameter. For
example:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 17
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 17
If neither of the two items is "less than" the other, the items are
taken to be equal. The item that appeared before the other in the
@@ -444,7 +444,7 @@ of \a value in the variable passed as a reference in argument \a n.
ascending order; see qSort().
Example:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 18
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 18
This function requires the item type (in the example above,
\c{int}) to implement \c operator<().
@@ -452,7 +452,7 @@ of \a value in the variable passed as a reference in argument \a n.
qLowerBound() can be used in conjunction with qUpperBound() to
iterate over all occurrences of the same value:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 19
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 19
\sa qUpperBound(), qBinaryFind()
*/
@@ -494,7 +494,7 @@ of \a value in the variable passed as a reference in argument \a n.
ascending order; see qSort().
Example:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 20
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 20
This function requires the item type (in the example above,
\c{int}) to implement \c operator<().
@@ -502,7 +502,7 @@ of \a value in the variable passed as a reference in argument \a n.
qUpperBound() can be used in conjunction with qLowerBound() to
iterate over all occurrences of the same value:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 21
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 21
\sa qLowerBound(), qBinaryFind()
*/
@@ -545,7 +545,7 @@ of \a value in the variable passed as a reference in argument \a n.
finer control.
Example:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 22
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 22
This function requires the item type (in the example above,
QString) to implement \c operator<().
@@ -587,7 +587,7 @@ of \a value in the variable passed as a reference in argument \a n.
example, \c{QWidget *}).
Example:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 23
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 23
Notice that qDeleteAll() doesn't remove the items from the
container; it merely calls \c delete on them. In the example
@@ -618,7 +618,7 @@ of \a value in the variable passed as a reference in argument \a n.
Example:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 24
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 24
\sa {qGreater()}{qGreater<T>()}
*/
@@ -631,7 +631,7 @@ of \a value in the variable passed as a reference in argument \a n.
Example:
- \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 25
+ \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 25
\sa {qLess()}{qLess<T>()}
*/
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index 4799abd..1c9b654 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -1387,7 +1387,7 @@ QByteArray::QByteArray(int size, Qt::Initialization)
If \a size is less than the current size, bytes are removed from
the end.
- \sa size()
+ \sa size(), truncate()
*/
void QByteArray::resize(int size)
diff --git a/src/corelib/tools/qcache.qdoc b/src/corelib/tools/qcache.qdoc
index 991238b..9e12c92 100644
--- a/src/corelib/tools/qcache.qdoc
+++ b/src/corelib/tools/qcache.qdoc
@@ -39,11 +39,11 @@
definition of a cache that stores objects of type Employee
associated with an integer key:
- \snippet doc/src/snippets/code/doc_src_qcache.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qcache.cpp 0
Here's how to insert an object in the cache:
- \snippet doc/src/snippets/code/doc_src_qcache.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qcache.cpp 1
The advantage of using QCache over some other key-based data
structure (such as QMap or QHash) is that QCache automatically
@@ -59,7 +59,7 @@
By default, QCache's maxCost() is 100. You can specify a
different value in the QCache constructor:
- \snippet doc/src/snippets/code/doc_src_qcache.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_qcache.cpp 2
Each time you call insert(), you can specify a cost as third
argument (after the key and a pointer to the object to insert).
diff --git a/src/corelib/tools/qiterator.qdoc b/src/corelib/tools/qiterator.qdoc
index d651343..6830442 100644
--- a/src/corelib/tools/qiterator.qdoc
+++ b/src/corelib/tools/qiterator.qdoc
@@ -50,7 +50,7 @@
the list (before the first item). Here's how to iterate over all
the elements sequentially:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 0
The next() function returns the next item in the list and
advances the iterator. Unlike STL-style iterators, Java-style
@@ -65,7 +65,7 @@
Here's how to iterate over the elements in reverse order:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 1
If you want to find all occurrences of a particular value, use
findNext() or findPrevious() in a loop.
@@ -98,7 +98,7 @@
beginning of the list (before the first item). Here's how to
iterate over all the elements sequentially:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 2
The next() function returns the next item in the list and
advances the iterator. Unlike STL-style iterators, Java-style
@@ -113,7 +113,7 @@
Here's how to iterate over the elements in reverse order:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 3
If you want to find all occurrences of a particular value, use
findNext() or findPrevious() in a loop.
@@ -150,7 +150,7 @@
of the vector (before the first item). Here's how to iterate over
all the elements sequentially:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 4
The next() function returns the next item in the vector and
advances the iterator. Unlike STL-style iterators, Java-style
@@ -165,7 +165,7 @@
Here's how to iterate over the elements in reverse order:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 5
If you want to find all occurrences of a particular value, use
findNext() or findPrevious() in a loop.
@@ -197,7 +197,7 @@
the first item). Here's how to iterate over all the elements
sequentially:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 6
The next() function returns the next item in the set and
advances the iterator. Unlike STL-style iterators, Java-style
@@ -212,7 +212,7 @@
Here's how to iterate over the elements in reverse order:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 7
If you want to find all occurrences of a particular value, use
findNext() or findPrevious() in a loop.
@@ -251,7 +251,7 @@
of the list (before the first item). Here's how to iterate over
all the elements sequentially:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 8
The next() function returns the next item in the list and
advances the iterator. Unlike STL-style iterators, Java-style
@@ -266,7 +266,7 @@
Here's how to iterate over the elements in reverse order:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 9
If you want to find all occurrences of a particular value, use
findNext() or findPrevious() in a loop.
@@ -277,7 +277,7 @@
insert().
Example:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 10
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 10
The example traverses a list, replacing negative numbers with
their absolute values, and eliminating zeroes.
@@ -312,7 +312,7 @@
beginning of the list (before the first item). Here's how to
iterate over all the elements sequentially:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 11
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 11
The next() function returns the next item in the list and
advances the iterator. Unlike STL-style iterators, Java-style
@@ -327,7 +327,7 @@
Here's how to iterate over the elements in reverse order:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 12
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 12
If you want to find all occurrences of a particular value, use
findNext() or findPrevious() in a loop.
@@ -338,7 +338,7 @@
insert().
Example:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 13
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 13
The example traverses a list, replacing negative numbers with
their absolute values, and eliminating zeroes.
@@ -378,7 +378,7 @@
beginning of the list (before the first item). Here's how to
iterate over all the elements sequentially:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 14
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 14
The next() function returns the next item in the vector and
advances the iterator. Unlike STL-style iterators, Java-style
@@ -393,7 +393,7 @@
Here's how to iterate over the elements in reverse order:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 15
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 15
If you want to find all occurrences of a particular value, use
findNext() or findPrevious() in a loop.
@@ -404,7 +404,7 @@
insert().
Example:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 16
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 16
The example traverses a vector, replacing negative numbers with
their absolute values, and eliminating zeroes.
@@ -440,7 +440,7 @@
of the set (before the first item). Here's how to iterate over
all the elements sequentially:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 17
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 17
The next() function returns the next item in the set and
advances the iterator. Unlike STL-style iterators, Java-style
@@ -455,7 +455,7 @@
Here's how to iterate over the elements in reverse order:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 18
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 18
If you want to remove items as you iterate over the set, use
remove().
@@ -755,7 +755,7 @@
traversal functions (next(), previous(), findNext(), findPrevious()).
Example:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 19
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 19
\sa insert(), setValue()
*/
@@ -766,7 +766,7 @@
traversal functions (next(), previous(), findNext(), findPrevious()).
Example:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 20
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 20
\sa insert(), setValue()
*/
@@ -777,7 +777,7 @@
traversal functions (next(), previous(), findNext(), findPrevious()).
Example:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 21
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 21
\sa insert(), setValue()
*/
@@ -788,7 +788,7 @@
traversal functions (next(), previous(), findNext(), findPrevious()).
Example:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 22
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 22
\sa value()
*/
@@ -802,7 +802,7 @@
findPrevious().
Example:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 23
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 23
\sa value(), remove(), insert()
*/
@@ -816,7 +816,7 @@
findPrevious().
Example:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 24
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 24
\sa value(), remove(), insert()
*/
@@ -830,7 +830,7 @@
findPrevious().
Example:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 25
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 25
\sa value(), remove(), insert()
*/
@@ -889,7 +889,7 @@
the map (before the first item). Here's how to iterate over all
the elements sequentially:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 26
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 26
The next() function returns the next item in the map and
advances the iterator. The key() and value() functions return the
@@ -906,12 +906,12 @@
Here's how to iterate over the elements in reverse order:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 27
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 27
If you want to find all occurrences of a particular value, use
findNext() or findPrevious() in a loop. For example:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 28
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 28
Multiple iterators can be used on the same map. If the map is
modified while a QMapIterator is active, the QMapIterator will
@@ -941,7 +941,7 @@
the hash (before the first item). Here's how to iterate over all
the elements sequentially:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 29
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 29
The next() function returns the next item in the hash and
advances the iterator. The key() and value() functions return the
@@ -958,12 +958,12 @@
Here's how to iterate over the elements in reverse order:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 30
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 30
If you want to find all occurrences of a particular value, use
findNext() or findPrevious() in a loop. For example:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 31
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 31
Multiple iterators can be used on the same hash. If the hash is
modified while a QHashIterator is active, the QHashIterator will
@@ -994,7 +994,7 @@
of the map (before the first item). Here's how to iterate over
all the elements sequentially:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 32
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 32
The next() function returns the next item in the map and
advances the iterator. The key() and value() functions return the
@@ -1011,12 +1011,12 @@
Here's how to iterate over the elements in reverse order:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 33
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 33
If you want to find all occurrences of a particular value, use
findNext() or findPrevious() in a loop. For example:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 34
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 34
If you want to remove items as you iterate over the map, use
remove(). If you want to modify the value of an item, use
@@ -1024,7 +1024,7 @@
Example:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 35
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 35
The example removes all (key, value) pairs where the key and the
value are the same.
@@ -1059,7 +1059,7 @@
of the hash (before the first item). Here's how to iterate over
all the elements sequentially:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 36
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 36
The next() function returns the next item in the hash and
advances the iterator. The key() and value() functions return the
@@ -1076,12 +1076,12 @@
Here's how to iterate over the elements in reverse order:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 37
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 37
If you want to find all occurrences of a particular value, use
findNext() or findPrevious() in a loop. For example:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 38
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 38
If you want to remove items as you iterate over the hash, use
remove(). If you want to modify the value of an item, use
@@ -1089,7 +1089,7 @@
Example:
- \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 39
+ \snippet doc/src/snippets/code/doc_src_qiterator.cpp 39
The example removes all (key, value) pairs where the key and the
value are the same.
diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp
index c548663..9e13fcc 100644
--- a/src/corelib/tools/qmap.cpp
+++ b/src/corelib/tools/qmap.cpp
@@ -1087,7 +1087,7 @@ void QMapData::dump()
\overload
- The prefix -- operator (\c{--i}) makes the preceding item
+ The postfix -- operator (\c{i--}) makes the preceding item
current and returns an iterator pointing to the previously
current item.
*/
diff --git a/src/corelib/tools/qpair.qdoc b/src/corelib/tools/qpair.qdoc
index b900c4f..925100d 100644
--- a/src/corelib/tools/qpair.qdoc
+++ b/src/corelib/tools/qpair.qdoc
@@ -40,12 +40,12 @@
Here's an example of a QPair that stores one QString and one \c
double value:
- \snippet doc/src/snippets/code/doc_src_qpair.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qpair.cpp 0
The components are accessible as public data members called \l
first and \l second. For example:
- \snippet doc/src/snippets/code/doc_src_qpair.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qpair.cpp 1
QPair's template data types (T1 and T2) must be \l{assignable
data types}. You cannot, for example, store a QWidget as a value;
@@ -186,7 +186,7 @@
Returns a QPair\<T1, T2\> that contains \a value1 and \a value2.
Example:
- \snippet doc/src/snippets/code/doc_src_qpair.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_qpair.cpp 2
This is equivalent to QPair<T1, T2>(\a value1, \a value2), but
usually requires less typing.
diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc
index 30880d5..8748fd9 100644
--- a/src/corelib/tools/qset.qdoc
+++ b/src/corelib/tools/qset.qdoc
@@ -40,19 +40,19 @@
Here's an example QSet with QString values:
- \snippet doc/src/snippets/code/doc_src_qset.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qset.cpp 0
To insert a value into the set, use insert():
- \snippet doc/src/snippets/code/doc_src_qset.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qset.cpp 1
Another way to insert items into the set is to use operator<<():
- \snippet doc/src/snippets/code/doc_src_qset.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_qset.cpp 2
To test whether an item belongs to the set or not, use contains():
- \snippet doc/src/snippets/code/doc_src_qset.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_qset.cpp 3
If you want to navigate through all the values stored in a QSet,
you can use an iterator. QSet supports both \l{Java-style
@@ -60,18 +60,18 @@
iterators} (QSet::iterator and QSet::const_iterator). Here's how
to iterate over a QSet<QWidget *> using a Java-style iterator:
- \snippet doc/src/snippets/code/doc_src_qset.qdoc 4
+ \snippet doc/src/snippets/code/doc_src_qset.cpp 4
Here's the same code, but using an STL-style iterator:
- \snippet doc/src/snippets/code/doc_src_qset.qdoc 5
+ \snippet doc/src/snippets/code/doc_src_qset.cpp 5
QSet is unordered, so an iterator's sequence cannot be assumed to
be predictable. If ordering by key is required, use a QMap.
To navigate through a QSet, you can also use \l{foreach}:
- \snippet doc/src/snippets/code/doc_src_qset.qdoc 6
+ \snippet doc/src/snippets/code/doc_src_qset.cpp 6
Items can be removed from the set using remove(). There is also a
clear() function that removes all items.
@@ -194,7 +194,7 @@
This function is useful for code that needs to build a huge set
and wants to avoid repeated reallocation. For example:
- \snippet doc/src/snippets/code/doc_src_qset.qdoc 7
+ \snippet doc/src/snippets/code/doc_src_qset.cpp 7
Ideally, \a size should be slightly more than the maximum number
of elements expected in the set. \a size doesn't have to be prime,
@@ -610,18 +610,18 @@
start iterating. Here's a typical loop that prints all the items
stored in a set:
- \snippet doc/src/snippets/code/doc_src_qset.qdoc 8
+ \snippet doc/src/snippets/code/doc_src_qset.cpp 8
Here's a loop that removes certain items (all those that start
with 'J') from a set while iterating:
- \snippet doc/src/snippets/code/doc_src_qset.qdoc 9
+ \snippet doc/src/snippets/code/doc_src_qset.cpp 9
STL-style iterators can be used as arguments to \l{generic
algorithms}. For example, here's how to find an item in the set
using the qFind() algorithm:
- \snippet doc/src/snippets/code/doc_src_qset.qdoc 10
+ \snippet doc/src/snippets/code/doc_src_qset.cpp 10
Multiple iterators can be used on the same set. However, you may
not attempt to modify the container while iterating on it.
@@ -653,13 +653,13 @@
start iterating. Here's a typical loop that prints all the items
stored in a set:
- \snippet doc/src/snippets/code/doc_src_qset.qdoc 11
+ \snippet doc/src/snippets/code/doc_src_qset.cpp 11
STL-style iterators can be used as arguments to \l{generic
algorithms}. For example, here's how to find an item in the set
using the qFind() algorithm:
- \snippet doc/src/snippets/code/doc_src_qset.qdoc 12
+ \snippet doc/src/snippets/code/doc_src_qset.cpp 12
Multiple iterators can be used on the same set. However, you may
not attempt to modify the container while iterating on it.
@@ -893,7 +893,7 @@
Example:
- \snippet doc/src/snippets/code/doc_src_qset.qdoc 13
+ \snippet doc/src/snippets/code/doc_src_qset.cpp 13
\sa fromList(), QList::fromSet(), qSort()
*/
@@ -918,7 +918,7 @@
Example:
- \snippet doc/src/snippets/code/doc_src_qset.qdoc 14
+ \snippet doc/src/snippets/code/doc_src_qset.cpp 14
\sa toList(), QList::toSet()
*/
diff --git a/src/corelib/tools/qtextboundaryfinder.cpp b/src/corelib/tools/qtextboundaryfinder.cpp
index c2bb094..34bc406 100644
--- a/src/corelib/tools/qtextboundaryfinder.cpp
+++ b/src/corelib/tools/qtextboundaryfinder.cpp
@@ -457,33 +457,23 @@ QTextBoundaryFinder::BoundaryReasons QTextBoundaryFinder::boundaryReasons() cons
return NotAtBoundary;
return StartWord;
}
- if (pos >= length - 1) {
+ if (pos == length) {
if (d->attributes[length-1].whiteSpace)
return NotAtBoundary;
return EndWord;
}
- BoundaryReasons answer;
- const bool nextIsSpace = d->attributes[pos + 1].whiteSpace;
+ const bool nextIsSpace = d->attributes[pos].whiteSpace;
const bool prevIsSpace = d->attributes[pos - 1].whiteSpace;
- if (d->attributes[pos].whiteSpace)
- answer = EndWord;
- else if (!prevIsSpace) {
- answer = StartWord;
- answer |= EndWord;
- }
-
- if (prevIsSpace)
- answer |= StartWord;
- if (nextIsSpace)
- answer |= EndWord;
- if (answer == 0) {
- answer = StartWord;
- answer |= EndWord;
- }
-
- return answer;
+ if (prevIsSpace && !nextIsSpace)
+ return StartWord;
+ else if (!prevIsSpace && nextIsSpace)
+ return EndWord;
+ else if (!prevIsSpace && !nextIsSpace)
+ return BoundaryReasons(StartWord | EndWord);
+ else
+ return NotAtBoundary;
}
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc
index 957bca7..3c80c1c 100644
--- a/src/corelib/tools/qvarlengtharray.qdoc
+++ b/src/corelib/tools/qvarlengtharray.qdoc
@@ -35,12 +35,12 @@
The C++ language doesn't support variable-length arrays on the stack.
For example, the following code won't compile:
- \snippet doc/src/snippets/code/doc_src_qvarlengtharray.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qvarlengtharray.cpp 0
The alternative is to allocate the array on the heap (with
\c{new}):
- \snippet doc/src/snippets/code/doc_src_qvarlengtharray.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qvarlengtharray.cpp 1
However, if myfunc() is called very frequently from the
application's inner loop, heap allocation can be a major source
@@ -53,7 +53,7 @@
it is much faster than heap allocation.
Example:
- \snippet doc/src/snippets/code/doc_src_qvarlengtharray.qdoc 2
+ \snippet doc/src/snippets/code/doc_src_qvarlengtharray.cpp 2
In the example above, QVarLengthArray will preallocate 1024
elements on the stack and use them unless \c{n + 1} is greater
@@ -223,7 +223,7 @@
be used to access and modify the items in the array.
Example:
- \snippet doc/src/snippets/code/doc_src_qvarlengtharray.qdoc 3
+ \snippet doc/src/snippets/code/doc_src_qvarlengtharray.cpp 3
The pointer remains valid as long as the array isn't reallocated.