Back to index

lightning-sunbird  0.9+nobinonly
nsICollation.idl
Go to the documentation of this file.
00001 /* -*- Mode: idl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  *   mozilla.org
00019  * Portions created by the Initial Developer are Copyright (C) 2004
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #include "nsILocale.idl"
00039 
00040 interface nsICollation;
00041 
00042 [scriptable, uuid(04971e14-d6b3-4ada-8cbb-c3a13842b349)]
00043 interface nsICollationFactory : nsISupports {
00044   nsICollation CreateCollation(in nsILocale locale);
00045 };
00046 
00047 [scriptable, uuid(b0132cc0-3786-4557-9874-910d7def5f93)]
00048 interface nsICollation : nsISupports {
00049 
00050   // use the primary comparison for the given local - no flags
00051   const long kCollationStrengthDefault = 0;
00052 
00053   // do not consider case differences when doing the comparison i.e. A=a) 
00054   const long kCollationCaseInsensitiveAscii = 1;
00055 
00056   // do not consider accent differences when doing the comparison a=รก) 
00057   const long kCollationAccentInsenstive = 2;
00058 
00059   // case sensitive collation (default)
00060   const long kCollationCaseSensitive = kCollationStrengthDefault;
00061 
00062   // case insensitive collation
00063   const long kCollationCaseInSensitive = (kCollationCaseInsensitiveAscii | kCollationAccentInsenstive);
00064 
00065   // init this interface to a specified locale (should only be called by collation factory)
00066   void initialize(in nsILocale locale);
00067 
00068   // compare two strings
00069   // result is same as strcmp
00070   long compareString(in long strength, in AString string1, in AString string2);
00071 
00072   // allocate sort key from input string
00073   // returns newly allocated key, and its band its byte length
00074   [noscript] void allocateRawSortKey(in long strength, 
00075                                      in AString stringIn,
00076                                      [array,size_is(outLen)] out octet key,
00077                                      out unsigned long outLen);
00078 
00079   // compare two sort keys
00080   // length is a byte length, result is same as strcmp
00081   [noscript] long compareRawSortKey([const,array,size_is(len1)] in octet key1, in unsigned long len1,
00082                                     [const,array,size_is(len2)] in octet key2, in unsigned long len2);
00083 
00084 };