intl/uconv/idl/nsIScriptableUConv.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/uconv/idl/nsIScriptableUConv.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,81 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsISupports.idl"
    1.10 +
    1.11 +interface nsIInputStream;
    1.12 +
    1.13 +%{C++
    1.14 +// {0A698C44-3BFF-11d4-9649-00C0CA135B4E}
    1.15 +#define NS_ISCRIPTABLEUNICODECONVERTER_CID { 0x0A698C44, 0x3BFF, 0x11d4, { 0x96, 0x49, 0x00, 0xC0, 0xCA, 0x13, 0x5B, 0x4E } }
    1.16 +#define NS_ISCRIPTABLEUNICODECONVERTER_CONTRACTID "@mozilla.org/intl/scriptableunicodeconverter"
    1.17 +%}
    1.18 +
    1.19 +/**
    1.20 + * This interface is a unicode encoder for use by scripts
    1.21 + *
    1.22 + * @created         8/Jun/2000
    1.23 + * @author          Makoto Kato [m_kato@ga2.so-net.ne.jp]
    1.24 + */
    1.25 +[scriptable, uuid(f36ee324-5c1c-437f-ba10-2b4db7a18031)]
    1.26 +interface nsIScriptableUnicodeConverter : nsISupports
    1.27 +{
    1.28 +  /**
    1.29 +   * Converts the data from Unicode to one Charset.
    1.30 +   * Returns the converted string. After converting, Finish should be called
    1.31 +   * and its return value appended to this return value.
    1.32 +   */
    1.33 +  ACString ConvertFromUnicode(in AString aSrc);
    1.34 +
    1.35 +  /**
    1.36 +   * Returns the terminator string.
    1.37 +   * Should be called after ConvertFromUnicode() and appended to that
    1.38 +   * function's return value.
    1.39 +   */
    1.40 +  ACString Finish();
    1.41 +
    1.42 +  /**
    1.43 +   * Converts the data from one Charset to Unicode.
    1.44 +   */
    1.45 +  AString ConvertToUnicode(in ACString aSrc);
    1.46 +
    1.47 +  /**
    1.48 +   * Converts an array of bytes to a unicode string.
    1.49 +   */
    1.50 +  AString convertFromByteArray([const,array,size_is(aCount)] in octet aData,
    1.51 +                               in unsigned long aCount);
    1.52 +
    1.53 +  /**
    1.54 +   * Convert a unicode string to an array of bytes. Finish does not need to be
    1.55 +   * called.
    1.56 +   */
    1.57 +  void convertToByteArray(in AString aString,
    1.58 +                          [optional] out unsigned long aLen,
    1.59 +                          [array, size_is(aLen),retval] out octet aData);
    1.60 +
    1.61 +  /**
    1.62 +   * Converts a unicode string to an input stream. The bytes in the stream are
    1.63 +   * encoded according to the charset attribute.
    1.64 +   * The returned stream will be nonblocking.
    1.65 +   */
    1.66 +  nsIInputStream convertToInputStream(in AString aString);
    1.67 +
    1.68 +  /**
    1.69 +   * Current character set.
    1.70 +   *
    1.71 +   * @throw NS_ERROR_UCONV_NOCONV
    1.72 +   *        The requested charset is not supported.
    1.73 +   */
    1.74 +  attribute string charset;
    1.75 +
    1.76 +  /**
    1.77 +   * Internal use
    1.78 +   *
    1.79 +   * When this attribute is set, all charsets may be accessed.
    1.80 +   * When it is not set (the default), charsets with the isInternal flag
    1.81 +   *  may not be accessed.
    1.82 +   */
    1.83 +  attribute boolean isInternal;
    1.84 +};

mercurial