modules/libpref/public/nsIPrefLocalizedString.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/modules/libpref/public/nsIPrefLocalizedString.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,64 @@
     1.4 +/* -*- Mode: IDL; 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 +/**
    1.12 + * The nsIPrefLocalizedString interface is simply a wrapper interface for
    1.13 + * nsISupportsString so the preferences service can have a unique identifier
    1.14 + * to distinguish between requests for normal wide strings (nsISupportsString)
    1.15 + * and "localized" wide strings, which get their default values from properites
    1.16 + * files.
    1.17 + *
    1.18 + * @see nsIPrefBranch
    1.19 + * @see nsISupportsString
    1.20 + */
    1.21 +
    1.22 +[scriptable, uuid(ae419e24-1dd1-11b2-b39a-d3e5e7073802)]
    1.23 +interface nsIPrefLocalizedString : nsISupports
    1.24 +{
    1.25 +  /**
    1.26 +   * Provides access to string data stored in this property.
    1.27 +   *
    1.28 +   * @throws Error An error occurred.
    1.29 +   */
    1.30 +  attribute wstring data;
    1.31 +
    1.32 +  /**
    1.33 +   * Used to retrieve the contents of this object into a wide string.
    1.34 +   *
    1.35 +   * @return wstring The string containing the data stored within this object.
    1.36 +   */
    1.37 +  wstring toString();
    1.38 +
    1.39 +  /**
    1.40 +   * Used to set the contents of this object.
    1.41 +   *
    1.42 +   * @param length The length of the string. This value should not include
    1.43 +   *               space for the null terminator, nor should it account for the
    1.44 +   *               size of a character. It should  only be the number of
    1.45 +   *               characters for which there is space in the string.
    1.46 +   * @param data   The string data to be stored.
    1.47 +   *
    1.48 +   * @note
    1.49 +   * This makes a copy of the string argument passed in.
    1.50 +   */
    1.51 +  void setDataWithLength(in unsigned long length,
    1.52 +                         [size_is(length)] in wstring data);
    1.53 +};
    1.54 +
    1.55 +%{C++
    1.56 +
    1.57 +#define NS_PREFLOCALIZEDSTRING_CID                     \
    1.58 +  { /* {064d9cee-1dd2-11b2-83e3-d25ab0193c26} */       \
    1.59 +    0x064d9cee,                                        \
    1.60 +    0x1dd2,                                            \
    1.61 +    0x11b2,                                            \
    1.62 +    { 0x83, 0xe3, 0xd2, 0x5a, 0xb0, 0x19, 0x3c, 0x26 } \
    1.63 +  }
    1.64 +
    1.65 +#define NS_PREFLOCALIZEDSTRING_CONTRACTID "@mozilla.org/pref-localizedstring;1"
    1.66 +
    1.67 +%}

mercurial