From ea318d1431c89e647598c510c4245c6571aa5f46 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 26 Jan 2012 23:32:43 -0600 Subject: Update to latest tqt3 automated conversion --- doc/html/qt-template-lib.html | 92 +++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 46 deletions(-) (limited to 'doc/html/qt-template-lib.html') diff --git a/doc/html/qt-template-lib.html b/doc/html/qt-template-lib.html index 68f443778..f76eb0496 100644 --- a/doc/html/qt-template-lib.html +++ b/doc/html/qt-template-lib.html @@ -51,11 +51,11 @@ of the STL container API. Compared with the STL, TQTL has no platform differences, but is often a little slower and often expands to less object code.

If you cannot make copies of the objects you want to store you should -use TQPtrCollection and friends, all of which operate on pointers +use TQPtrCollection and friends, all of which operate on pointers rather than values. This applies, for example, to all classes derived -from TQObject. A TQObject does not have a copy constructor, so using +from TQObject. A TQObject does not have a copy constructor, so using it as value is impossible. You may choose to store pointers to -TQObjects in a TQValueList, but using TQPtrList directly seems to be the +TQObjects in a TQValueList, but using TQPtrList directly seems to be the better choice for this kind of application domain. TQPtrList, like all other TQPtrCollection based containers, provides far more sanity checking than a speed-optimized value based container. @@ -70,13 +70,13 @@ instead. Value semantics require at least:

Note that a fast copy constructor is absolutely crucial to achieve good overall performance of the container, since many copy operations will occur. -

If you intend sorting your data you must implement operator<() for +

If you intend sorting your data you must implement operator<() for your data's class. -

Good candidates for value based classes are TQRect, TQPoint, TQSize, -TQString and all simple C++ types, such as int, bool or double. +

Good candidates for value based classes are TQRect, TQPoint, TQSize, +TQString and all simple C++ types, such as int, bool or double.

The TQt Template Library is designed for speed. Iterators are extremely fast. To achieve this performance, less error checking is done than in -the TQPtrCollection based containers. A TQTL container, for example, +the TQPtrCollection based containers. A TQTL container, for example, does not track any associated iterators. This makes certain validity checks, for example when removing items, impossible to perform automatically, but does lead to extremely good performance. @@ -152,7 +152,7 @@ like this: those elements that fall between the two iterators, i.e. 100, 1234 and 12. The third example shows that iterators act like pointers and can be treated as such. -

If using your own data types you must implement operator<() for +

If using your own data types you must implement operator<() for your data's class.

Naturally, the sorting templates won't work with const iterators.

@@ -160,8 +160,8 @@ your data's class.

qSwap() exchanges the values of two variables:

-    TQString second( "Einstein" );
-    TQString name( "Albert" );
+    TQString second( "Einstein" );
+    TQString name( "Albert" );
     qSwap( second, name );
 
@@ -171,13 +171,13 @@ your data's class.

The qCount() template function counts the number of occurrences of a value within a container. For example:

-    TQValueList<int> list;
-    list.push_back( 1 );               
-    list.push_back( 1 );               
-    list.push_back( 1 );               
-    list.push_back( 2 );               
+    TQValueList<int> list;
+    list.push_back( 1 );               
+    list.push_back( 1 );               
+    list.push_back( 1 );               
+    list.push_back( 2 );               
     int c = 0;
-    qCount( list.begin(), list.end(), 1, c ); // c == 3
+    qCount( list.begin(), list.end(), 1, c ); // c == 3
 

@@ -186,12 +186,12 @@ value within a container. For example:

The qFind() template function finds the first occurrence of a value within a container. For example:

-    TQValueList<int> list;
-    list.push_back( 1 );               
-    list.push_back( 1 );               
-    list.push_back( 1 );               
-    list.push_back( 2 );               
-    TQValueListIterator<int> it = qFind( list.begin(), list.end(), 2 );
+    TQValueList<int> list;
+    list.push_back( 1 );               
+    list.push_back( 1 );               
+    list.push_back( 1 );               
+    list.push_back( 2 );               
+    TQValueListIterator<int> it = qFind( list.begin(), list.end(), 2 );
 

