summaryrefslogtreecommitdiffstats
path: root/intl/uconv/nsIScriptableUConv.idl
blob: 8dc59ae1dbd04dfb0636da8cb3db9b5da150a54f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

interface nsIInputStream;

/**
 * In new code, please use the WebIDL TextDecoder and TextEncoder
 * instead. They represent bytes as Uint8Array (or as view to such
 * array), which is the current best practice for representing bytes
 * in JavaScript.
 *
 * This interface converts between UTF-16 in JavaScript strings
 * and bytes transported as the unsigned value of each byte
 * transported in a code unit of the same numeric value in
 * a JavaScript string.
 *
 * @created         8/Jun/2000
 * @author          Makoto Kato [m_kato@ga2.so-net.ne.jp]
 */
[scriptable, uuid(f36ee324-5c1c-437f-ba10-2b4db7a18031)]
interface nsIScriptableUnicodeConverter : nsISupports
{
  /**
   * Converts the data from Unicode to one Charset.
   * Returns the converted string. After converting, Finish should be called
   * and its return value appended to this return value.
   */
  ACString ConvertFromUnicode(in AString aSrc);

  /**
   * Returns the terminator string.
   * Should be called after ConvertFromUnicode() and appended to that
   * function's return value.
   */
  ACString Finish();

  /**
   * Converts the data from one Charset to Unicode.
   */
  AString ConvertToUnicode(in ACString aSrc);

  /**
   * Current character set.
   *
   * @throw NS_ERROR_UCONV_NOCONV
   *        The requested charset is not supported.
   */
  attribute ACString charset;

  /**
   * Meaningless
   */
  attribute boolean isInternal;
};