summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorMartin Smith <msmith@trolltech.com>2009-06-18 10:08:45 (GMT)
committerMartin Smith <msmith@trolltech.com>2009-06-18 10:09:26 (GMT)
commita9e11b46bdcbc93d89078f0fcca1e7ac91975ffc (patch)
tree4ea1b4eddfade97bbe48b79272d0edb6a3732f87 /doc
parente9247f1da01f20ecd9e70b47286e7eb68bae892a (diff)
downloadQt-a9e11b46bdcbc93d89078f0fcca1e7ac91975ffc.zip
Qt-a9e11b46bdcbc93d89078f0fcca1e7ac91975ffc.tar.gz
Qt-a9e11b46bdcbc93d89078f0fcca1e7ac91975ffc.tar.bz2
doc: Added explanation of QStringBuilder in QString
The QStringBuilder class documentation is marked \internal. A section has been added to the documentation for QString that explains how to use the reimplemented '%' operator of QStringBuilder to obtain more efficient string concatenation operations.
Diffstat (limited to 'doc')
-rw-r--r--doc/src/snippets/qstring/stringbuilder.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/doc/src/snippets/qstring/stringbuilder.cpp b/doc/src/snippets/qstring/stringbuilder.cpp
new file mode 100644
index 0000000..90803e2
--- /dev/null
+++ b/doc/src/snippets/qstring/stringbuilder.cpp
@@ -0,0 +1,28 @@
+
+//! [0]
+ QString foo;
+ QString type = "long";
+
+ foo->setText(QLatin1String("vector<") + type + QLatin1String(">::iterator"));
+
+ if (foo.startsWith("(" + type + ") 0x"))
+ ...
+//! [0]
+
+//! [3]
+ #define QT_USE_FAST_CONCATENATION
+//! [3]
+
+//! [4]
+ #define QT_USE_FAST_CONCATENATION
+ #define QT_USE_FAST_OPERATOR_PLUS
+//! [4]
+
+//! [5]
+ #include <QStringBuilder>
+
+ QString hello("hello");
+ QStringRef el(&hello, 2, 3);
+ QLatin1String world("world");
+ QString message = hello % el % world % QChar('!');
+//! [5]