You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/doc/html/qtranslatormessage.html

227 lines
13 KiB

<!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/kernel/qtranslator.cpp:1118 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQTranslatorMessage 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&nbsp;Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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>TQTranslatorMessage Class Reference</h1>
<p>The TQTranslatorMessage class contains a translator message and its
properties.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qtranslator-h.html">ntqtranslator.h</a>&gt;</tt>
<p><a href="qtranslatormessage-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQTranslatorMessage"><b>TQTranslatorMessage</b></a> ()</li>
<li class=fn><a href="#TQTranslatorMessage-2"><b>TQTranslatorMessage</b></a> ( const&nbsp;char&nbsp;*&nbsp;context, const&nbsp;char&nbsp;*&nbsp;sourceText, const&nbsp;char&nbsp;*&nbsp;comment, const&nbsp;TQString&nbsp;&amp;&nbsp;translation = TQString::null )</li>
<li class=fn><a href="#TQTranslatorMessage-3"><b>TQTranslatorMessage</b></a> ( TQDataStream&nbsp;&amp;&nbsp;stream )</li>
<li class=fn><a href="#TQTranslatorMessage-4"><b>TQTranslatorMessage</b></a> ( const&nbsp;TQTranslatorMessage&nbsp;&amp;&nbsp;m )</li>
<li class=fn>TQTranslatorMessage &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;TQTranslatorMessage&nbsp;&amp;&nbsp;m )</li>
<li class=fn>uint <a href="#hash"><b>hash</b></a> () const</li>
<li class=fn>const char * <a href="#context"><b>context</b></a> () const</li>
<li class=fn>const char * <a href="#sourceText"><b>sourceText</b></a> () const</li>
<li class=fn>const char * <a href="#comment"><b>comment</b></a> () const</li>
<li class=fn>void <a href="#setTranslation"><b>setTranslation</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;translation )</li>
<li class=fn>TQString <a href="#translation"><b>translation</b></a> () const</li>
<li class=fn>enum <a href="#Prefix-enum"><b>Prefix</b></a> { NoPrefix, Hash, HashContext, HashContextSourceText, HashContextSourceTextComment }</li>
<li class=fn>void <a href="#write"><b>write</b></a> ( TQDataStream&nbsp;&amp;&nbsp;stream, bool&nbsp;strip = FALSE, Prefix&nbsp;prefix = HashContextSourceTextComment ) const</li>
<li class=fn>Prefix <a href="#commonPrefix"><b>commonPrefix</b></a> ( const&nbsp;TQTranslatorMessage&nbsp;&amp;&nbsp;m ) const</li>
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;TQTranslatorMessage&nbsp;&amp;&nbsp;m ) const</li>
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const&nbsp;TQTranslatorMessage&nbsp;&amp;&nbsp;m ) const</li>
<li class=fn>bool <a href="#operator-lt"><b>operator&lt;</b></a> ( const&nbsp;TQTranslatorMessage&nbsp;&amp;&nbsp;m ) const</li>
<li class=fn>bool <a href="#operator-lt-eq"><b>operator&lt;=</b></a> ( const&nbsp;TQTranslatorMessage&nbsp;&amp;&nbsp;m ) const</li>
<li class=fn>bool <a href="#operator-gt"><b>operator&gt;</b></a> ( const&nbsp;TQTranslatorMessage&nbsp;&amp;&nbsp;m ) const</li>
<li class=fn>bool <a href="#operator-gt-eq"><b>operator&gt;=</b></a> ( const&nbsp;TQTranslatorMessage&nbsp;&amp;&nbsp;m ) const</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
<p> The TQTranslatorMessage class contains a translator message and its
properties.
<p>
<p> This class is of no interest to most applications. It is useful
for translation tools such as <a href="linguist-manual.html">TQt
Linguist</a>. It is provided simply to make the API complete
and regular.
<p> For a <a href="ntqtranslator.html">TQTranslator</a> object, a lookup key is a triple (<em>context</em>, <em>source text</em>, <em>comment</em>) that uniquely identifies a message. An
extended key is a quadruple (<em>hash</em>, <em>context</em>, <em>source text</em>, <em>comment</em>), where <em>hash</em> is computed from the source text
and the comment. Unless you plan to read and write messages
yourself, you need not worry about the hash value.
<p> TQTranslatorMessage stores this triple or quadruple and the relevant
translation if there is any.
<p> <p>See also <a href="ntqtranslator.html">TQTranslator</a>, <a href="environment.html">Environment Classes</a>, and <a href="i18n.html">Internationalization with TQt</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="Prefix-enum"></a>TQTranslatorMessage::Prefix</h3>
<p> Let (<em>h</em>, <em>c</em>, <em>s</em>, <em>m</em>) be the extended key. The possible
prefixes are
<ul>
<li><tt>TQTranslatorMessage::NoPrefix</tt> - no prefix
<li><tt>TQTranslatorMessage::Hash</tt> - only (<em>h</em>)
<li><tt>TQTranslatorMessage::HashContext</tt> - only (<em>h</em>, <em>c</em>)
<li><tt>TQTranslatorMessage::HashContextSourceText</tt> - only (<em>h</em>, <em>c</em>, <em>s</em>)
<li><tt>TQTranslatorMessage::HashContextSourceTextComment</tt> - the whole extended key, (<em>h</em>, <em>c</em>, <em>s</em>, <em>m</em>)
</ul><p> <p>See also <a href="#write">write</a>() and <a href="#commonPrefix">commonPrefix</a>().
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQTranslatorMessage"></a>TQTranslatorMessage::TQTranslatorMessage ()
</h3>
Constructs a translator message with the extended key (0, 0, 0, 0)
and <a href="tqstring.html#TQString-null">TQString::null</a> as translation.
<h3 class=fn><a name="TQTranslatorMessage-2"></a>TQTranslatorMessage::TQTranslatorMessage ( const&nbsp;char&nbsp;*&nbsp;context, const&nbsp;char&nbsp;*&nbsp;sourceText, const&nbsp;char&nbsp;*&nbsp;comment, const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;translation = TQString::null )
</h3>
Constructs an translator message with the extended key (<em>h</em>, <em>context</em>, <em>sourceText</em>, <em>comment</em>), where <em>h</em> is computed from
<em>sourceText</em> and <em>comment</em>, and possibly with a <em>translation</em>.
<h3 class=fn><a name="TQTranslatorMessage-3"></a>TQTranslatorMessage::TQTranslatorMessage ( <a href="tqdatastream.html">TQDataStream</a>&nbsp;&amp;&nbsp;stream )
</h3>
Constructs a translator message read from the <em>stream</em>. The
resulting message may have any combination of content.
<p> <p>See also <a href="ntqtranslator.html#save">TQTranslator::save</a>().
<h3 class=fn><a name="TQTranslatorMessage-4"></a>TQTranslatorMessage::TQTranslatorMessage ( const&nbsp;<a href="qtranslatormessage.html">TQTranslatorMessage</a>&nbsp;&amp;&nbsp;m )
</h3>
Constructs a copy of translator message <em>m</em>.
<h3 class=fn>const char * <a name="comment"></a>TQTranslatorMessage::comment () const
</h3>
<p> Returns the comment for this message (e.g. "File|Save").
<p> <b>Warning:</b> This may return 0 if the <a href="ntqtranslator.html">TQTranslator</a> object is stripped
(compressed).
<h3 class=fn><a href="qtranslatormessage.html#Prefix-enum">Prefix</a> <a name="commonPrefix"></a>TQTranslatorMessage::commonPrefix ( const&nbsp;<a href="qtranslatormessage.html">TQTranslatorMessage</a>&nbsp;&amp;&nbsp;m ) const
</h3>
Returns the widest lookup prefix that is common to this translator
message and to message <em>m</em>.
<p> For example, if the extended key is for this message is (71,
"PrintDialog", "Yes", "Print?") and that for <em>m</em> is (71,
"PrintDialog", "No", "Print?"), this function returns <a href="#Prefix-enum">HashContext</a>.
<p> <p>See also <a href="#write">write</a>().
<h3 class=fn>const char * <a name="context"></a>TQTranslatorMessage::context () const
</h3>
<p> Returns the context for this message (e.g. "MyDialog").
<p> <b>Warning:</b> This may return 0 if the <a href="ntqtranslator.html">TQTranslator</a> object is stripped
(compressed).
<h3 class=fn>uint <a name="hash"></a>TQTranslatorMessage::hash () const
</h3>
<p> Returns the hash value used internally to represent the lookup
key. This value is zero only if this translator message was
constructed from a stream containing invalid data.
<p> The hashing function is unspecified, but it will remain unchanged
in future versions of TQt.
<h3 class=fn>bool <a name="operator!-eq"></a>TQTranslatorMessage::operator!= ( const&nbsp;<a href="qtranslatormessage.html">TQTranslatorMessage</a>&nbsp;&amp;&nbsp;m ) const
</h3>
<p> Returns TRUE if the extended key of this object is different from
that of <em>m</em>; otherwise returns FALSE.
<h3 class=fn>bool <a name="operator-lt"></a>TQTranslatorMessage::operator&lt; ( const&nbsp;<a href="qtranslatormessage.html">TQTranslatorMessage</a>&nbsp;&amp;&nbsp;m ) const
</h3>
Returns TRUE if the extended key of this object is
lexicographically before than that of <em>m</em>; otherwise returns
FALSE.
<h3 class=fn>bool <a name="operator-lt-eq"></a>TQTranslatorMessage::operator&lt;= ( const&nbsp;<a href="qtranslatormessage.html">TQTranslatorMessage</a>&nbsp;&amp;&nbsp;m ) const
</h3>
<p> Returns TRUE if the extended key of this object is
lexicographically before that of <em>m</em> or if they are equal;
otherwise returns FALSE.
<h3 class=fn><a href="qtranslatormessage.html">TQTranslatorMessage</a>&nbsp;&amp; <a name="operator-eq"></a>TQTranslatorMessage::operator= ( const&nbsp;<a href="qtranslatormessage.html">TQTranslatorMessage</a>&nbsp;&amp;&nbsp;m )
</h3>
Assigns message <em>m</em> to this translator message and returns a
reference to this translator message.
<h3 class=fn>bool <a name="operator-eq-eq"></a>TQTranslatorMessage::operator== ( const&nbsp;<a href="qtranslatormessage.html">TQTranslatorMessage</a>&nbsp;&amp;&nbsp;m ) const
</h3>
Returns TRUE if the extended key of this object is equal to that of
<em>m</em>; otherwise returns FALSE.
<h3 class=fn>bool <a name="operator-gt"></a>TQTranslatorMessage::operator&gt; ( const&nbsp;<a href="qtranslatormessage.html">TQTranslatorMessage</a>&nbsp;&amp;&nbsp;m ) const
</h3>
<p> Returns TRUE if the extended key of this object is
lexicographically after that of <em>m</em>; otherwise returns FALSE.
<h3 class=fn>bool <a name="operator-gt-eq"></a>TQTranslatorMessage::operator&gt;= ( const&nbsp;<a href="qtranslatormessage.html">TQTranslatorMessage</a>&nbsp;&amp;&nbsp;m ) const
</h3>
<p> Returns TRUE if the extended key of this object is
lexicographically after that of <em>m</em> or if they are equal;
otherwise returns FALSE.
<h3 class=fn>void <a name="setTranslation"></a>TQTranslatorMessage::setTranslation ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;translation )
</h3>
<p> Sets the translation of the source text to <em>translation</em>.
<p> <p>See also <a href="#translation">translation</a>().
<h3 class=fn>const char * <a name="sourceText"></a>TQTranslatorMessage::sourceText () const
</h3>
<p> Returns the source text of this message (e.g. "&Save").
<p> <b>Warning:</b> This may return 0 if the <a href="ntqtranslator.html">TQTranslator</a> object is stripped
(compressed).
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="translation"></a>TQTranslatorMessage::translation () const
</h3>
<p> Returns the translation of the source text (e.g., "&Sauvegarder").
<p> <p>See also <a href="#setTranslation">setTranslation</a>().
<h3 class=fn>void <a name="write"></a>TQTranslatorMessage::write ( <a href="tqdatastream.html">TQDataStream</a>&nbsp;&amp;&nbsp;stream, bool&nbsp;strip = FALSE, <a href="qtranslatormessage.html#Prefix-enum">Prefix</a>&nbsp;prefix = HashContextSourceTextComment ) const
</h3>
Writes this translator message to the <em>stream</em>. If <em>strip</em> is
FALSE (the default), all the information in the message is
written. If <em>strip</em> is TRUE, only the part of the extended key
specified by <em>prefix</em> is written with the translation (<a href="#Prefix-enum">HashContextSourceTextComment</a> by default).
<p> <p>See also <a href="#commonPrefix">commonPrefix</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright &copy; 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 &copy; 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>