|
1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 #include "nsIAtom.idl" |
|
8 |
|
9 %{ C++ |
|
10 #include "nsIUnicodeDecoder.h" |
|
11 #include "nsIUnicodeEncoder.h" |
|
12 |
|
13 // XXX change to NS_CHARSETCONVERTERMANAGER_CID |
|
14 #define NS_ICHARSETCONVERTERMANAGER_CID \ |
|
15 {0x3c1c0163, 0x9bd0, 0x11d3, { 0x9d, 0x9, 0x0, 0x50, 0x4, 0x0, 0x7, 0xb2}} |
|
16 |
|
17 #define NS_CHARSETCONVERTERMANAGER_CONTRACTID "@mozilla.org/charset-converter-manager;1" |
|
18 %} |
|
19 |
|
20 interface nsIUnicodeDecoder; |
|
21 interface nsIUnicodeEncoder; |
|
22 interface nsIUTF8StringEnumerator; |
|
23 |
|
24 /** |
|
25 * DON'T ADD NEW USES OF THIS INTERFACE TO MOZILLA-CENTRAL. Use |
|
26 * mozilla::dom::EncodingUtils instead. |
|
27 * |
|
28 * Here Charsets are identified by ASCII strings. Charset alias |
|
29 * resolution is provided by default in most methods. "Raw" |
|
30 * versions that do not need this resolution are also provided. |
|
31 * |
|
32 * @deprecated Use mozilla::dom::EncodingUtils in mozilla-central instead. |
|
33 * @created 21/Feb/2000 |
|
34 * @author Catalin Rotaru [CATA] |
|
35 */ |
|
36 [scriptable, uuid(a0550d46-8d9c-47dd-acc7-c083620dff12)] |
|
37 interface nsICharsetConverterManager : nsISupports |
|
38 { |
|
39 /** |
|
40 * Get the Unicode decoder for the given charset. |
|
41 * The "Raw" version skips charset alias resolution |
|
42 */ |
|
43 [noscript] nsIUnicodeDecoder getUnicodeDecoder(in string charset); |
|
44 [noscript] nsIUnicodeDecoder getUnicodeDecoderRaw(in string charset); |
|
45 [noscript] nsIUnicodeDecoder getUnicodeDecoderInternal(in string charset); |
|
46 |
|
47 /** |
|
48 * Get the Unicode encoder for the given charset. |
|
49 * The "Raw" version skips charset alias resolution |
|
50 */ |
|
51 [noscript] nsIUnicodeEncoder getUnicodeEncoder(in string charset); |
|
52 [noscript] nsIUnicodeEncoder getUnicodeEncoderRaw(in string charset); |
|
53 |
|
54 /** |
|
55 * A shortcut to calling nsICharsetAlias to do alias resolution |
|
56 * @throws if aCharset is an unknown charset. |
|
57 */ |
|
58 ACString getCharsetAlias(in string aCharset); |
|
59 |
|
60 /** |
|
61 * Get the complete list of available decoders. |
|
62 */ |
|
63 nsIUTF8StringEnumerator getDecoderList(); |
|
64 |
|
65 /** |
|
66 * Get the complete list of available encoders. |
|
67 */ |
|
68 nsIUTF8StringEnumerator getEncoderList(); |
|
69 |
|
70 /** |
|
71 * Get the complete list of available charset detectors. |
|
72 */ |
|
73 nsIUTF8StringEnumerator GetCharsetDetectorList(); |
|
74 |
|
75 /** |
|
76 * Get the human-readable name for the given charset. |
|
77 * @throws if aCharset is an unknown charset. |
|
78 */ |
|
79 AString getCharsetTitle(in string aCharset); |
|
80 |
|
81 /** |
|
82 * Get some data about the given charset. This includes whether the |
|
83 * character encoding may be used for certain purposes, if it is |
|
84 * multi-byte, and the language code for it. See charsetData.properties |
|
85 * for the source of this data. Some known property names: |
|
86 * notForBrowser - not to be used in the browser. |
|
87 * notForOutgoing - not to be used for exporting files. |
|
88 * LangGroup - language code for charset, e.g. 'he' and 'zh-CN'. |
|
89 * isMultibyte - is this a multi-byte charset? |
|
90 * isInternal - not to be used in untrusted web content. |
|
91 * |
|
92 * @param aCharset name of the character encoding, e.g. 'iso-8859-15'. |
|
93 * @param aProp property desired for the character encoding. |
|
94 * @throws if aCharset is an unknown charset. |
|
95 * @return the value of the property, for the character encoding. |
|
96 */ |
|
97 AString getCharsetData(in string aCharset, |
|
98 in wstring aProp); |
|
99 |
|
100 /** |
|
101 * Get the language group for the given charset. This is similar to |
|
102 * calling <tt>getCharsetData</tt> with the <tt>prop</tt> "LangGroup". |
|
103 * |
|
104 * @param aCharset name of the character encoding, e.g. 'iso-8859-15'. |
|
105 * @throws if aCharset is an unknown charset. |
|
106 * @return the language code for the character encoding. |
|
107 */ |
|
108 nsIAtom getCharsetLangGroup(in string aCharset); |
|
109 nsIAtom getCharsetLangGroupRaw(in string aCharset); |
|
110 }; |