michael@0: /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0:
michael@0: #include "nsISupports.idl"
michael@0: #include "nsIAtom.idl"
michael@0:
michael@0: %{ C++
michael@0: #include "nsIUnicodeDecoder.h"
michael@0: #include "nsIUnicodeEncoder.h"
michael@0:
michael@0: // XXX change to NS_CHARSETCONVERTERMANAGER_CID
michael@0: #define NS_ICHARSETCONVERTERMANAGER_CID \
michael@0: {0x3c1c0163, 0x9bd0, 0x11d3, { 0x9d, 0x9, 0x0, 0x50, 0x4, 0x0, 0x7, 0xb2}}
michael@0:
michael@0: #define NS_CHARSETCONVERTERMANAGER_CONTRACTID "@mozilla.org/charset-converter-manager;1"
michael@0: %}
michael@0:
michael@0: interface nsIUnicodeDecoder;
michael@0: interface nsIUnicodeEncoder;
michael@0: interface nsIUTF8StringEnumerator;
michael@0:
michael@0: /**
michael@0: * DON'T ADD NEW USES OF THIS INTERFACE TO MOZILLA-CENTRAL. Use
michael@0: * mozilla::dom::EncodingUtils instead.
michael@0: *
michael@0: * Here Charsets are identified by ASCII strings. Charset alias
michael@0: * resolution is provided by default in most methods. "Raw"
michael@0: * versions that do not need this resolution are also provided.
michael@0: *
michael@0: * @deprecated Use mozilla::dom::EncodingUtils in mozilla-central instead.
michael@0: * @created 21/Feb/2000
michael@0: * @author Catalin Rotaru [CATA]
michael@0: */
michael@0: [scriptable, uuid(a0550d46-8d9c-47dd-acc7-c083620dff12)]
michael@0: interface nsICharsetConverterManager : nsISupports
michael@0: {
michael@0: /**
michael@0: * Get the Unicode decoder for the given charset.
michael@0: * The "Raw" version skips charset alias resolution
michael@0: */
michael@0: [noscript] nsIUnicodeDecoder getUnicodeDecoder(in string charset);
michael@0: [noscript] nsIUnicodeDecoder getUnicodeDecoderRaw(in string charset);
michael@0: [noscript] nsIUnicodeDecoder getUnicodeDecoderInternal(in string charset);
michael@0:
michael@0: /**
michael@0: * Get the Unicode encoder for the given charset.
michael@0: * The "Raw" version skips charset alias resolution
michael@0: */
michael@0: [noscript] nsIUnicodeEncoder getUnicodeEncoder(in string charset);
michael@0: [noscript] nsIUnicodeEncoder getUnicodeEncoderRaw(in string charset);
michael@0:
michael@0: /**
michael@0: * A shortcut to calling nsICharsetAlias to do alias resolution
michael@0: * @throws if aCharset is an unknown charset.
michael@0: */
michael@0: ACString getCharsetAlias(in string aCharset);
michael@0:
michael@0: /**
michael@0: * Get the complete list of available decoders.
michael@0: */
michael@0: nsIUTF8StringEnumerator getDecoderList();
michael@0:
michael@0: /**
michael@0: * Get the complete list of available encoders.
michael@0: */
michael@0: nsIUTF8StringEnumerator getEncoderList();
michael@0:
michael@0: /**
michael@0: * Get the complete list of available charset detectors.
michael@0: */
michael@0: nsIUTF8StringEnumerator GetCharsetDetectorList();
michael@0:
michael@0: /**
michael@0: * Get the human-readable name for the given charset.
michael@0: * @throws if aCharset is an unknown charset.
michael@0: */
michael@0: AString getCharsetTitle(in string aCharset);
michael@0:
michael@0: /**
michael@0: * Get some data about the given charset. This includes whether the
michael@0: * character encoding may be used for certain purposes, if it is
michael@0: * multi-byte, and the language code for it. See charsetData.properties
michael@0: * for the source of this data. Some known property names:
michael@0: * notForBrowser - not to be used in the browser.
michael@0: * notForOutgoing - not to be used for exporting files.
michael@0: * LangGroup - language code for charset, e.g. 'he' and 'zh-CN'.
michael@0: * isMultibyte - is this a multi-byte charset?
michael@0: * isInternal - not to be used in untrusted web content.
michael@0: *
michael@0: * @param aCharset name of the character encoding, e.g. 'iso-8859-15'.
michael@0: * @param aProp property desired for the character encoding.
michael@0: * @throws if aCharset is an unknown charset.
michael@0: * @return the value of the property, for the character encoding.
michael@0: */
michael@0: AString getCharsetData(in string aCharset,
michael@0: in wstring aProp);
michael@0:
michael@0: /**
michael@0: * Get the language group for the given charset. This is similar to
michael@0: * calling getCharsetData with the prop "LangGroup".
michael@0: *
michael@0: * @param aCharset name of the character encoding, e.g. 'iso-8859-15'.
michael@0: * @throws if aCharset is an unknown charset.
michael@0: * @return the language code for the character encoding.
michael@0: */
michael@0: nsIAtom getCharsetLangGroup(in string aCharset);
michael@0: nsIAtom getCharsetLangGroupRaw(in string aCharset);
michael@0: };