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