]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/encconv.tex
add wxSYS_DCLICK_TIME system metric constant; use it for the generic list control...
[wxWidgets.git] / docs / latex / wx / encconv.tex
CommitLineData
c958260b
VS
1%
2% automatically generated by HelpGen from
3% encconv.h at 30/Dec/99 18:45:16
4%
5
c958260b
VS
6\section{\class{wxEncodingConverter}}\label{wxencodingconverter}
7
a663cce7 8This class is capable of converting strings between two
457e6c54 98-bit encodings/charsets. It can also convert from/to Unicode (but only
1599f54e
JS
10if you compiled wxWidgets with wxUSE\_WCHAR\_T set to 1). Only a limited subset
11of encodings is supported by wxEncodingConverter:
a663cce7
VS
12{\tt wxFONTENCODING\_ISO8859\_1..15}, {\tt wxFONTENCODING\_CP1250..1257} and
13{\tt wxFONTENCODING\_KOI8}.
14
15\wxheading{Note}
16
17Please use \helpref{wxMBConv classes}{mbconvclasses} instead
18if possible. \helpref{wxCSConv}{wxcsconv} has much better support for various
19encodings than wxEncodingConverter. wxEncodingConverter is useful only
20if you rely on {\tt wxCONVERT\_SUBSTITUTE} mode of operation (see
21\helpref{Init}{wxencodingconverterinit}).
c958260b 22
c958260b
VS
23\wxheading{Derived from}
24
25\helpref{wxObject}{wxobject}
26
9704b250
VS
27\wxheading{Include files}
28
29<wx/encconv.h>
30
a7af285d
VZ
31\wxheading{Library}
32
33\helpref{wxBase}{librarieslist}
34
04a4a2af
VS
35\wxheading{See also}
36
37\helpref{wxFontMapper}{wxfontmapper},
f6bcfd97 38\helpref{wxMBConv}{wxmbconv},
04a4a2af
VS
39\helpref{Writing non-English applications}{nonenglishoverview}
40
41
c958260b
VS
42\latexignore{\rtfignore{\wxheading{Members}}}
43
5bc97d1b 44
c958260b
VS
45\membersection{wxEncodingConverter::wxEncodingConverter}\label{wxencodingconverterwxencodingconverter}
46
47\func{}{wxEncodingConverter}{\void}
48
49Constructor.
50
5bc97d1b 51
c958260b
VS
52\membersection{wxEncodingConverter::Init}\label{wxencodingconverterinit}
53
54\func{bool}{Init}{\param{wxFontEncoding }{input\_enc}, \param{wxFontEncoding }{output\_enc}, \param{int }{method = wxCONVERT\_STRICT}}
55
2edb0bde 56Initialize conversion. Both output or input encoding may
c958260b
VS
57be wxFONTENCODING\_UNICODE, but only if wxUSE\_ENCODING is set to 1.
58All subsequent calls to \helpref{Convert()}{wxencodingconverterconvert}
457e6c54
JS
59will interpret its argument
60as a string in {\it input\_enc} encoding and will output string in
c958260b
VS
61{\it output\_enc} encoding.
62You must call this method before calling Convert. You may call
63it more than once in order to switch to another conversion.
64{\it Method} affects behaviour of Convert() in case input character
65cannot be converted because it does not exist in output encoding:
66
457e6c54 67\begin{twocollist}\itemsep=0pt
c958260b 68\twocolitem{{\bf wxCONVERT\_STRICT}}{follow behaviour of GNU Recode -
f6bcfd97 69just copy unconvertible characters to output and don't change them
c958260b
VS
70(its integer value will stay the same)}
71\twocolitem{{\bf wxCONVERT\_SUBSTITUTE}}{try some (lossy) substitutions
f6bcfd97 72- e.g. replace unconvertible latin capitals with acute by ordinary
c958260b
VS
73capitals, replace en-dash or em-dash by '-' etc.}
74\end{twocollist}
75
f6bcfd97 76Both modes guarantee that output string will have same length
c958260b
VS
77as input string.
78
79\wxheading{Return value}
80
cc81d32f 81false if given conversion is impossible, true otherwise
c958260b 82(conversion may be impossible either if you try to convert
fc2171bd 83to Unicode with non-Unicode build of wxWidgets or if input
c958260b
VS
84or output encoding is not supported.)
85
5bc97d1b
VZ
86
87\membersection{wxEncodingConverter::CanConvert}\label{wxencodingconvertercanconvert}
88
1599f54e 89\func{static bool}{CanConvert}{\param{wxFontEncoding }{encIn}, \param{wxFontEncoding }{encOut}}
5bc97d1b
VZ
90
91Return true if (any text in) multibyte encoding \arg{encIn} can be converted to
b325f27f 92another one ({\it encOut}) losslessly.
5bc97d1b
VZ
93
94Do not call this method with \texttt{wxFONTENCODING\_UNICODE} as either
95parameter, it doesn't make sense (always works in one sense and always depends
96on the text to convert in the other).
97
98
c958260b
VS
99\membersection{wxEncodingConverter::Convert}\label{wxencodingconverterconvert}
100
02c92ad9 101\constfunc{bool}{Convert}{\param{const char* }{input}, \param{char* }{output}}
7a766dcd 102
02c92ad9 103\constfunc{bool}{Convert}{\param{const wchar\_t* }{input}, \param{wchar\_t* }{output}}
7a766dcd 104
02c92ad9 105\constfunc{bool}{Convert}{\param{const char* }{input}, \param{wchar\_t* }{output}}
7a766dcd 106
02c92ad9 107\constfunc{bool}{Convert}{\param{const wchar\_t* }{input}, \param{char* }{output}}
7a766dcd
VS
108
109Convert input string according to settings passed to
110\helpref{Init}{wxencodingconverterinit} and writes the result to {\it output}.
111
02c92ad9 112\constfunc{bool}{Convert}{\param{char* }{str}}
7a766dcd 113
02c92ad9 114\constfunc{bool}{Convert}{\param{wchar\_t* }{str}}
7a766dcd
VS
115
116Convert input string according to settings passed to
117\helpref{Init}{wxencodingconverterinit} in-place, i.e. write the result to the
118same memory area.
119
02c92ad9
VS
120All of the versions above return \true if the conversion was lossless and
121\false if at least one of the characters couldn't be converted and was replaced
122with {\tt '?'} in the output. Note that if {\tt wxCONVERT\_SUBSTITUTE} was
123passed to \helpref{Init}{wxencodingconverterinit}, substitution is considered
124lossless operation.
125
57c5293e 126\constfunc{wxString}{Convert}{\param{const wxString\& }{input}}
c958260b 127
7a766dcd 128Convert wxString and return new wxString object.
c958260b 129
7a766dcd 130\wxheading{Notes}
c958260b 131
7a766dcd 132You must call \helpref{Init}{wxencodingconverterinit} before using this method!
5b5d025c 133
fc2171bd 134{\tt wchar\_t} versions of the method are not available if wxWidgets was compiled
7a766dcd 135with {\tt wxUSE\_WCHAR\_T} set to 0.
c958260b 136
5bc97d1b 137
c958260b
VS
138\membersection{wxEncodingConverter::GetPlatformEquivalents}\label{wxencodingconvertergetplatformequivalents}
139
5b5d025c 140\func{static wxFontEncodingArray}{GetPlatformEquivalents}{\param{wxFontEncoding }{enc}, \param{int }{platform = wxPLATFORM\_CURRENT}}
c958260b
VS
141
142Return equivalents for given font that are used
143under given platform. Supported platforms:
144
457e6c54 145\begin{itemize}\itemsep=0pt
c958260b
VS
146\item wxPLATFORM\_UNIX
147\item wxPLATFORM\_WINDOWS
148\item wxPLATFORM\_OS2
149\item wxPLATFORM\_MAC
150\item wxPLATFORM\_CURRENT
151\end{itemize}
152
2edb0bde 153wxPLATFORM\_CURRENT means the platform this binary was compiled for.
c958260b
VS
154
155Examples:
457e6c54 156
c958260b
VS
157\begin{verbatim}
158current platform enc returned value
159----------------------------------------------
160unix CP1250 {ISO8859_2}
161unix ISO8859_2 {ISO8859_2}
162windows ISO8859_2 {CP1250}
163unix CP1252 {ISO8859_1,ISO8859_15}
164\end{verbatim}
165
166Equivalence is defined in terms of convertibility:
f6bcfd97
BP
167two encodings are equivalent if you can convert text between
168then without losing information (it may - and will - happen
169that you lose special chars like quotation marks or em-dashes
170but you shouldn't lose any diacritics and language-specific
c958260b
VS
171characters when converting between equivalent encodings).
172
173Remember that this function does {\bf NOT} check for presence of
174fonts in system. It only tells you what are most suitable
175encodings. (It usually returns only one encoding.)
176
177\wxheading{Notes}
178
457e6c54
JS
179\begin{itemize}\itemsep=0pt
180\item Note that argument {\it enc} itself may be present in the returned array,
f6bcfd97 181so that you can, as a side-effect, detect whether the
457e6c54 182encoding is native for this platform or not.
f6bcfd97
BP
183\item \helpref{Convert}{wxencodingconverterconvert} is not limited to
184converting between equivalent encodings, it can convert between two arbitrary
185encodings.
186\item If {\it enc} is present in the returned array, then it is {\bf always} the first
5b5d025c 187item of it.
f6bcfd97 188\item Please note that the returned array may contain no items at all.
c958260b
VS
189\end{itemize}
190
5bc97d1b 191
c958260b
VS
192\membersection{wxEncodingConverter::GetAllEquivalents}\label{wxencodingconvertergetallequivalents}
193
5b5d025c 194\func{static wxFontEncodingArray}{GetAllEquivalents}{\param{wxFontEncoding }{enc}}
c958260b
VS
195
196Similar to
197\helpref{GetPlatformEquivalents}{wxencodingconvertergetplatformequivalents},
198but this one will return ALL
f6bcfd97 199equivalent encodings, regardless of the platform, and including itself.
c958260b 200
5b5d025c
VS
201This platform's encodings are before others in the array. And again, if {\it enc} is in the array,
202it is the very first item in it.
457e6c54 203