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.
qt3/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>QTranslatorMessage 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>QTranslatorMessage Class Reference</h1>
<p>The QTranslatorMessage class contains a translator message and its
properties.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qtranslator-h.html">qtranslator.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="#QTranslatorMessage"><b>QTranslatorMessage</b></a> ()</li>
<li class=fn><a href="#QTranslatorMessage-2"><b>QTranslatorMessage</b></a> ( const&nbsp;char&nbsp;*&nbsp;context, const&nbsp;char&nbsp;*&nbsp;sourceText, const&nbsp;char&nbsp;*&nbsp;comment, const&nbsp;QString&nbsp;&amp;&nbsp;translation = QString::null )</li>
<li class=fn><a href="#QTranslatorMessage-3"><b>QTranslatorMessage</b></a> ( QDataStream&nbsp;&amp;&nbsp;stream )</li>
<li class=fn><a href="#QTranslatorMessage-4"><b>QTranslatorMessage</b></a> ( const&nbsp;QTranslatorMessage&nbsp;&amp;&nbsp;m )</li>
<li class=fn>QTranslatorMessage &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;QTranslatorMessage&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;QString&nbsp;&amp;&nbsp;translation )</li>
<li class=fn>QString <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> ( QDataStream&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;QTranslatorMessage&nbsp;&amp;&nbsp;m ) const</li>
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;QTranslatorMessage&nbsp;&amp;&nbsp;m ) const</li>
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const&nbsp;QTranslatorMessage&nbsp;&amp;&nbsp;m ) const</li>
<li class=fn>bool <a href="#operator-lt"><b>operator&lt;</b></a> ( const&nbsp;QTranslatorMessage&nbsp;&amp;&nbsp;m ) const</li>
<li class=fn>bool <a href="#operator-lt-eq"><b>operator&lt;=</b></a> ( const&nbsp;QTranslatorMessage&nbsp;&amp;&nbsp;m ) const</li>
<li class=fn>bool <a href="#operator-gt"><b>operator&gt;</b></a> ( const&nbsp;QTranslatorMessage&nbsp;&amp;&nbsp;m ) const</li>
<li class=fn>bool <a href="#operator-gt-eq"><b>operator&gt;=</b></a> ( const&nbsp;QTranslatorMessage&nbsp;&amp;&nbsp;m ) const</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
<p> The QTranslatorMessage 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">Qt
Linguist</a>. It is provided simply to make the API complete
and regular.
<p> For a <a href="qtranslator.html">QTranslator</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> QTranslatorMessage stores this triple or quadruple and the relevant
translation if there is any.
<p> <p>See also <a href="qtranslator.html">QTranslator</a>, <a href="environment.html">Environment Classes</a>, and <a href="i18n.html">Internationalization with Qt</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="Prefix-enum"></a>QTranslatorMessage::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>QTranslatorMessage::NoPrefix</tt> - no prefix
<li><tt>QTranslatorMessage::Hash</tt> - only (<em>h</em>)
<li><tt>QTranslatorMessage::HashContext</tt> - only (<em>h</em>, <em>c</em>)
<li><tt>QTranslatorMessage::HashContextSourceText</tt> - only (<em>h</em>, <em>c</em>, <em>s</em>)
<li><tt>QTranslatorMessage::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="QTranslatorMessage"></a>QTranslatorMessage::QTranslatorMessage ()
</h3>
Constructs a translator message with the extended key (0, 0, 0, 0)
and <a href="qstring.html#QString-null">QString::null</a> as translation.
<h3 class=fn><a name="QTranslatorMessage-2"></a>QTranslatorMessage::QTranslatorMessage ( const&nbsp;char&nbsp;*&nbsp;context, const&nbsp;char&nbsp;*&nbsp;sourceText, const&nbsp;char&nbsp;*&nbsp;comment, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;translation = QString::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="QTranslatorMessage-3"></a>QTranslatorMessage::QTranslatorMessage ( <a href="qdatastream.html">QDataStream</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="qtranslator.html#save">QTranslator::save</a>().
<h3 class=fn><a name="QTranslatorMessage-4"></a>QTranslatorMessage::QTranslatorMessage ( const&nbsp;<a href="qtranslatormessage.html">QTranslatorMessage</a>&nbsp;&amp;&nbsp;m )
</h3>
Constructs a copy of translator message <em>m</em>.
<h3 class=fn>const char * <a name="comment"></a>QTranslatorMessage::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="qtranslator.html">QTranslator</a> object is stripped
(compressed).
<h3 class=fn><a href="qtranslatormessage.html#Prefix-enum">Prefix</a> <a name="commonPrefix"></a>QTranslatorMessage::commonPrefix ( const&nbsp;<a href="qtranslatormessage.html">QTranslatorMessage</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>QTranslatorMessage::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="qtranslator.html">QTranslator</a> object is stripped
(compressed).
<h3 class=fn>uint <a name="hash"></a>QTranslatorMessage::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 Qt.
<h3 class=fn>bool <a name="operator!-eq"></a>QTranslatorMessage::operator!= ( const&nbsp;<a href="qtranslatormessage.html">QTranslatorMessage</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>QTranslatorMessage::operator&lt; ( const&nbsp;<a href="qtranslatormessage.html">QTranslatorMessage</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>QTranslatorMessage::operator&lt;= ( const&nbsp;<a href="qtranslatormessage.html">QTranslatorMessage</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">QTranslatorMessage</a>&nbsp;&amp; <a name="operator-eq"></a>QTranslatorMessage::operator= ( const&nbsp;<a href="qtranslatormessage.html">QTranslatorMessage</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>QTranslatorMessage::operator== ( const&nbsp;<a href="qtranslatormessage.html">QTranslatorMessage</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>QTranslatorMessage::operator&gt; ( const&nbsp;<a href="qtranslatormessage.html">QTranslatorMessage</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>QTranslatorMessage::operator&gt;= ( const&nbsp;<a href="qtranslatormessage.html">QTranslatorMessage</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>QTranslatorMessage::setTranslation ( const&nbsp;<a href="qstring.html">QString</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>QTranslatorMessage::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="qtranslator.html">QTranslator</a> object is stripped
(compressed).
<h3 class=fn><a href="qstring.html">QString</a> <a name="translation"></a>QTranslatorMessage::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>QTranslatorMessage::write ( <a href="qdatastream.html">QDataStream</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">Qt 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>Qt 3.3.8</div>
</table></div></address></body>
</html>