1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/locale/idl/nsICollation.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 "nsILocale.idl" 1.10 + 1.11 +interface nsICollation; 1.12 + 1.13 +[scriptable, uuid(04971e14-d6b3-4ada-8cbb-c3a13842b349)] 1.14 +interface nsICollationFactory : nsISupports 1.15 +{ 1.16 + /** 1.17 + * Create the collation for a given locale. 1.18 + * 1.19 + * Use NULL as the locale parameter to use the user's locale preference 1.20 + * from the operating system. 1.21 + * 1.22 + * @param locale 1.23 + * The locale for which to create the collation or null to use 1.24 + * user preference. 1.25 + * @return A collation for the given locale. 1.26 + */ 1.27 + nsICollation CreateCollation(in nsILocale locale); 1.28 +}; 1.29 + 1.30 +[scriptable, uuid(b0132cc0-3786-4557-9874-910d7def5f93)] 1.31 +interface nsICollation : nsISupports { 1.32 + 1.33 + // use the primary comparison for the given locale - no flags 1.34 + const long kCollationStrengthDefault = 0; 1.35 + 1.36 + // do not consider case differences when doing the comparison i.e. A=a) 1.37 + const long kCollationCaseInsensitiveAscii = 1; 1.38 + 1.39 + // do not consider accent differences when doing the comparison a=รก) 1.40 + const long kCollationAccentInsenstive = 2; 1.41 + 1.42 + // case sensitive collation (default) 1.43 + const long kCollationCaseSensitive = kCollationStrengthDefault; 1.44 + 1.45 + // case insensitive collation 1.46 + const long kCollationCaseInSensitive = (kCollationCaseInsensitiveAscii | kCollationAccentInsenstive); 1.47 + 1.48 + // init this interface to a specified locale (should only be called by collation factory) 1.49 + void initialize(in nsILocale locale); 1.50 + 1.51 + // compare two strings 1.52 + // result is same as strcmp 1.53 + long compareString(in long strength, in AString string1, in AString string2); 1.54 + 1.55 + // allocate sort key from input string 1.56 + // returns newly allocated key, and its band its byte length 1.57 + [noscript] void allocateRawSortKey(in long strength, 1.58 + in AString stringIn, 1.59 + [array,size_is(outLen)] out octet key, 1.60 + out unsigned long outLen); 1.61 + 1.62 + // compare two sort keys 1.63 + // length is a byte length, result is same as strcmp 1.64 + [noscript] long compareRawSortKey([const,array,size_is(len1)] in octet key1, in unsigned long len1, 1.65 + [const,array,size_is(len2)] in octet key2, in unsigned long len2); 1.66 + 1.67 +};