Bug 1632310 [wpt PR 23186] - Add test for computed versus resolved style., a=testonly
[gecko.git] / storage / SQLCollations.h
blobd0bb53d2db11e854c2f655ca8b3faa95f635e582
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"
11 #include "nscore.h"
12 #include "nsString.h"
14 #include "sqlite3.h"
16 namespace mozilla {
17 namespace storage {
19 /**
20 * Registers the collating sequences declared here with the specified
21 * database and Service.
23 * @param aDB
24 * The database we'll be registering the collations with.
25 * @param aService
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
34 /**
35 * Custom UTF-8 collating sequence that respects the application's locale.
36 * Comparison is case- and accent-insensitive. This is called by SQLite.
38 * @param aService
39 * The Service that owns the nsICollation used by this collation.
40 * @param aLen1
41 * The number of bytes in aStr1.
42 * @param aStr1
43 * The string to be compared against aStr2. It will be passed in by
44 * SQLite as a non-null-terminated char* buffer.
45 * @param aLen2
46 * The number of bytes in aStr2.
47 * @param 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,
52 * returns 0.
54 int localeCollation8(void* aService, int aLen1, const void* aStr1, int aLen2,
55 const void* aStr2);
57 /**
58 * Custom UTF-8 collating sequence that respects the application's locale.
59 * Comparison is case-sensitive and accent-insensitive. This is called by
60 * SQLite.
62 * @param aService
63 * The Service that owns the nsICollation used by this collation.
64 * @param aLen1
65 * The number of bytes in aStr1.
66 * @param aStr1
67 * The string to be compared against aStr2. It will be passed in by
68 * SQLite as a non-null-terminated char* buffer.
69 * @param aLen2
70 * The number of bytes in aStr2.
71 * @param 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,
76 * returns 0.
78 int localeCollationCaseSensitive8(void* aService, int aLen1, const void* aStr1,
79 int aLen2, const void* aStr2);
81 /**
82 * Custom UTF-8 collating sequence that respects the application's locale.
83 * Comparison is case-insensitive and accent-sensitive. This is called by
84 * SQLite.
86 * @param aService
87 * The Service that owns the nsICollation used by this collation.
88 * @param aLen1
89 * The number of bytes in aStr1.
90 * @param aStr1
91 * The string to be compared against aStr2. It will be passed in by
92 * SQLite as a non-null-terminated char* buffer.
93 * @param aLen2
94 * The number of bytes in aStr2.
95 * @param 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,
100 * returns 0.
102 int localeCollationAccentSensitive8(void* aService, int aLen1,
103 const void* aStr1, int aLen2,
104 const void* aStr2);
107 * Custom UTF-8 collating sequence that respects the application's locale.
108 * Comparison is case- and accent-sensitive. This is called by SQLite.
110 * @param aService
111 * The Service that owns the nsICollation used by this collation.
112 * @param aLen1
113 * The number of bytes in aStr1.
114 * @param aStr1
115 * The string to be compared against aStr2. It will be passed in by
116 * SQLite as a non-null-terminated char* buffer.
117 * @param aLen2
118 * The number of bytes in aStr2.
119 * @param 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,
124 * returns 0.
126 int localeCollationCaseAccentSensitive8(void* aService, int aLen1,
127 const void* aStr1, int aLen2,
128 const void* aStr2);
131 * Custom UTF-16 collating sequence that respects the application's locale.
132 * Comparison is case- and accent-insensitive. This is called by SQLite.
134 * @param aService
135 * The Service that owns the nsICollation used by this collation.
136 * @param aLen1
137 * The number of bytes (not characters) in aStr1.
138 * @param 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.
141 * @param aLen2
142 * The number of bytes (not characters) in aStr2.
143 * @param 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,
148 * returns 0.
150 int localeCollation16(void* aService, int aLen1, const void* aStr1, int aLen2,
151 const void* aStr2);
154 * Custom UTF-16 collating sequence that respects the application's locale.
155 * Comparison is case-sensitive and accent-insensitive. This is called by
156 * SQLite.
158 * @param aService
159 * The Service that owns the nsICollation used by this collation.
160 * @param aLen1
161 * The number of bytes (not characters) in aStr1.
162 * @param 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.
165 * @param aLen2
166 * The number of bytes (not characters) in aStr2.
167 * @param 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,
172 * returns 0.
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
180 * SQLite.
182 * @param aService
183 * The Service that owns the nsICollation used by this collation.
184 * @param aLen1
185 * The number of bytes (not characters) in aStr1.
186 * @param 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.
189 * @param aLen2
190 * The number of bytes (not characters) in aStr2.
191 * @param 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,
196 * returns 0.
198 int localeCollationAccentSensitive16(void* aService, int aLen1,
199 const void* aStr1, int aLen2,
200 const void* aStr2);
203 * Custom UTF-16 collating sequence that respects the application's locale.
204 * Comparison is case- and accent-sensitive. This is called by SQLite.
206 * @param aService
207 * The Service that owns the nsICollation used by this collation.
208 * @param aLen1
209 * The number of bytes (not characters) in aStr1.
210 * @param 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.
213 * @param aLen2
214 * The number of bytes (not characters) in aStr2.
215 * @param 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,
220 * returns 0.
222 int localeCollationCaseAccentSensitive16(void* aService, int aLen1,
223 const void* aStr1, int aLen2,
224 const void* aStr2);
226 } // namespace storage
227 } // namespace mozilla
229 #endif // mozilla_storage_SQLCollations_h