summaryrefslogtreecommitdiffstats
path: root/doc/html/tqtranslatormessage.html
blob: 103ede7888fd5abf4663723076bda192aceb36f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<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="tqtranslator-h.html">tqtranslator.h</a>&gt;</tt>
<p><a href="tqtranslatormessage-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="tqtranslator.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="tqtranslator.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="tqtranslator.html#save">TQTranslator::save</a>().

<h3 class=fn><a name="TQTranslatorMessage-4"></a>TQTranslatorMessage::TQTranslatorMessage ( const&nbsp;<a href="tqtranslatormessage.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="tqtranslator.html">TQTranslator</a> object is stripped
(compressed).

<h3 class=fn><a href="tqtranslatormessage.html#Prefix-enum">Prefix</a> <a name="commonPrefix"></a>TQTranslatorMessage::commonPrefix ( const&nbsp;<a href="tqtranslatormessage.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="tqtranslator.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="tqtranslatormessage.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="tqtranslatormessage.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="tqtranslatormessage.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="tqtranslatormessage.html">TQTranslatorMessage</a>&nbsp;&amp; <a name="operator-eq"></a>TQTranslatorMessage::operator= ( const&nbsp;<a href="tqtranslatormessage.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="tqtranslatormessage.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="tqtranslatormessage.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="tqtranslatormessage.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="tqtranslator.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="tqtranslatormessage.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>