@@ -200,8 +200,8 @@ within a container. For example:

The qFill() template function fills a range with copies of a value. For example:

-    TQValueVector<int> vec(3);
-    qFill( vec.begin(), vec.end(), 99 ); // vec contains 99, 99, 99
+    TQValueVector<int> vec(3);
+    qFill( vec.begin(), vec.end(), 99 ); // vec contains 99, 99, 99
 

@@ -213,19 +213,19 @@ considered, only if the elements in the first range are equal to the corresponding elements in the second range (consequently, both ranges must be valid). For example:

-    TQValueVector<int> v1(3);
+    TQValueVector<int> v1(3);
     v1[0] = 1;
     v1[2] = 2;
     v1[3] = 3;
 
-    TQValueVector<int> v2(5);
+    TQValueVector<int> v2(5);
     v2[0] = 1;
     v2[2] = 2;
     v2[3] = 3;
     v2[4] = 4;
     v2[5] = 5;
 
-    bool b = qEqual( v1.begin(), v2.end(), v2.begin() );
+    bool b = qEqual( v1.begin(), v2.end(), v2.begin() );
     // b == TRUE
 
@@ -235,12 +235,12 @@ must be valid). For example:

The qCopy() template function copies a range of elements to an OutputIterator, in this case a TQTextOStreamIterator:

-    TQValueList<int> list;
-    list.push_back( 100 );
-    list.push_back( 200 );
-    list.push_back( 300 );
+    TQValueList<int> list;
+    list.push_back( 100 );
+    list.push_back( 200 );
+    list.push_back( 300 );
     TQTextOStream str( stdout );
-    qCopy( list.begin(), list.end(), TQTextOStreamIterator(str) );
+    qCopy( list.begin(), list.end(), TQTextOStreamIterator(str) );
 

@@ -250,12 +250,12 @@ OutputIterator, in this case a TQTextOStreamIterator:

The qCopyBackward() template function copies a container or a slice of a container to an OutputIterator, but in reverse order, for example:

-    TQValueVector<int> vec(3);
-    vec.push_back( 100 );
-    vec.push_back( 200 );
-    vec.push_back( 300 );
-    TQValueVector<int> another;
-    qCopyBackward( vec.begin(), vec.end(), another.begin() );
+    TQValueVector<int> vec(3);
+    vec.push_back( 100 );
+    vec.push_back( 200 );
+    vec.push_back( 300 );
+    TQValueVector<int> another;
+    qCopyBackward( vec.begin(), vec.end(), another.begin() );
     // 'another' now contains 100, 200, 300
     // however the elements are copied one at a time 
     // in reverse order (300, 200, then 100)
@@ -268,13 +268,13 @@ Just make sure that the right hand of the iterator has as many
 elements present as you want to insert. The following example
 illustrates this:
 

-    TQStringList list1, list2;
+    TQStringList list1, list2;
     list1 << "Weis" << "Ettrich" << "Arnt" << "Sue";
     list2 << "Torben" << "Matthias";
-    qCopy( list2.begin(), list2.end(), list1.begin() );
+    qCopy( list2.begin(), list2.end(), list1.begin() );
 
-    TQValueVector<TQString> vec( list1.size(), "Dave" );
-    qCopy( list2.begin(), list2.end(), vec.begin() );
+    TQValueVector<TQString> vec( list1.size(), "Dave" );
+    qCopy( list2.begin(), list2.end(), vec.begin() );
 

At the end of this code fragment, the list list1 contains "Torben", @@ -296,19 +296,19 @@ a standard C++ array with qCopy():

All the containers we've mentioned can be serialized with the appropriate streaming operators. Here is an example.

-    TQDataStream str(...);
-    TQValueList<TQRect> list;
+    TQDataStream str(...);
+    TQValueList<TQRect> list;
     // ... fill the list here
     str << list;
 

The container can be read in again with:

-    TQValueList<TQRect> list;
+    TQValueList<TQRect> list;
     str >> list;
 
-

The same applies to TQStringList, TQValueStack and TQMap. +

The same applies to TQStringList, TQValueStack and TQMap.


-- cgit v1.2.3