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
, int aLen1
, const void* aStr1
, int aLen2
,
58 * Custom UTF-8 collating sequence that respects the application's locale.
59 * Comparison is case-sensitive and accent-insensitive. This is called by
63 * The Service that owns the nsICollation used by this collation.
65 * The number of bytes in aStr1.
67 * The string to be compared against aStr2. It will be passed in by
68 * SQLite as a non-null-terminated char* buffer.
70 * The number of bytes in aStr2.
72 * The string to be compared against aStr1. It will be passed in by
73 * SQLite as a non-null-terminated char* buffer.
74 * @return aStr1 - aStr2. That is, if aStr1 < aStr2, returns a negative number.
75 * If aStr1 > aStr2, returns a positive number. If aStr1 == aStr2,
78 int localeCollationCaseSensitive8(void* aService
, int aLen1
, const void* aStr1
,
79 int aLen2
, const void* aStr2
);
82 * Custom UTF-8 collating sequence that respects the application's locale.
83 * Comparison is case-insensitive and accent-sensitive. This is called by
87 * The Service that owns the nsICollation used by this collation.
89 * The number of bytes in aStr1.
91 * The string to be compared against aStr2. It will be passed in by
92 * SQLite as a non-null-terminated char* buffer.
94 * The number of bytes in aStr2.
96 * The string to be compared against aStr1. It will be passed in by
97 * SQLite as a non-null-terminated char* buffer.
98 * @return aStr1 - aStr2. That is, if aStr1 < aStr2, returns a negative number.
99 * If aStr1 > aStr2, returns a positive number. If aStr1 == aStr2,
102 int localeCollationAccentSensitive8(void* aService
, int aLen1
,
103 const void* aStr1
, int aLen2
,
107 * Custom UTF-8 collating sequence that respects the application's locale.
108 * Comparison is case- and accent-sensitive. This is called by SQLite.
111 * The Service that owns the nsICollation used by this collation.
113 * The number of bytes in aStr1.
115 * The string to be compared against aStr2. It will be passed in by
116 * SQLite as a non-null-terminated char* buffer.
118 * The number of bytes in aStr2.
120 * The string to be compared against aStr1. It will be passed in by
121 * SQLite as a non-null-terminated char* buffer.
122 * @return aStr1 - aStr2. That is, if aStr1 < aStr2, returns a negative number.
123 * If aStr1 > aStr2, returns a positive number. If aStr1 == aStr2,
126 int localeCollationCaseAccentSensitive8(void* aService
, int aLen1
,
127 const void* aStr1
, int aLen2
,
131 * Custom UTF-16 collating sequence that respects the application's locale.
132 * Comparison is case- and accent-insensitive. This is called by SQLite.
135 * The Service that owns the nsICollation used by this collation.
137 * The number of bytes (not characters) in aStr1.
139 * The string to be compared against aStr2. It will be passed in by
140 * SQLite as a non-null-terminated char16_t* buffer.
142 * The number of bytes (not characters) in aStr2.
144 * The string to be compared against aStr1. It will be passed in by
145 * SQLite as a non-null-terminated char16_t* buffer.
146 * @return aStr1 - aStr2. That is, if aStr1 < aStr2, returns a negative number.
147 * If aStr1 > aStr2, returns a positive number. If aStr1 == aStr2,
150 int localeCollation16(void* aService
, int aLen1
, const void* aStr1
, int aLen2
,
154 * Custom UTF-16 collating sequence that respects the application's locale.
155 * Comparison is case-sensitive and accent-insensitive. This is called by
159 * The Service that owns the nsICollation used by this collation.
161 * The number of bytes (not characters) in aStr1.
163 * The string to be compared against aStr2. It will be passed in by
164 * SQLite as a non-null-terminated char16_t* buffer.
166 * The number of bytes (not characters) in aStr2.
168 * The string to be compared against aStr1. It will be passed in by
169 * SQLite as a non-null-terminated char16_t* buffer.
170 * @return aStr1 - aStr2. That is, if aStr1 < aStr2, returns a negative number.
171 * If aStr1 > aStr2, returns a positive number. If aStr1 == aStr2,
174 int localeCollationCaseSensitive16(void* aService
, int aLen1
, const void* aStr1
,
175 int aLen2
, const void* aStr2
);
178 * Custom UTF-16 collating sequence that respects the application's locale.
179 * Comparison is case-insensitive and accent-sensitive. This is called by
183 * The Service that owns the nsICollation used by this collation.
185 * The number of bytes (not characters) in aStr1.
187 * The string to be compared against aStr2. It will be passed in by
188 * SQLite as a non-null-terminated char16_t* buffer.
190 * The number of bytes (not characters) in aStr2.
192 * The string to be compared against aStr1. It will be passed in by
193 * SQLite as a non-null-terminated char16_t* buffer.
194 * @return aStr1 - aStr2. That is, if aStr1 < aStr2, returns a negative number.
195 * If aStr1 > aStr2, returns a positive number. If aStr1 == aStr2,
198 int localeCollationAccentSensitive16(void* aService
, int aLen1
,
199 const void* aStr1
, int aLen2
,
203 * Custom UTF-16 collating sequence that respects the application's locale.
204 * Comparison is case- and accent-sensitive. This is called by SQLite.
207 * The Service that owns the nsICollation used by this collation.
209 * The number of bytes (not characters) in aStr1.
211 * The string to be compared against aStr2. It will be passed in by
212 * SQLite as a non-null-terminated char16_t* buffer.
214 * The number of bytes (not characters) in aStr2.
216 * The string to be compared against aStr1. It will be passed in by
217 * SQLite as a non-null-terminated char16_t* buffer.
218 * @return aStr1 - aStr2. That is, if aStr1 < aStr2, returns a negative number.
219 * If aStr1 > aStr2, returns a positive number. If aStr1 == aStr2,
222 int localeCollationCaseAccentSensitive16(void* aService
, int aLen1
,
223 const void* aStr1
, int aLen2
,
226 } // namespace storage
227 } // namespace mozilla
229 #endif // mozilla_storage_SQLCollations_h