diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-26 23:32:43 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-26 23:32:43 -0600 |
commit | ea318d1431c89e647598c510c4245c6571aa5f46 (patch) | |
tree | 996d29b80c30d453dda86d1a23162d441628f169 /doc/html/qdeepcopy.html | |
parent | aaf89d4b48f69c9293feb187db26362e550b5561 (diff) | |
download | tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.tar.gz tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.zip |
Update to latest tqt3 automated conversion
Diffstat (limited to 'doc/html/qdeepcopy.html')
-rw-r--r-- | doc/html/qdeepcopy.html | 168 |
1 files changed, 0 insertions, 168 deletions
diff --git a/doc/html/qdeepcopy.html b/doc/html/qdeepcopy.html deleted file mode 100644 index 2d6a01c23..000000000 --- a/doc/html/qdeepcopy.html +++ /dev/null @@ -1,168 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> -<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/tools/qdeepcopy.cpp:40 --> -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> -<title>TQDeepCopy Class</title> -<style type="text/css"><!-- -fn { margin-left: 1cm; text-indent: -1cm; } -a:link { color: #004faf; text-decoration: none } -a:visited { color: #672967; text-decoration: none } -body { background: #ffffff; color: black; } ---></style> -</head> -<body> - -<table border="0" cellpadding="0" cellspacing="0" width="100%"> -<tr bgcolor="#E5E5E5"> -<td valign=center> - <a href="index.html"> -<font color="#004faf">Home</font></a> - | <a href="classes.html"> -<font color="#004faf">All Classes</font></a> - | <a href="mainclasses.html"> -<font color="#004faf">Main Classes</font></a> - | <a href="annotated.html"> -<font color="#004faf">Annotated</font></a> - | <a href="groups.html"> -<font color="#004faf">Grouped Classes</font></a> - | <a href="functions.html"> -<font color="#004faf">Functions</font></a> -</td> -<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQDeepCopy Class Reference</h1> - -<p>The TQDeepCopy class is a template class which ensures that -implicitly shared and explicitly shared classes reference unique -data. -<a href="#details">More...</a> -<p>All the functions in this class are <a href="threads.html#reentrant">reentrant</a> when TQt is built with thread support.</p> -<p><tt>#include <<a href="qdeepcopy-h.html">qdeepcopy.h</a>></tt> -<p><a href="qdeepcopy-members.html">List of all member functions.</a> -<h2>Public Members</h2> -<ul> -<li class=fn><a href="#TQDeepCopy"><b>TQDeepCopy</b></a> ()</li> -<li class=fn><a href="#TQDeepCopy-2"><b>TQDeepCopy</b></a> ( const T & t )</li> -<li class=fn>TQDeepCopy<T> & <a href="#operator-eq"><b>operator=</b></a> ( const T & t )</li> -<li class=fn><a href="#operator-T"><b>operator T</b></a> ()</li> -</ul> -<hr><a name="details"></a><h2>Detailed Description</h2> - - -The TQDeepCopy class is a template class which ensures that -<a href="shclass.html#implicitly-shared">implicitly shared</a> and <a href="shclass.html#explicitly-shared">explicitly shared</a> classes reference unique -data. -<p> -<p> - -<p> Normally, shared copies reference the same data to optimize memory -use and for maximum speed. In the example below, <tt>s1</tt>, <tt>s2</tt>, <tt>s3</tt>, <tt>s4</tt> and <tt>s5</tt> share data. -<p> <pre> - // all 5 strings share the same data - <a href="qstring.html">TQString</a> s1 = "abcd"; - <a href="qstring.html">TQString</a> s2 = s1; - <a href="qstring.html">TQString</a> s3 = s2; - <a href="qstring.html">TQString</a> s4 = s3; - <a href="qstring.html">TQString</a> s5 = s2; - </pre> - -<p> TQDeepCopy can be used several ways to ensure that an object -references unique, unshared data. In the example below, <tt>s1</tt>, <tt>s2</tt> and <tt>s5</tt> share data, while neither <tt>s3</tt> nor <tt>s4</tt> share data. -<pre> - // s1, s2 and s5 share the same data, neither s3 nor s4 are shared - <a href="qstring.html">TQString</a> s1 = "abcd"; - <a href="qstring.html">TQString</a> s2 = s1; - TQDeepCopy<TQString> s3 = s2; // s3 is a <a href="shclass.html#deep-copy">deep copy</a> of s2 - <a href="qstring.html">TQString</a> s4 = s3; // s4 is a deep copy of s3 - <a href="qstring.html">TQString</a> s5 = s2; - </pre> - -<p> In the example below, <tt>s1</tt>, <tt>s2</tt> and <tt>s5</tt> share data, and <tt>s3</tt> -and <tt>s4</tt> share data. -<pre> - // s1, s2 and s5 share the same data, s3 and s4 share the same data - <a href="qstring.html">TQString</a> s1 = "abcd"; - <a href="qstring.html">TQString</a> s2 = s1; - <a href="qstring.html">TQString</a> s3 = TQDeepCopy<TQString>( s2 ); // s3 is a deep copy of s2 - <a href="qstring.html">TQString</a> s4 = s3; // s4 is a <a href="shclass.html#shallow-copy">shallow copy</a> of s3 - <a href="qstring.html">TQString</a> s5 = s2; - </pre> - -<p> TQDeepCopy can also provide safety in multithreaded applications -that use shared classes. In the example below, the variable <tt>global_string</tt> is used safely since the data contained in <tt>global_string</tt> is always a deep copy. This ensures that all threads -get a unique copy of the data, and that any assignments to <tt>global_string</tt> will result in a deep copy. -<p> <pre> - TQDeepCopy<TQString> global_string; // global string data - <a href="qmutex.html">TQMutex</a> global_mutex; // mutex to protext global_string - - ... - - void setGlobalString( const <a href="qstring.html">TQString</a> &str ) - { - global_mutex.<a href="qmutex.html#lock">lock</a>(); - global_string = str; // global_string is a deep copy of str - global_mutex.<a href="qmutex.html#unlock">unlock</a>(); - } - - ... - - void MyThread::run() - { - global_mutex.<a href="qmutex.html#lock">lock</a>(); - <a href="qstring.html">TQString</a> str = global_string; // str is a deep copy of global_string - global_mutex.<a href="qmutex.html#unlock">unlock</a>(); - - // process the string data - ... - - // update global_string - setGlobalString( str ); - } - </pre> - -<p> <b>Warning:</b> It is the application developer's responsibility to -protect the object shared across multiple threads. -<p> The examples above use <a href="qstring.html">TQString</a>, which is an implicitly shared -class. The behavior of TQDeepCopy is the same when using explicitly -shared classes like <a href="qbytearray.html">TQByteArray</a>. -<p> Currently, TQDeepCopy works with the following classes: -<ul> -<li> <a href="qmemarray.html">TQMemArray</a> (including subclasses like TQByteArray and <a href="qcstring.html">TQCString</a>) -<li> <a href="qmap.html">TQMap</a> -<li> TQString -<li> <a href="qvaluelist.html">TQValueList</a> (including subclasses like <a href="qstringlist.html">TQStringList</a> and <a href="qvaluestack.html">TQValueStack</a>) -<li> <a href="qvaluevector.html">TQValueVector</a> -</ul> -<p> <p>See also <a href="threads.html">Thread Support in TQt</a>, <a href="shared.html">Implicitly and Explicitly Shared Classes</a>, and <a href="tools.html">Non-GUI Classes</a>. - -<hr><h2>Member Function Documentation</h2> -<h3 class=fn><a name="TQDeepCopy"></a>TQDeepCopy::TQDeepCopy () -</h3> - -<p> Constructs an empty instance of type <em>T</em>. - -<h3 class=fn><a name="TQDeepCopy-2"></a>TQDeepCopy::TQDeepCopy ( const T & t ) -</h3> - -<p> Constructs a <a href="shclass.html#deep-copy">deep copy</a> of <em>t</em>. - -<h3 class=fn><a name="operator-T"></a>TQDeepCopy::operator T () -</h3> - -<p> Returns a <a href="shclass.html#deep-copy">deep copy</a> of the encapsulated data. - -<h3 class=fn><a href="qdeepcopy.html">TQDeepCopy</a><T> & <a name="operator-eq"></a>TQDeepCopy::operator= ( const T & t ) -</h3> - -<p> Assigns a <a href="shclass.html#deep-copy">deep copy</a> of <em>t</em>. - -<!-- eof --> -<hr><p> -This file is part of the <a href="index.html">TQt toolkit</a>. -Copyright © 1995-2007 -<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center> -<table width=100% cellspacing=0 border=0><tr> -<td>Copyright © 2007 -<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a> -<td align=right><div align=right>TQt 3.3.8</div> -</table></div></address></body> -</html> |