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/include/qtranslator.h:1 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>qtranslator.h Include File</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>qtranslator.h</h1>
|
---|
33 |
|
---|
34 | <p>This is the verbatim text of the qtranslator.h include file. It is provided only for illustration; the copyright remains with Trolltech.
|
---|
35 | <hr>
|
---|
36 | <pre>
|
---|
37 | /****************************************************************************
|
---|
38 | ** $Id: qtranslator-h.html 2051 2007-02-21 10:04:20Z chehrlic $
|
---|
39 | **
|
---|
40 | ** Definition of the translator class
|
---|
41 | **
|
---|
42 | ** Created : 980906
|
---|
43 | **
|
---|
44 | ** Copyright (C) 1998-2007 Trolltech ASA. All rights reserved.
|
---|
45 | **
|
---|
46 | ** This file is part of the kernel module of the Qt GUI Toolkit.
|
---|
47 | **
|
---|
48 | ** This file may be distributed under the terms of the Q Public License
|
---|
49 | ** as defined by Trolltech ASA of Norway and appearing in the file
|
---|
50 | ** LICENSE.QPL included in the packaging of this file.
|
---|
51 | **
|
---|
52 | ** This file may be distributed and/or modified under the terms of the
|
---|
53 | ** GNU General Public License version 2 as published by the Free Software
|
---|
54 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
55 | ** packaging of this file.
|
---|
56 | **
|
---|
57 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
58 | ** licenses may use this file in accordance with the Qt Commercial License
|
---|
59 | ** Agreement provided with the Software.
|
---|
60 | **
|
---|
61 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
62 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
63 | **
|
---|
64 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
65 | ** information about Qt Commercial License Agreements.
|
---|
66 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
67 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
68 | **
|
---|
69 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
70 | ** not clear to you.
|
---|
71 | **
|
---|
72 | **********************************************************************/
|
---|
73 |
|
---|
74 |
|
---|
75 | #ifndef QTRANSLATOR_H
|
---|
76 | #define QTRANSLATOR_H
|
---|
77 |
|
---|
78 | #ifndef QT_H
|
---|
79 | #include "qobject.h"
|
---|
80 | #include "qvaluelist.h"
|
---|
81 | #endif // QT_H
|
---|
82 |
|
---|
83 | #ifndef QT_NO_TRANSLATION
|
---|
84 |
|
---|
85 | class QTranslatorPrivate;
|
---|
86 |
|
---|
87 | class Q_EXPORT QTranslatorMessage
|
---|
88 | {
|
---|
89 | public:
|
---|
90 | QTranslatorMessage();
|
---|
91 | QTranslatorMessage( const char * context,
|
---|
92 | const char * sourceText,
|
---|
93 | const char * comment,
|
---|
94 | const QString& translation = QString::null );
|
---|
95 | QTranslatorMessage( QDataStream & );
|
---|
96 | QTranslatorMessage( const QTranslatorMessage & m );
|
---|
97 |
|
---|
98 | QTranslatorMessage & operator=( const QTranslatorMessage & m );
|
---|
99 |
|
---|
100 | uint hash() const { return h; }
|
---|
101 | const char *context() const { return cx; }
|
---|
102 | const char *sourceText() const { return st; }
|
---|
103 | const char *comment() const { return cm; }
|
---|
104 |
|
---|
105 | void setTranslation( const QString & translation ) { tn = translation; }
|
---|
106 | QString translation() const { return tn; }
|
---|
107 |
|
---|
108 | enum Prefix { NoPrefix, Hash, HashContext, HashContextSourceText,
|
---|
109 | HashContextSourceTextComment };
|
---|
110 | void write( QDataStream & s, bool strip = FALSE,
|
---|
111 | Prefix prefix = HashContextSourceTextComment ) const;
|
---|
112 | Prefix commonPrefix( const QTranslatorMessage& ) const;
|
---|
113 |
|
---|
114 | bool operator==( const QTranslatorMessage& m ) const;
|
---|
115 | bool operator!=( const QTranslatorMessage& m ) const
|
---|
116 | { return !operator==( m ); }
|
---|
117 | bool operator<( const QTranslatorMessage& m ) const;
|
---|
118 | bool operator<=( const QTranslatorMessage& m ) const
|
---|
119 | { return !m.operator<( *this ); }
|
---|
120 | bool operator>( const QTranslatorMessage& m ) const
|
---|
121 | { return m.operator<( *this ); }
|
---|
122 | bool operator>=( const QTranslatorMessage& m ) const
|
---|
123 | { return !operator<( m ); }
|
---|
124 |
|
---|
125 | private:
|
---|
126 | uint h;
|
---|
127 | QCString cx;
|
---|
128 | QCString st;
|
---|
129 | QCString cm;
|
---|
130 | QString tn;
|
---|
131 |
|
---|
132 | enum Tag { Tag_End = 1, Tag_SourceText16, Tag_Translation, Tag_Context16,
|
---|
133 | Tag_Hash, Tag_SourceText, Tag_Context, Tag_Comment,
|
---|
134 | Tag_Obsolete1 };
|
---|
135 | };
|
---|
136 |
|
---|
137 |
|
---|
138 | class Q_EXPORT QTranslator: public QObject
|
---|
139 | {
|
---|
140 | Q_OBJECT
|
---|
141 | public:
|
---|
142 | QTranslator( QObject * parent = 0, const char * name = 0 );
|
---|
143 | ~QTranslator();
|
---|
144 |
|
---|
145 | #ifndef QT_NO_COMPAT
|
---|
146 | QString find( const char *context, const char *sourceText, const char * comment = 0 ) const {
|
---|
147 | return findMessage( context, sourceText, comment ).translation();
|
---|
148 | }
|
---|
149 | #endif
|
---|
150 | virtual QTranslatorMessage findMessage( const char *, const char *,
|
---|
151 | const char * = 0 ) const;
|
---|
152 |
|
---|
153 | bool load( const QString & filename,
|
---|
154 | const QString & directory = QString::null,
|
---|
155 | const QString & search_delimiters = QString::null,
|
---|
156 | const QString & suffix = QString::null );
|
---|
157 | bool load( const uchar *data, int len ) {
|
---|
158 | clear();
|
---|
159 | return do_load( data, len );
|
---|
160 | }
|
---|
161 |
|
---|
162 | void clear();
|
---|
163 |
|
---|
164 | #ifndef QT_NO_TRANSLATION_BUILDER
|
---|
165 | enum SaveMode { Everything, Stripped };
|
---|
166 |
|
---|
167 | bool save( const QString & filename, SaveMode mode = Everything );
|
---|
168 |
|
---|
169 | void insert( const QTranslatorMessage& );
|
---|
170 | void insert( const char *context, const char *sourceText, const QString &translation ) {
|
---|
171 | insert( QTranslatorMessage(context, sourceText, "", translation) );
|
---|
172 | }
|
---|
173 | void remove( const QTranslatorMessage& );
|
---|
174 | void remove( const char *context, const char *sourceText ) {
|
---|
175 | remove( QTranslatorMessage(context, sourceText, "") );
|
---|
176 | }
|
---|
177 | bool contains( const char *, const char *, const char * comment = 0 ) const;
|
---|
178 |
|
---|
179 | void squeeze( SaveMode = Everything );
|
---|
180 | void unsqueeze();
|
---|
181 |
|
---|
182 | QValueList<QTranslatorMessage> messages() const;
|
---|
183 | #endif
|
---|
184 |
|
---|
185 | bool isEmpty() const;
|
---|
186 |
|
---|
187 | private:
|
---|
188 | #if defined(Q_DISABLE_COPY)
|
---|
189 | QTranslator( const QTranslator & );
|
---|
190 | QTranslator &operator=( const QTranslator & );
|
---|
191 | #endif
|
---|
192 |
|
---|
193 | bool do_load( const uchar *data, int len );
|
---|
194 |
|
---|
195 | QTranslatorPrivate * d;
|
---|
196 | };
|
---|
197 |
|
---|
198 | #endif // QT_NO_TRANSLATION
|
---|
199 |
|
---|
200 | #endif
|
---|
201 | </pre>
|
---|
202 | <!-- eof -->
|
---|
203 | <p><address><hr><div align=center>
|
---|
204 | <table width=100% cellspacing=0 border=0><tr>
|
---|
205 | <td>Copyright © 2007
|
---|
206 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
207 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
208 | </table></div></address></body>
|
---|
209 | </html>
|
---|