storage/src/SQLCollations.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     2  * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
     3  * This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef mozilla_storage_SQLCollations_h
     8 #define mozilla_storage_SQLCollations_h
    10 #include "mozStorageService.h"
    11 #include "nscore.h"
    12 #include "nsString.h"
    14 #include "sqlite3.h"
    16 namespace mozilla {
    17 namespace storage {
    19 /**
    20  * Registers the collating sequences declared here with the specified
    21  * database and Service.
    22  *
    23  * @param  aDB
    24  *         The database we'll be registering the collations with.
    25  * @param  aService
    26  *         The Service that owns the nsICollation used by our collations.
    27  * @return the SQLite status code indicating success or failure.
    28  */
    29 NS_HIDDEN_(int) registerCollations(sqlite3 *aDB, Service *aService);
    31 ////////////////////////////////////////////////////////////////////////////////
    32 //// Predefined Functions
    34 /**
    35  * Custom UTF-8 collating sequence that respects the application's locale.
    36  * Comparison is case- and accent-insensitive.  This is called by SQLite.
    37  *
    38  * @param  aService
    39  *         The Service that owns the nsICollation used by this collation.
    40  * @param  aLen1
    41  *         The number of bytes in aStr1.
    42  * @param  aStr1
    43  *         The string to be compared against aStr2.  It will be passed in by
    44  *         SQLite as a non-null-terminated char* buffer.
    45  * @param  aLen2
    46  *         The number of bytes in aStr2.
    47  * @param  aStr2
    48  *         The string to be compared against aStr1.  It will be passed in by
    49  *         SQLite as a non-null-terminated char* buffer.
    50  * @return aStr1 - aStr2.  That is, if aStr1 < aStr2, returns a negative number.
    51  *         If aStr1 > aStr2, returns a positive number.  If aStr1 == aStr2,
    52  *         returns 0.
    53  */
    54 NS_HIDDEN_(int) localeCollation8(void *aService,
    55                                  int aLen1,
    56                                  const void *aStr1,
    57                                  int aLen2,
    58                                  const void *aStr2);
    60 /**
    61  * Custom UTF-8 collating sequence that respects the application's locale.
    62  * Comparison is case-sensitive and accent-insensitive.  This is called by
    63  * SQLite.
    64  *
    65  * @param  aService
    66  *         The Service that owns the nsICollation used by this collation.
    67  * @param  aLen1
    68  *         The number of bytes in aStr1.
    69  * @param  aStr1
    70  *         The string to be compared against aStr2.  It will be passed in by
    71  *         SQLite as a non-null-terminated char* buffer.
    72  * @param  aLen2
    73  *         The number of bytes in aStr2.
    74  * @param  aStr2
    75  *         The string to be compared against aStr1.  It will be passed in by
    76  *         SQLite as a non-null-terminated char* buffer.
    77  * @return aStr1 - aStr2.  That is, if aStr1 < aStr2, returns a negative number.
    78  *         If aStr1 > aStr2, returns a positive number.  If aStr1 == aStr2,
    79  *         returns 0.
    80  */
    81 NS_HIDDEN_(int) localeCollationCaseSensitive8(void *aService,
    82                                               int aLen1,
    83                                               const void *aStr1,
    84                                               int aLen2,
    85                                               const void *aStr2);
    87 /**
    88  * Custom UTF-8 collating sequence that respects the application's locale.
    89  * Comparison is case-insensitive and accent-sensitive.  This is called by
    90  * SQLite.
    91  *
    92  * @param  aService
    93  *         The Service that owns the nsICollation used by this collation.
    94  * @param  aLen1
    95  *         The number of bytes in aStr1.
    96  * @param  aStr1
    97  *         The string to be compared against aStr2.  It will be passed in by
    98  *         SQLite as a non-null-terminated char* buffer.
    99  * @param  aLen2
   100  *         The number of bytes in aStr2.
   101  * @param  aStr2
   102  *         The string to be compared against aStr1.  It will be passed in by
   103  *         SQLite as a non-null-terminated char* buffer.
   104  * @return aStr1 - aStr2.  That is, if aStr1 < aStr2, returns a negative number.
   105  *         If aStr1 > aStr2, returns a positive number.  If aStr1 == aStr2,
   106  *         returns 0.
   107  */
   108 NS_HIDDEN_(int) localeCollationAccentSensitive8(void *aService,
   109                                                 int aLen1,
   110                                                 const void *aStr1,
   111                                                 int aLen2,
   112                                                 const void *aStr2);
   114 /**
   115  * Custom UTF-8 collating sequence that respects the application's locale.
   116  * Comparison is case- and accent-sensitive.  This is called by SQLite.
   117  *
   118  * @param  aService
   119  *         The Service that owns the nsICollation used by this collation.
   120  * @param  aLen1
   121  *         The number of bytes in aStr1.
   122  * @param  aStr1
   123  *         The string to be compared against aStr2.  It will be passed in by
   124  *         SQLite as a non-null-terminated char* buffer.
   125  * @param  aLen2
   126  *         The number of bytes in aStr2.
   127  * @param  aStr2
   128  *         The string to be compared against aStr1.  It will be passed in by
   129  *         SQLite as a non-null-terminated char* buffer.
   130  * @return aStr1 - aStr2.  That is, if aStr1 < aStr2, returns a negative number.
   131  *         If aStr1 > aStr2, returns a positive number.  If aStr1 == aStr2,
   132  *         returns 0.
   133  */
   134 NS_HIDDEN_(int) localeCollationCaseAccentSensitive8(void *aService,
   135                                                     int aLen1,
   136                                                     const void *aStr1,
   137                                                     int aLen2,
   138                                                     const void *aStr2);
   140 /**
   141  * Custom UTF-16 collating sequence that respects the application's locale.
   142  * Comparison is case- and accent-insensitive.  This is called by SQLite.
   143  *
   144  * @param  aService
   145  *         The Service that owns the nsICollation used by this collation.
   146  * @param  aLen1
   147  *         The number of bytes (not characters) in aStr1.
   148  * @param  aStr1
   149  *         The string to be compared against aStr2.  It will be passed in by
   150  *         SQLite as a non-null-terminated char16_t* buffer.
   151  * @param  aLen2
   152  *         The number of bytes (not characters) in aStr2.
   153  * @param  aStr2
   154  *         The string to be compared against aStr1.  It will be passed in by
   155  *         SQLite as a non-null-terminated char16_t* buffer.
   156  * @return aStr1 - aStr2.  That is, if aStr1 < aStr2, returns a negative number.
   157  *         If aStr1 > aStr2, returns a positive number.  If aStr1 == aStr2,
   158  *         returns 0.
   159  */
   160 NS_HIDDEN_(int) localeCollation16(void *aService,
   161                                   int aLen1,
   162                                   const void *aStr1,
   163                                   int aLen2,
   164                                   const void *aStr2);
   166 /**
   167  * Custom UTF-16 collating sequence that respects the application's locale.
   168  * Comparison is case-sensitive and accent-insensitive.  This is called by
   169  * SQLite.
   170  *
   171  * @param  aService
   172  *         The Service that owns the nsICollation used by this collation.
   173  * @param  aLen1
   174  *         The number of bytes (not characters) in aStr1.
   175  * @param  aStr1
   176  *         The string to be compared against aStr2.  It will be passed in by
   177  *         SQLite as a non-null-terminated char16_t* buffer.
   178  * @param  aLen2
   179  *         The number of bytes (not characters) in aStr2.
   180  * @param  aStr2
   181  *         The string to be compared against aStr1.  It will be passed in by
   182  *         SQLite as a non-null-terminated char16_t* buffer.
   183  * @return aStr1 - aStr2.  That is, if aStr1 < aStr2, returns a negative number.
   184  *         If aStr1 > aStr2, returns a positive number.  If aStr1 == aStr2,
   185  *         returns 0.
   186  */
   187 NS_HIDDEN_(int) localeCollationCaseSensitive16(void *aService,
   188                                                int aLen1,
   189                                                const void *aStr1,
   190                                                int aLen2,
   191                                                const void *aStr2);
   193 /**
   194  * Custom UTF-16 collating sequence that respects the application's locale.
   195  * Comparison is case-insensitive and accent-sensitive.  This is called by
   196  * SQLite.
   197  *
   198  * @param  aService
   199  *         The Service that owns the nsICollation used by this collation.
   200  * @param  aLen1
   201  *         The number of bytes (not characters) in aStr1.
   202  * @param  aStr1
   203  *         The string to be compared against aStr2.  It will be passed in by
   204  *         SQLite as a non-null-terminated char16_t* buffer.
   205  * @param  aLen2
   206  *         The number of bytes (not characters) in aStr2.
   207  * @param  aStr2
   208  *         The string to be compared against aStr1.  It will be passed in by
   209  *         SQLite as a non-null-terminated char16_t* buffer.
   210  * @return aStr1 - aStr2.  That is, if aStr1 < aStr2, returns a negative number.
   211  *         If aStr1 > aStr2, returns a positive number.  If aStr1 == aStr2,
   212  *         returns 0.
   213  */
   214 NS_HIDDEN_(int) localeCollationAccentSensitive16(void *aService,
   215                                                  int aLen1,
   216                                                  const void *aStr1,
   217                                                  int aLen2,
   218                                                  const void *aStr2);
   220 /**
   221  * Custom UTF-16 collating sequence that respects the application's locale.
   222  * Comparison is case- and accent-sensitive.  This is called by SQLite.
   223  *
   224  * @param  aService
   225  *         The Service that owns the nsICollation used by this collation.
   226  * @param  aLen1
   227  *         The number of bytes (not characters) in aStr1.
   228  * @param  aStr1
   229  *         The string to be compared against aStr2.  It will be passed in by
   230  *         SQLite as a non-null-terminated char16_t* buffer.
   231  * @param  aLen2
   232  *         The number of bytes (not characters) in aStr2.
   233  * @param  aStr2
   234  *         The string to be compared against aStr1.  It will be passed in by
   235  *         SQLite as a non-null-terminated char16_t* buffer.
   236  * @return aStr1 - aStr2.  That is, if aStr1 < aStr2, returns a negative number.
   237  *         If aStr1 > aStr2, returns a positive number.  If aStr1 == aStr2,
   238  *         returns 0.
   239  */
   240 NS_HIDDEN_(int) localeCollationCaseAccentSensitive16(void *aService,
   241                                                      int aLen1,
   242                                                      const void *aStr1,
   243                                                      int aLen2,
   244                                                      const void *aStr2);
   246 } // namespace storage
   247 } // namespace mozilla
   249 #endif // mozilla_storage_SQLCollations_h

mercurial