intl/uconv/idl/nsITextToSubURI.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/uconv/idl/nsITextToSubURI.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,50 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     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 +
    1.12 +%{C++
    1.13 +// {8B042E22-6F87-11d3-B3C8-00805F8A6670}
    1.14 +#define NS_TEXTTOSUBURI_CID { 0x8b042e22, 0x6f87, 0x11d3, { 0xb3, 0xc8, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 } }
    1.15 +#define NS_ITEXTTOSUBURI_CONTRACTID "@mozilla.org/intl/texttosuburi;1"
    1.16 +%}
    1.17 +
    1.18 +[scriptable, uuid(8B042E24-6F87-11d3-B3C8-00805F8A6670)]
    1.19 +interface nsITextToSubURI : nsISupports
    1.20 +{
    1.21 +	string ConvertAndEscape(in string charset, in wstring text);
    1.22 +	wstring UnEscapeAndConvert(in string charset, in string text);
    1.23 +
    1.24 +  /**
    1.25 +   * Unescapes the given URI fragment (for UI purpose only)
    1.26 +   * Note: 
    1.27 +   * <ul>
    1.28 +   *  <li> escaping back the result (unescaped string) is not guaranteed to 
    1.29 +   *       give the original escaped string
    1.30 +   *  <li> In case of a conversion error, the URI fragment (escaped) is 
    1.31 +   *       assumed to be in UTF-8 and converted to AString (UTF-16)
    1.32 +   *  <li> Always succeeeds (callers don't need to do error checking)
    1.33 +   * </ul>
    1.34 +   *
    1.35 +   * @param aCharset the charset to convert from
    1.36 +   * @param aURIFragment the URI (or URI fragment) to unescape
    1.37 +   * @return Unescaped aURIFragment  converted to unicode
    1.38 +   */
    1.39 +  AString unEscapeURIForUI(in ACString aCharset, in AUTF8String aURIFragment);
    1.40 +
    1.41 +  /**
    1.42 +   * Unescapes only non ASCII characters in the given URI fragment 
    1.43 +   * note: this method assumes the URI as UTF-8 and fallbacks to the given 
    1.44 +   * charset if the charset is an ASCII superset 
    1.45 +   *
    1.46 +   * @param aCharset the charset to convert from
    1.47 +   * @param aURIFragment the URI (or URI fragment) to unescape
    1.48 +   * @return Unescaped aURIFragment  converted to unicode
    1.49 +   * @throws NS_ERROR_UCONV_NOCONV when there is no decoder for aCharset
    1.50 +   *         or error code of nsIUnicodeDecoder in case of conversion failure
    1.51 +   */
    1.52 +  AString unEscapeNonAsciiURI(in ACString aCharset, in AUTF8String aURIFragment);
    1.53 +};

mercurial