[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qtranslator.cpp:1118 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QTranslatorMessage Class</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <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>
|
---|
| 33 |
|
---|
| 34 | <p>The QTranslatorMessage class contains a translator message and its
|
---|
| 35 | properties.
|
---|
| 36 | <a href="#details">More...</a>
|
---|
| 37 | <p><tt>#include <<a href="qtranslator-h.html">qtranslator.h</a>></tt>
|
---|
| 38 | <p><a href="qtranslatormessage-members.html">List of all member functions.</a>
|
---|
| 39 | <h2>Public Members</h2>
|
---|
| 40 | <ul>
|
---|
| 41 | <li class=fn><a href="#QTranslatorMessage"><b>QTranslatorMessage</b></a> ()</li>
|
---|
| 42 | <li class=fn><a href="#QTranslatorMessage-2"><b>QTranslatorMessage</b></a> ( const char * context, const char * sourceText, const char * comment, const QString & translation = QString::null )</li>
|
---|
| 43 | <li class=fn><a href="#QTranslatorMessage-3"><b>QTranslatorMessage</b></a> ( QDataStream & stream )</li>
|
---|
| 44 | <li class=fn><a href="#QTranslatorMessage-4"><b>QTranslatorMessage</b></a> ( const QTranslatorMessage & m )</li>
|
---|
| 45 | <li class=fn>QTranslatorMessage & <a href="#operator-eq"><b>operator=</b></a> ( const QTranslatorMessage & m )</li>
|
---|
| 46 | <li class=fn>uint <a href="#hash"><b>hash</b></a> () const</li>
|
---|
| 47 | <li class=fn>const char * <a href="#context"><b>context</b></a> () const</li>
|
---|
| 48 | <li class=fn>const char * <a href="#sourceText"><b>sourceText</b></a> () const</li>
|
---|
| 49 | <li class=fn>const char * <a href="#comment"><b>comment</b></a> () const</li>
|
---|
| 50 | <li class=fn>void <a href="#setTranslation"><b>setTranslation</b></a> ( const QString & translation )</li>
|
---|
| 51 | <li class=fn>QString <a href="#translation"><b>translation</b></a> () const</li>
|
---|
| 52 | <li class=fn>enum <a href="#Prefix-enum"><b>Prefix</b></a> { NoPrefix, Hash, HashContext, HashContextSourceText, HashContextSourceTextComment }</li>
|
---|
| 53 | <li class=fn>void <a href="#write"><b>write</b></a> ( QDataStream & stream, bool strip = FALSE, Prefix prefix = HashContextSourceTextComment ) const</li>
|
---|
| 54 | <li class=fn>Prefix <a href="#commonPrefix"><b>commonPrefix</b></a> ( const QTranslatorMessage & m ) const</li>
|
---|
| 55 | <li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const QTranslatorMessage & m ) const</li>
|
---|
| 56 | <li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const QTranslatorMessage & m ) const</li>
|
---|
| 57 | <li class=fn>bool <a href="#operator-lt"><b>operator<</b></a> ( const QTranslatorMessage & m ) const</li>
|
---|
| 58 | <li class=fn>bool <a href="#operator-lt-eq"><b>operator<=</b></a> ( const QTranslatorMessage & m ) const</li>
|
---|
| 59 | <li class=fn>bool <a href="#operator-gt"><b>operator></b></a> ( const QTranslatorMessage & m ) const</li>
|
---|
| 60 | <li class=fn>bool <a href="#operator-gt-eq"><b>operator>=</b></a> ( const QTranslatorMessage & m ) const</li>
|
---|
| 61 | </ul>
|
---|
| 62 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 63 |
|
---|
| 64 |
|
---|
| 65 | <p> The QTranslatorMessage class contains a translator message and its
|
---|
| 66 | properties.
|
---|
| 67 | <p>
|
---|
| 68 |
|
---|
| 69 | <p> This class is of no interest to most applications. It is useful
|
---|
| 70 | for translation tools such as <a href="linguist-manual.html">Qt
|
---|
| 71 | Linguist</a>. It is provided simply to make the API complete
|
---|
| 72 | and regular.
|
---|
| 73 | <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
|
---|
| 74 | 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
|
---|
| 75 | and the comment. Unless you plan to read and write messages
|
---|
| 76 | yourself, you need not worry about the hash value.
|
---|
| 77 | <p> QTranslatorMessage stores this triple or quadruple and the relevant
|
---|
| 78 | translation if there is any.
|
---|
| 79 | <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>.
|
---|
| 80 |
|
---|
| 81 | <hr><h2>Member Type Documentation</h2>
|
---|
| 82 | <h3 class=fn><a name="Prefix-enum"></a>QTranslatorMessage::Prefix</h3>
|
---|
| 83 |
|
---|
| 84 | <p> Let (<em>h</em>, <em>c</em>, <em>s</em>, <em>m</em>) be the extended key. The possible
|
---|
| 85 | prefixes are
|
---|
| 86 | <ul>
|
---|
| 87 | <li><tt>QTranslatorMessage::NoPrefix</tt> - no prefix
|
---|
| 88 | <li><tt>QTranslatorMessage::Hash</tt> - only (<em>h</em>)
|
---|
| 89 | <li><tt>QTranslatorMessage::HashContext</tt> - only (<em>h</em>, <em>c</em>)
|
---|
| 90 | <li><tt>QTranslatorMessage::HashContextSourceText</tt> - only (<em>h</em>, <em>c</em>, <em>s</em>)
|
---|
| 91 | <li><tt>QTranslatorMessage::HashContextSourceTextComment</tt> - the whole extended key, (<em>h</em>, <em>c</em>, <em>s</em>, <em>m</em>)
|
---|
| 92 | </ul><p> <p>See also <a href="#write">write</a>() and <a href="#commonPrefix">commonPrefix</a>().
|
---|
| 93 |
|
---|
| 94 | <hr><h2>Member Function Documentation</h2>
|
---|
| 95 | <h3 class=fn><a name="QTranslatorMessage"></a>QTranslatorMessage::QTranslatorMessage ()
|
---|
| 96 | </h3>
|
---|
| 97 | Constructs a translator message with the extended key (0, 0, 0, 0)
|
---|
| 98 | and <a href="qstring.html#QString-null">QString::null</a> as translation.
|
---|
| 99 |
|
---|
| 100 | <h3 class=fn><a name="QTranslatorMessage-2"></a>QTranslatorMessage::QTranslatorMessage ( const char * context, const char * sourceText, const char * comment, const <a href="qstring.html">QString</a> & translation = QString::null )
|
---|
| 101 | </h3>
|
---|
| 102 | 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
|
---|
| 103 | <em>sourceText</em> and <em>comment</em>, and possibly with a <em>translation</em>.
|
---|
| 104 |
|
---|
| 105 | <h3 class=fn><a name="QTranslatorMessage-3"></a>QTranslatorMessage::QTranslatorMessage ( <a href="qdatastream.html">QDataStream</a> & stream )
|
---|
| 106 | </h3>
|
---|
| 107 | Constructs a translator message read from the <em>stream</em>. The
|
---|
| 108 | resulting message may have any combination of content.
|
---|
| 109 | <p> <p>See also <a href="qtranslator.html#save">QTranslator::save</a>().
|
---|
| 110 |
|
---|
| 111 | <h3 class=fn><a name="QTranslatorMessage-4"></a>QTranslatorMessage::QTranslatorMessage ( const <a href="qtranslatormessage.html">QTranslatorMessage</a> & m )
|
---|
| 112 | </h3>
|
---|
| 113 | Constructs a copy of translator message <em>m</em>.
|
---|
| 114 |
|
---|
| 115 | <h3 class=fn>const char * <a name="comment"></a>QTranslatorMessage::comment () const
|
---|
| 116 | </h3>
|
---|
| 117 |
|
---|
| 118 | <p> Returns the comment for this message (e.g. "File|Save").
|
---|
| 119 | <p> <b>Warning:</b> This may return 0 if the <a href="qtranslator.html">QTranslator</a> object is stripped
|
---|
| 120 | (compressed).
|
---|
| 121 |
|
---|
| 122 | <h3 class=fn><a href="qtranslatormessage.html#Prefix-enum">Prefix</a> <a name="commonPrefix"></a>QTranslatorMessage::commonPrefix ( const <a href="qtranslatormessage.html">QTranslatorMessage</a> & m ) const
|
---|
| 123 | </h3>
|
---|
| 124 | Returns the widest lookup prefix that is common to this translator
|
---|
| 125 | message and to message <em>m</em>.
|
---|
| 126 | <p> For example, if the extended key is for this message is (71,
|
---|
| 127 | "PrintDialog", "Yes", "Print?") and that for <em>m</em> is (71,
|
---|
| 128 | "PrintDialog", "No", "Print?"), this function returns <a href="#Prefix-enum">HashContext</a>.
|
---|
| 129 | <p> <p>See also <a href="#write">write</a>().
|
---|
| 130 |
|
---|
| 131 | <h3 class=fn>const char * <a name="context"></a>QTranslatorMessage::context () const
|
---|
| 132 | </h3>
|
---|
| 133 |
|
---|
| 134 | <p> Returns the context for this message (e.g. "MyDialog").
|
---|
| 135 | <p> <b>Warning:</b> This may return 0 if the <a href="qtranslator.html">QTranslator</a> object is stripped
|
---|
| 136 | (compressed).
|
---|
| 137 |
|
---|
| 138 | <h3 class=fn>uint <a name="hash"></a>QTranslatorMessage::hash () const
|
---|
| 139 | </h3>
|
---|
| 140 |
|
---|
| 141 | <p> Returns the hash value used internally to represent the lookup
|
---|
| 142 | key. This value is zero only if this translator message was
|
---|
| 143 | constructed from a stream containing invalid data.
|
---|
| 144 | <p> The hashing function is unspecified, but it will remain unchanged
|
---|
| 145 | in future versions of Qt.
|
---|
| 146 |
|
---|
| 147 | <h3 class=fn>bool <a name="operator!-eq"></a>QTranslatorMessage::operator!= ( const <a href="qtranslatormessage.html">QTranslatorMessage</a> & m ) const
|
---|
| 148 | </h3>
|
---|
| 149 |
|
---|
| 150 | <p> Returns TRUE if the extended key of this object is different from
|
---|
| 151 | that of <em>m</em>; otherwise returns FALSE.
|
---|
| 152 |
|
---|
| 153 | <h3 class=fn>bool <a name="operator-lt"></a>QTranslatorMessage::operator< ( const <a href="qtranslatormessage.html">QTranslatorMessage</a> & m ) const
|
---|
| 154 | </h3>
|
---|
| 155 | Returns TRUE if the extended key of this object is
|
---|
| 156 | lexicographically before than that of <em>m</em>; otherwise returns
|
---|
| 157 | FALSE.
|
---|
| 158 |
|
---|
| 159 | <h3 class=fn>bool <a name="operator-lt-eq"></a>QTranslatorMessage::operator<= ( const <a href="qtranslatormessage.html">QTranslatorMessage</a> & m ) const
|
---|
| 160 | </h3>
|
---|
| 161 |
|
---|
| 162 | <p> Returns TRUE if the extended key of this object is
|
---|
| 163 | lexicographically before that of <em>m</em> or if they are equal;
|
---|
| 164 | otherwise returns FALSE.
|
---|
| 165 |
|
---|
| 166 | <h3 class=fn><a href="qtranslatormessage.html">QTranslatorMessage</a> & <a name="operator-eq"></a>QTranslatorMessage::operator= ( const <a href="qtranslatormessage.html">QTranslatorMessage</a> & m )
|
---|
| 167 | </h3>
|
---|
| 168 | Assigns message <em>m</em> to this translator message and returns a
|
---|
| 169 | reference to this translator message.
|
---|
| 170 |
|
---|
| 171 | <h3 class=fn>bool <a name="operator-eq-eq"></a>QTranslatorMessage::operator== ( const <a href="qtranslatormessage.html">QTranslatorMessage</a> & m ) const
|
---|
| 172 | </h3>
|
---|
| 173 | Returns TRUE if the extended key of this object is equal to that of
|
---|
| 174 | <em>m</em>; otherwise returns FALSE.
|
---|
| 175 |
|
---|
| 176 | <h3 class=fn>bool <a name="operator-gt"></a>QTranslatorMessage::operator> ( const <a href="qtranslatormessage.html">QTranslatorMessage</a> & m ) const
|
---|
| 177 | </h3>
|
---|
| 178 |
|
---|
| 179 | <p> Returns TRUE if the extended key of this object is
|
---|
| 180 | lexicographically after that of <em>m</em>; otherwise returns FALSE.
|
---|
| 181 |
|
---|
| 182 | <h3 class=fn>bool <a name="operator-gt-eq"></a>QTranslatorMessage::operator>= ( const <a href="qtranslatormessage.html">QTranslatorMessage</a> & m ) const
|
---|
| 183 | </h3>
|
---|
| 184 |
|
---|
| 185 | <p> Returns TRUE if the extended key of this object is
|
---|
| 186 | lexicographically after that of <em>m</em> or if they are equal;
|
---|
| 187 | otherwise returns FALSE.
|
---|
| 188 |
|
---|
| 189 | <h3 class=fn>void <a name="setTranslation"></a>QTranslatorMessage::setTranslation ( const <a href="qstring.html">QString</a> & translation )
|
---|
| 190 | </h3>
|
---|
| 191 |
|
---|
| 192 | <p> Sets the translation of the source text to <em>translation</em>.
|
---|
| 193 | <p> <p>See also <a href="#translation">translation</a>().
|
---|
| 194 |
|
---|
| 195 | <h3 class=fn>const char * <a name="sourceText"></a>QTranslatorMessage::sourceText () const
|
---|
| 196 | </h3>
|
---|
| 197 |
|
---|
| 198 | <p> Returns the source text of this message (e.g. "&Save").
|
---|
| 199 | <p> <b>Warning:</b> This may return 0 if the <a href="qtranslator.html">QTranslator</a> object is stripped
|
---|
| 200 | (compressed).
|
---|
| 201 |
|
---|
| 202 | <h3 class=fn><a href="qstring.html">QString</a> <a name="translation"></a>QTranslatorMessage::translation () const
|
---|
| 203 | </h3>
|
---|
| 204 |
|
---|
| 205 | <p> Returns the translation of the source text (e.g., "&Sauvegarder").
|
---|
| 206 | <p> <p>See also <a href="#setTranslation">setTranslation</a>().
|
---|
| 207 |
|
---|
| 208 | <h3 class=fn>void <a name="write"></a>QTranslatorMessage::write ( <a href="qdatastream.html">QDataStream</a> & stream, bool strip = FALSE, <a href="qtranslatormessage.html#Prefix-enum">Prefix</a> prefix = HashContextSourceTextComment ) const
|
---|
| 209 | </h3>
|
---|
| 210 | Writes this translator message to the <em>stream</em>. If <em>strip</em> is
|
---|
| 211 | FALSE (the default), all the information in the message is
|
---|
| 212 | written. If <em>strip</em> is TRUE, only the part of the extended key
|
---|
| 213 | specified by <em>prefix</em> is written with the translation (<a href="#Prefix-enum">HashContextSourceTextComment</a> by default).
|
---|
| 214 | <p> <p>See also <a href="#commonPrefix">commonPrefix</a>().
|
---|
| 215 |
|
---|
| 216 | <!-- eof -->
|
---|
| 217 | <hr><p>
|
---|
| 218 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 219 | Copyright © 1995-2007
|
---|
| 220 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 221 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 222 | <td>Copyright © 2007
|
---|
| 223 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 224 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 225 | </table></div></address></body>
|
---|
| 226 | </html>
|
---|