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