Bug 628949 - Update visible region / glass regions after we paint. r=roc a=2.0.
[mozilla-central.git] / storage / src / SQLCollations.h
blob7cc411dba0d3882a5af8ecf8dec9a90a118bc442
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
14 * License.
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.
23 * Contributor(s):
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"
44 #include "nscore.h"
45 #include "nsString.h"
47 #include "sqlite3.h"
49 namespace mozilla {
50 namespace storage {
52 /**
53 * Registers the collating sequences declared here with the specified
54 * database and Service.
56 * @param aDB
57 * The database we'll be registering the collations with.
58 * @param aService
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
67 /**
68 * Custom UTF-8 collating sequence that respects the application's locale.
69 * Comparison is case- and accent-insensitive. This is called by SQLite.
71 * @param aService
72 * The Service that owns the nsICollation used by this collation.
73 * @param aLen1
74 * The number of bytes in aStr1.
75 * @param aStr1
76 * The string to be compared against aStr2. It will be passed in by
77 * SQLite as a non-null-terminated char* buffer.
78 * @param aLen2
79 * The number of bytes in aStr2.
80 * @param 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,
85 * returns 0.
87 NS_HIDDEN_(int) localeCollation8(void *aService,
88 int aLen1,
89 const void *aStr1,
90 int aLen2,
91 const void *aStr2);
93 /**
94 * Custom UTF-8 collating sequence that respects the application's locale.
95 * Comparison is case-sensitive and accent-insensitive. This is called by
96 * SQLite.
98 * @param aService
99 * The Service that owns the nsICollation used by this collation.
100 * @param aLen1
101 * The number of bytes in aStr1.
102 * @param aStr1
103 * The string to be compared against aStr2. It will be passed in by
104 * SQLite as a non-null-terminated char* buffer.
105 * @param aLen2
106 * The number of bytes in aStr2.
107 * @param 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,
112 * returns 0.
114 NS_HIDDEN_(int) localeCollationCaseSensitive8(void *aService,
115 int aLen1,
116 const void *aStr1,
117 int aLen2,
118 const void *aStr2);
121 * Custom UTF-8 collating sequence that respects the application's locale.
122 * Comparison is case-insensitive and accent-sensitive. This is called by
123 * SQLite.
125 * @param aService
126 * The Service that owns the nsICollation used by this collation.
127 * @param aLen1
128 * The number of bytes in aStr1.
129 * @param aStr1
130 * The string to be compared against aStr2. It will be passed in by
131 * SQLite as a non-null-terminated char* buffer.
132 * @param aLen2
133 * The number of bytes in aStr2.
134 * @param 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,
139 * returns 0.
141 NS_HIDDEN_(int) localeCollationAccentSensitive8(void *aService,
142 int aLen1,
143 const void *aStr1,
144 int aLen2,
145 const void *aStr2);
148 * Custom UTF-8 collating sequence that respects the application's locale.
149 * Comparison is case- and accent-sensitive. This is called by SQLite.
151 * @param aService
152 * The Service that owns the nsICollation used by this collation.
153 * @param aLen1
154 * The number of bytes in aStr1.
155 * @param aStr1
156 * The string to be compared against aStr2. It will be passed in by
157 * SQLite as a non-null-terminated char* buffer.
158 * @param aLen2
159 * The number of bytes in aStr2.
160 * @param 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,
165 * returns 0.
167 NS_HIDDEN_(int) localeCollationCaseAccentSensitive8(void *aService,
168 int aLen1,
169 const void *aStr1,
170 int aLen2,
171 const void *aStr2);
174 * Custom UTF-16 collating sequence that respects the application's locale.
175 * Comparison is case- and accent-insensitive. This is called by SQLite.
177 * @param aService
178 * The Service that owns the nsICollation used by this collation.
179 * @param aLen1
180 * The number of bytes (not characters) in aStr1.
181 * @param aStr1
182 * The string to be compared against aStr2. It will be passed in by
183 * SQLite as a non-null-terminated PRUnichar* buffer.
184 * @param aLen2
185 * The number of bytes (not characters) in aStr2.
186 * @param 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,
191 * returns 0.
193 NS_HIDDEN_(int) localeCollation16(void *aService,
194 int aLen1,
195 const void *aStr1,
196 int aLen2,
197 const void *aStr2);
200 * Custom UTF-16 collating sequence that respects the application's locale.
201 * Comparison is case-sensitive and accent-insensitive. This is called by
202 * SQLite.
204 * @param aService
205 * The Service that owns the nsICollation used by this collation.
206 * @param aLen1
207 * The number of bytes (not characters) in aStr1.
208 * @param aStr1
209 * The string to be compared against aStr2. It will be passed in by
210 * SQLite as a non-null-terminated PRUnichar* buffer.
211 * @param aLen2
212 * The number of bytes (not characters) in aStr2.
213 * @param 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,
218 * returns 0.
220 NS_HIDDEN_(int) localeCollationCaseSensitive16(void *aService,
221 int aLen1,
222 const void *aStr1,
223 int aLen2,
224 const void *aStr2);
227 * Custom UTF-16 collating sequence that respects the application's locale.
228 * Comparison is case-insensitive and accent-sensitive. This is called by
229 * SQLite.
231 * @param aService
232 * The Service that owns the nsICollation used by this collation.
233 * @param aLen1
234 * The number of bytes (not characters) in aStr1.
235 * @param aStr1
236 * The string to be compared against aStr2. It will be passed in by
237 * SQLite as a non-null-terminated PRUnichar* buffer.
238 * @param aLen2
239 * The number of bytes (not characters) in aStr2.
240 * @param 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,
245 * returns 0.
247 NS_HIDDEN_(int) localeCollationAccentSensitive16(void *aService,
248 int aLen1,
249 const void *aStr1,
250 int aLen2,
251 const void *aStr2);
254 * Custom UTF-16 collating sequence that respects the application's locale.
255 * Comparison is case- and accent-sensitive. This is called by SQLite.
257 * @param aService
258 * The Service that owns the nsICollation used by this collation.
259 * @param aLen1
260 * The number of bytes (not characters) in aStr1.
261 * @param aStr1
262 * The string to be compared against aStr2. It will be passed in by
263 * SQLite as a non-null-terminated PRUnichar* buffer.
264 * @param aLen2
265 * The number of bytes (not characters) in aStr2.
266 * @param 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,
271 * returns 0.
273 NS_HIDDEN_(int) localeCollationCaseAccentSensitive16(void *aService,
274 int aLen1,
275 const void *aStr1,
276 int aLen2,
277 const void *aStr2);
279 } // namespace storage
280 } // namespace mozilla
282 #endif // mozilla_storage_SQLCollations_h