|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
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 |
|
8 interface nsIInputStream; |
|
9 |
|
10 %{C++ |
|
11 // {0A698C44-3BFF-11d4-9649-00C0CA135B4E} |
|
12 #define NS_ISCRIPTABLEUNICODECONVERTER_CID { 0x0A698C44, 0x3BFF, 0x11d4, { 0x96, 0x49, 0x00, 0xC0, 0xCA, 0x13, 0x5B, 0x4E } } |
|
13 #define NS_ISCRIPTABLEUNICODECONVERTER_CONTRACTID "@mozilla.org/intl/scriptableunicodeconverter" |
|
14 %} |
|
15 |
|
16 /** |
|
17 * This interface is a unicode encoder for use by scripts |
|
18 * |
|
19 * @created 8/Jun/2000 |
|
20 * @author Makoto Kato [m_kato@ga2.so-net.ne.jp] |
|
21 */ |
|
22 [scriptable, uuid(f36ee324-5c1c-437f-ba10-2b4db7a18031)] |
|
23 interface nsIScriptableUnicodeConverter : nsISupports |
|
24 { |
|
25 /** |
|
26 * Converts the data from Unicode to one Charset. |
|
27 * Returns the converted string. After converting, Finish should be called |
|
28 * and its return value appended to this return value. |
|
29 */ |
|
30 ACString ConvertFromUnicode(in AString aSrc); |
|
31 |
|
32 /** |
|
33 * Returns the terminator string. |
|
34 * Should be called after ConvertFromUnicode() and appended to that |
|
35 * function's return value. |
|
36 */ |
|
37 ACString Finish(); |
|
38 |
|
39 /** |
|
40 * Converts the data from one Charset to Unicode. |
|
41 */ |
|
42 AString ConvertToUnicode(in ACString aSrc); |
|
43 |
|
44 /** |
|
45 * Converts an array of bytes to a unicode string. |
|
46 */ |
|
47 AString convertFromByteArray([const,array,size_is(aCount)] in octet aData, |
|
48 in unsigned long aCount); |
|
49 |
|
50 /** |
|
51 * Convert a unicode string to an array of bytes. Finish does not need to be |
|
52 * called. |
|
53 */ |
|
54 void convertToByteArray(in AString aString, |
|
55 [optional] out unsigned long aLen, |
|
56 [array, size_is(aLen),retval] out octet aData); |
|
57 |
|
58 /** |
|
59 * Converts a unicode string to an input stream. The bytes in the stream are |
|
60 * encoded according to the charset attribute. |
|
61 * The returned stream will be nonblocking. |
|
62 */ |
|
63 nsIInputStream convertToInputStream(in AString aString); |
|
64 |
|
65 /** |
|
66 * Current character set. |
|
67 * |
|
68 * @throw NS_ERROR_UCONV_NOCONV |
|
69 * The requested charset is not supported. |
|
70 */ |
|
71 attribute string charset; |
|
72 |
|
73 /** |
|
74 * Internal use |
|
75 * |
|
76 * When this attribute is set, all charsets may be accessed. |
|
77 * When it is not set (the default), charsets with the isInternal flag |
|
78 * may not be accessed. |
|
79 */ |
|
80 attribute boolean isInternal; |
|
81 }; |