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 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
16 * The Original Code is Mozilla Storage code.
18 * The Initial Developer of the Original Code is
19 * Mozilla Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 2009
21 * the Initial Developer. All Rights Reserved.
24 * Drew Willcoxon <adw@mozilla.com> (Original Author)
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK ***** */
40 #ifndef mozilla_storage_SQLCollations_h
41 #define mozilla_storage_SQLCollations_h
43 #include "mozStorageService.h"
53 * Registers the collating sequences declared here with the specified
54 * database and Service.
57 * The database we'll be registering the collations with.
59 * The Service that owns the nsICollation used by our collations.
60 * @return the SQLite status code indicating success or failure.
62 NS_HIDDEN_(int) registerCollations(sqlite3
*aDB
, Service
*aService
);
64 ////////////////////////////////////////////////////////////////////////////////
65 //// Predefined Functions
68 * Custom UTF-8 collating sequence that respects the application's locale.
69 * Comparison is case- and accent-insensitive. This is called by SQLite.
72 * The Service that owns the nsICollation used by this collation.
74 * The number of bytes in aStr1.
76 * The string to be compared against aStr2. It will be passed in by
77 * SQLite as a non-null-terminated char* buffer.
79 * The number of bytes in aStr2.
81 * The string to be compared against aStr1. It will be passed in by
82 * SQLite as a non-null-terminated char* buffer.
83 * @return aStr1 - aStr2. That is, if aStr1 < aStr2, returns a negative number.
84 * If aStr1 > aStr2, returns a positive number. If aStr1 == aStr2,
87 NS_HIDDEN_(int) localeCollation8(void *aService
,
94 * Custom UTF-8 collating sequence that respects the application's locale.
95 * Comparison is case-sensitive and accent-insensitive. This is called by
99 * The Service that owns the nsICollation used by this collation.
101 * The number of bytes in aStr1.
103 * The string to be compared against aStr2. It will be passed in by
104 * SQLite as a non-null-terminated char* buffer.
106 * The number of bytes in aStr2.
108 * The string to be compared against aStr1. It will be passed in by
109 * SQLite as a non-null-terminated char* buffer.
110 * @return aStr1 - aStr2. That is, if aStr1 < aStr2, returns a negative number.
111 * If aStr1 > aStr2, returns a positive number. If aStr1 == aStr2,
114 NS_HIDDEN_(int) localeCollationCaseSensitive8(void *aService
,
121 * Custom UTF-8 collating sequence that respects the application's locale.
122 * Comparison is case-insensitive and accent-sensitive. This is called by
126 * The Service that owns the nsICollation used by this collation.
128 * The number of bytes in aStr1.
130 * The string to be compared against aStr2. It will be passed in by
131 * SQLite as a non-null-terminated char* buffer.
133 * The number of bytes in aStr2.
135 * The string to be compared against aStr1. It will be passed in by
136 * SQLite as a non-null-terminated char* buffer.
137 * @return aStr1 - aStr2. That is, if aStr1 < aStr2, returns a negative number.
138 * If aStr1 > aStr2, returns a positive number. If aStr1 == aStr2,
141 NS_HIDDEN_(int) localeCollationAccentSensitive8(void *aService
,
148 * Custom UTF-8 collating sequence that respects the application's locale.
149 * Comparison is case- and accent-sensitive. This is called by SQLite.
152 * The Service that owns the nsICollation used by this collation.
154 * The number of bytes in aStr1.
156 * The string to be compared against aStr2. It will be passed in by
157 * SQLite as a non-null-terminated char* buffer.
159 * The number of bytes in aStr2.
161 * The string to be compared against aStr1. It will be passed in by
162 * SQLite as a non-null-terminated char* buffer.
163 * @return aStr1 - aStr2. That is, if aStr1 < aStr2, returns a negative number.
164 * If aStr1 > aStr2, returns a positive number. If aStr1 == aStr2,
167 NS_HIDDEN_(int) localeCollationCaseAccentSensitive8(void *aService
,
174 * Custom UTF-16 collating sequence that respects the application's locale.
175 * Comparison is case- and accent-insensitive. This is called by SQLite.
178 * The Service that owns the nsICollation used by this collation.
180 * The number of bytes (not characters) in aStr1.
182 * The string to be compared against aStr2. It will be passed in by
183 * SQLite as a non-null-terminated PRUnichar* buffer.
185 * The number of bytes (not characters) in aStr2.
187 * The string to be compared against aStr1. It will be passed in by
188 * SQLite as a non-null-terminated PRUnichar* buffer.
189 * @return aStr1 - aStr2. That is, if aStr1 < aStr2, returns a negative number.
190 * If aStr1 > aStr2, returns a positive number. If aStr1 == aStr2,
193 NS_HIDDEN_(int) localeCollation16(void *aService
,
200 * Custom UTF-16 collating sequence that respects the application's locale.
201 * Comparison is case-sensitive and accent-insensitive. This is called by
205 * The Service that owns the nsICollation used by this collation.
207 * The number of bytes (not characters) in aStr1.
209 * The string to be compared against aStr2. It will be passed in by
210 * SQLite as a non-null-terminated PRUnichar* buffer.
212 * The number of bytes (not characters) in aStr2.
214 * The string to be compared against aStr1. It will be passed in by
215 * SQLite as a non-null-terminated PRUnichar* buffer.
216 * @return aStr1 - aStr2. That is, if aStr1 < aStr2, returns a negative number.
217 * If aStr1 > aStr2, returns a positive number. If aStr1 == aStr2,
220 NS_HIDDEN_(int) localeCollationCaseSensitive16(void *aService
,
227 * Custom UTF-16 collating sequence that respects the application's locale.
228 * Comparison is case-insensitive and accent-sensitive. This is called by
232 * The Service that owns the nsICollation used by this collation.
234 * The number of bytes (not characters) in aStr1.
236 * The string to be compared against aStr2. It will be passed in by
237 * SQLite as a non-null-terminated PRUnichar* buffer.
239 * The number of bytes (not characters) in aStr2.
241 * The string to be compared against aStr1. It will be passed in by
242 * SQLite as a non-null-terminated PRUnichar* buffer.
243 * @return aStr1 - aStr2. That is, if aStr1 < aStr2, returns a negative number.
244 * If aStr1 > aStr2, returns a positive number. If aStr1 == aStr2,
247 NS_HIDDEN_(int) localeCollationAccentSensitive16(void *aService
,
254 * Custom UTF-16 collating sequence that respects the application's locale.
255 * Comparison is case- and accent-sensitive. This is called by SQLite.
258 * The Service that owns the nsICollation used by this collation.
260 * The number of bytes (not characters) in aStr1.
262 * The string to be compared against aStr2. It will be passed in by
263 * SQLite as a non-null-terminated PRUnichar* buffer.
265 * The number of bytes (not characters) in aStr2.
267 * The string to be compared against aStr1. It will be passed in by
268 * SQLite as a non-null-terminated PRUnichar* buffer.
269 * @return aStr1 - aStr2. That is, if aStr1 < aStr2, returns a negative number.
270 * If aStr1 > aStr2, returns a positive number. If aStr1 == aStr2,
273 NS_HIDDEN_(int) localeCollationCaseAccentSensitive16(void *aService
,
279 } // namespace storage
280 } // namespace mozilla
282 #endif // mozilla_storage_SQLCollations_h