-rw-r--r-- | library/backend/stringutil.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/library/backend/stringutil.cpp b/library/backend/stringutil.cpp index b5fbd3e..f1ad1b9 100644 --- a/library/backend/stringutil.cpp +++ b/library/backend/stringutil.cpp | |||
@@ -52,29 +52,29 @@ static const char collationHack[] = { | |||
52 | 0x10, //C-P | 52 | 0x10, //C-P |
53 | 0x11, //C-Q | 53 | 0x11, //C-Q |
54 | 0x12, //C-R | 54 | 0x12, //C-R |
55 | 0x13, //C-S | 55 | 0x13, //C-S |
56 | 0x14, //C-T | 56 | 0x14, //C-T |
57 | 0x15, //C-U | 57 | 0x15, //C-U |
58 | 0x16, //C-V | 58 | 0x16, //C-V |
59 | 0x17, //C-W | 59 | 0x17, //C-W |
60 | 0x18, //C-X | 60 | 0x18, //C-X |
61 | 0x19, //C-Y | 61 | 0x19, //C-Y |
62 | 0x1a, //C-Z | 62 | 0x1a, //C-Z |
63 | 0x1b, //C-[ | 63 | 0x1b, //C-[ |
64 | 0x1c, //C-\ | 64 | 0x1c, /* C-\ */ |
65 | 0x1d, //C-] | 65 | 0x1d, //C-] |
66 | 0x1e, //C-^ | 66 | 0x1e, //C-^ |
67 | 0x1f, //C-_ | 67 | 0x1f, //C-_ |
68 | ' ', // | 68 | ' ', // |
69 | '!', //! | 69 | '!', //! |
70 | '"', //" | 70 | '"', //" |
71 | '#', //# | 71 | '#', //# |
72 | '$', //$ | 72 | '$', //$ |
73 | '%', //% | 73 | '%', //% |
74 | '&', //& | 74 | '&', //& |
75 | '\'', //' | 75 | '\'', //' |
76 | '(', //( | 76 | '(', //( |
77 | ')', //) | 77 | ')', //) |
78 | '*', //* | 78 | '*', //* |
79 | '+', //+ | 79 | '+', //+ |
80 | ',', //, | 80 | ',', //, |
@@ -116,25 +116,25 @@ static const char collationHack[] = { | |||
116 | 'P', //P | 116 | 'P', //P |
117 | 'Q', //Q | 117 | 'Q', //Q |
118 | 'R', //R | 118 | 'R', //R |
119 | 'S', //S | 119 | 'S', //S |
120 | 'T', //T | 120 | 'T', //T |
121 | 'U', //U | 121 | 'U', //U |
122 | 'V', //V | 122 | 'V', //V |
123 | 'W', //W | 123 | 'W', //W |
124 | 'X', //X | 124 | 'X', //X |
125 | 'Y', //Y | 125 | 'Y', //Y |
126 | 'Z', //Z | 126 | 'Z', //Z |
127 | '[', //[ | 127 | '[', //[ |
128 | '\\', //\ | 128 | '\\', /* \ */ |
129 | ']', //] | 129 | ']', //] |
130 | '^', //^ | 130 | '^', //^ |
131 | '_', //_ | 131 | '_', //_ |
132 | '`', //` | 132 | '`', //` |
133 | 'A', //a | 133 | 'A', //a |
134 | 'B', //b | 134 | 'B', //b |
135 | 'C', //c | 135 | 'C', //c |
136 | 'D', //d | 136 | 'D', //d |
137 | 'E', //e | 137 | 'E', //e |
138 | 'F', //f | 138 | 'F', //f |
139 | 'G', //g | 139 | 'G', //g |
140 | 'H', //h | 140 | 'H', //h |
@@ -180,25 +180,25 @@ static const char collationHack[] = { | |||
180 | 0x90, //C-M-P | 180 | 0x90, //C-M-P |
181 | 0x91, //C-M-Q | 181 | 0x91, //C-M-Q |
182 | 0x92, //C-M-R | 182 | 0x92, //C-M-R |
183 | 0x93, //C-M-S | 183 | 0x93, //C-M-S |
184 | 0x94, //C-M-T | 184 | 0x94, //C-M-T |
185 | 0x95, //C-M-U | 185 | 0x95, //C-M-U |
186 | 0x96, //C-M-V | 186 | 0x96, //C-M-V |
187 | 0x97, //C-M-W | 187 | 0x97, //C-M-W |
188 | 0x98, //C-M-X | 188 | 0x98, //C-M-X |
189 | 0x99, //C-M-Y | 189 | 0x99, //C-M-Y |
190 | 0x9a, //C-M-Z | 190 | 0x9a, //C-M-Z |
191 | 0x9b, //C-M-[ | 191 | 0x9b, //C-M-[ |
192 | 0x9c, //C-M-\ | 192 | 0x9c, /* C-M-\ */ |
193 | 0x9d, //C-M-] | 193 | 0x9d, //C-M-] |
194 | 0x9e, //C-M-^ | 194 | 0x9e, //C-M-^ |
195 | 0x9f, //C-M-_ | 195 | 0x9f, //C-M-_ |
196 | ' ', // | 196 | ' ', // |
197 | '¡', //¡ | 197 | '¡', //¡ |
198 | '¢', //¢ | 198 | '¢', //¢ |
199 | '£', //£ | 199 | '£', //£ |
200 | '¤', //¤ | 200 | '¤', //¤ |
201 | '¥', //¥ | 201 | '¥', //¥ |
202 | '¦', //¦ | 202 | '¦', //¦ |
203 | '§', //§ | 203 | '§', //§ |
204 | '¨', //¨ | 204 | '¨', //¨ |
@@ -310,43 +310,43 @@ QString buildSortKey( const QString & s ) | |||
310 | QString res = s; | 310 | QString res = s; |
311 | hackString( res ); | 311 | hackString( res ); |
312 | return res; | 312 | return res; |
313 | } | 313 | } |
314 | 314 | ||
315 | QString buildSortKey( const QString & s1, const QString & s2 ) | 315 | QString buildSortKey( const QString & s1, const QString & s2 ) |
316 | { | 316 | { |
317 | QString res = s1 + QChar( '\0' ) + s2; | 317 | QString res = s1 + QChar( '\0' ) + s2; |
318 | hackString( res ); | 318 | hackString( res ); |
319 | return res; | 319 | return res; |
320 | } | 320 | } |
321 | 321 | ||
322 | QString buildSortKey( const QString & s1, const QString & s2, | 322 | QString buildSortKey( const QString & s1, const QString & s2, |
323 | const QString & s3 ) | 323 | const QString & s3 ) |
324 | { | 324 | { |
325 | QString res = s1 + QChar( '\0' ) + s2 + QChar( '\0' ) + s3; | 325 | QString res = s1 + QChar( '\0' ) + s2 + QChar( '\0' ) + s3; |
326 | hackString( res ); | 326 | hackString( res ); |
327 | return res; | 327 | return res; |
328 | } | 328 | } |
329 | 329 | ||
330 | static inline QChar coll( QChar u ) | 330 | static inline QChar coll( QChar u ) |
331 | { | 331 | { |
332 | return u.row() ? u : QChar(collationHack[ u.cell() ]); | 332 | return u.row() ? u : QChar(collationHack[ u.cell() ]); |
333 | } | 333 | } |
334 | 334 | ||
335 | 335 | ||
336 | int compare( const QString & s1, const QString & s2 ) | 336 | int compare( const QString & s1, const QString & s2 ) |
337 | { | 337 | { |
338 | const QChar* u1 = s1.unicode(); | 338 | const QChar* u1 = s1.unicode(); |
339 | const QChar* u2 = s2.unicode(); | 339 | const QChar* u2 = s2.unicode(); |
340 | 340 | ||
341 | if ( u1 == u2 ) | 341 | if ( u1 == u2 ) |
342 | return 0; | 342 | return 0; |
343 | if ( u1 == 0 ) | 343 | if ( u1 == 0 ) |
344 | return 1; | 344 | return 1; |
345 | if ( u2 == 0 ) | 345 | if ( u2 == 0 ) |
346 | return -1; | 346 | return -1; |
347 | int l=QMIN(s1.length(),s2.length()); | 347 | int l=QMIN(s1.length(),s2.length()); |
348 | while ( l-- && coll(*u1) == coll(*u2) ) | 348 | while ( l-- && coll(*u1) == coll(*u2) ) |
349 | u1++,u2++; | 349 | u1++,u2++; |
350 | if ( l==-1 ) | 350 | if ( l==-1 ) |
351 | return ( s1.length()-s2.length() ); | 351 | return ( s1.length()-s2.length() ); |
352 | return u1->unicode() - u2->unicode(); | 352 | return u1->unicode() - u2->unicode(); |