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/shclass.html | 84 +++++++++++++++++++++++++-------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) (limited to 'doc/html/shclass.html') diff --git a/doc/html/shclass.html b/doc/html/shclass.html index 416c211a6..814b32674 100644 --- a/doc/html/shclass.html +++ b/doc/html/shclass.html @@ -72,7 +72,7 @@ very fast, because it only involves setting a pointer and incrementing the reference count.

Object assignment (with operator=()) for implicitly and explicitly shared objects is implemented using shallow copies. A deep copy can be -made by calling a copy() function or by using TQDeepCopy. +made by calling a copy() function or by using TQDeepCopy.

The benefit of sharing is that a program does not need to duplicate data unnecessarily, which results in lower memory use and less copying of data. Objects can easily be assigned, sent as function arguments, @@ -93,9 +93,9 @@ Example: a = b; // 3: {12,34} {12,34} a[1] = 56; // 4: {12,56} {12,56} TQByteArray c = a; // 5: {12,56} {12,56} {12,56} - a.detach(); // 6: {12,56} {12,56} {12,56} + a.detach(); // 6: {12,56} {12,56} {12,56} a[1] = 78; // 7: {12,78} {12,56} {12,56} - b = a.copy(); // 8: {12,78} {12,78} {12,56} + b = a.copy(); // 8: {12,78} {12,78} {12,56} a[1] = 90; // 9: {12,90} {12,78} {12,56} @@ -128,7 +128,7 @@ TQByteArray know.

An implicitly shared class has total control of its internal data. In any member functions that modify its data, it automatically detaches before modifying the data. -

The TQPen class, which uses implicit sharing, detaches from the shared +

The TQPen class, which uses implicit sharing, detaches from the shared data in all member functions that change the internal data.

Code fragment:

@@ -149,50 +149,50 @@ data in all member functions that change the internal data.
 can do the following:
 

     TQByteArray array( 10 );
-    array.fill( 'a' );
+    array.fill( 'a' );
     array[0] = 'f';        // will modify array
-    array.data()[1] = 'i'; // will modify array
+    array.data()[1] = 'i'; // will modify array
 

If we monitor changes in a TQByteArray, the TQByteArray class would become unacceptably slow.

Explicitly Shared Classes

-

All classes that are instances of the TQMemArray template class are +

All classes that are instances of the TQMemArray template class are explicitly shared:

These classes have a detach() function that can be called if you want your object to get a private copy of the shared data. They also have a copy() function that returns a deep copy with a reference count of 1. -

The same is true for TQImage, which does not inherit TQMemArray. TQMovie is also explicitly shared, but it does not support detach() or +

The same is true for TQImage, which does not inherit TQMemArray. TQMovie is also explicitly shared, but it does not support detach() or copy().

Implicitly Shared Classes

The TQt classes that are implicitly shared are:

These classes automatically detach from common data if an object is about to be changed. The programmer will not even notice that the @@ -203,28 +203,28 @@ reason, you can pass instances of these classes as arguments to functions by value without concern for the copying overhead.

Example:

-    TQPixmap p1, p2;
-    p1.load( "image.bmp" );
+    TQPixmap p1, p2;
+    p1.load( "image.bmp" );
     p2 = p1;                    // p1 and p2 share data
-    TQPainter paint;
-    paint.begin( &p2 );         // cuts p2 loose from p1
-    paint.drawText( 0,50, "Hi" );
-    paint.end();
+    TQPainter paint;
+    paint.begin( &p2 );         // cuts p2 loose from p1
+    paint.drawText( 0,50, "Hi" );
+    paint.end();
 
-

In this example, p1 and p2 share data until TQPainter::begin() is +

In this example, p1 and p2 share data until TQPainter::begin() is called for p2, because painting a pixmap will modify it. The same -also happens if anything is bitBlt()'ed into +also happens if anything is bitBlt()'ed into p2. -

Warning: Do not copy an implicitly shared container (TQMap, -TQValueVector, etc.) while you are iterating over it. +

Warning: Do not copy an implicitly shared container (TQMap, +TQValueVector, etc.) while you are iterating over it.

TQCString: implicit or explicit?

-

TQCString uses a mixture of implicit and explicit sharing. Functions +

TQCString uses a mixture of implicit and explicit sharing. Functions inherited from TQByteArray, such as data(), employ explicit sharing, while -those only in TQCString detach automatically. Thus, TQCString is rather an +those only in TQCString detach automatically. Thus, TQCString is rather an "experts only" class, provided mainly to ease porting from TQt 1.x to TQt 2.0. -We recommend that you use TQString, a purely implicitly shared class. +We recommend that you use TQString, a purely implicitly shared class.


-- cgit v1.2.1