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"
20 * Registers the collating sequences declared here with the specified
21 * database and Service.
24 * The database we'll be registering the collations with.
26 * The Service that owns the nsICollation used by our collations.
27 * @return the SQLite status code indicating success or failure.
29 int registerCollations(sqlite3
*aDB
, Service
*aService
);
31 ////////////////////////////////////////////////////////////////////////////////
32 //// Predefined Functions
35 * Custom UTF-8 collating sequence that respects the application's locale.
36 * Comparison is case- and accent-insensitive. This is called by SQLite.
39 * The Service that owns the nsICollation used by this collation.
41 * The number of bytes in aStr1.
43 * The string to be compared against aStr2. It will be passed in by
44 * SQLite as a non-null-terminated char* buffer.
46 * The number of bytes in 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,
54 int localeCollation8(void *aService
,
61 * Custom UTF-8 collating sequence that respects the application's locale.
62 * Comparison is case-sensitive and accent-insensitive. This is called by
66 * The Service that owns the nsICollation used by this collation.
68 * The number of bytes in aStr1.
70 * The string to be compared against aStr2. It will be passed in by
71 * SQLite as a non-null-terminated char* buffer.
73 * The number of bytes in 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,
81 int localeCollationCaseSensitive8(void *aService
,
88 * Custom UTF-8 collating sequence that respects the application's locale.
89 * Comparison is case-insensitive and accent-sensitive. This is called by
93 * The Service that owns the nsICollation used by this collation.
95 * The number of bytes in aStr1.
97 * The string to be compared against aStr2. It will be passed in by
98 * SQLite as a non-null-terminated char* buffer.
100 * The number of bytes in 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,
108 int localeCollationAccentSensitive8(void *aService
,
115 * Custom UTF-8 collating sequence that respects the application's locale.
116 * Comparison is case- and accent-sensitive. This is called by SQLite.
119 * The Service that owns the nsICollation used by this collation.
121 * The number of bytes in aStr1.
123 * The string to be compared against aStr2. It will be passed in by
124 * SQLite as a non-null-terminated char* buffer.
126 * The number of bytes in 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,
134 int localeCollationCaseAccentSensitive8(void *aService
,
141 * Custom UTF-16 collating sequence that respects the application's locale.
142 * Comparison is case- and accent-insensitive. This is called by SQLite.
145 * The Service that owns the nsICollation used by this collation.
147 * The number of bytes (not characters) in 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.
152 * The number of bytes (not characters) in 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,
160 int localeCollation16(void *aService
,
167 * Custom UTF-16 collating sequence that respects the application's locale.
168 * Comparison is case-sensitive and accent-insensitive. This is called by
172 * The Service that owns the nsICollation used by this collation.
174 * The number of bytes (not characters) in 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.
179 * The number of bytes (not characters) in 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,
187 int localeCollationCaseSensitive16(void *aService
,
194 * Custom UTF-16 collating sequence that respects the application's locale.
195 * Comparison is case-insensitive and accent-sensitive. This is called by
199 * The Service that owns the nsICollation used by this collation.
201 * The number of bytes (not characters) in 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.
206 * The number of bytes (not characters) in 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,
214 int localeCollationAccentSensitive16(void *aService
,
221 * Custom UTF-16 collating sequence that respects the application's locale.
222 * Comparison is case- and accent-sensitive. This is called by SQLite.
225 * The Service that owns the nsICollation used by this collation.
227 * The number of bytes (not characters) in 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.
232 * The number of bytes (not characters) in 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,
240 int localeCollationCaseAccentSensitive16(void *aService
,
246 } // namespace storage
247 } // namespace mozilla
249 #endif // mozilla_storage_SQLCollations_h