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