| 1 |
/* |
| 2 |
* Copyright 2010-2011 Various Authors |
| 3 |
* Copyright 2010 Johannes Weißl |
| 4 |
* |
| 5 |
* This program is free software; you can redistribute it and/or |
| 6 |
* modify it under the terms of the GNU General Public License as |
| 7 |
* published by the Free Software Foundation; either version 2 of the |
| 8 |
* License, or (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, but |
| 11 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
#ifndef U_COLLATE_H |
| 20 |
#define U_COLLATE_H |
| 21 |
|
| 22 |
/* |
| 23 |
* @str1 valid, normalized, null-terminated UTF-8 string |
| 24 |
* @str2 valid, normalized, null-terminated UTF-8 string |
| 25 |
* |
| 26 |
* Compares two strings for ordering using the linguistically |
| 27 |
* correct rules for the current locale. |
| 28 |
* |
| 29 |
* Returns -1 if @str1 compares before @str2, 0 if they compare equal, |
| 30 |
* +1 if @str1 compares after @str2. |
| 31 |
*/ |
| 32 |
int u_strcoll(const char *str1, const char *str2); |
| 33 |
|
| 34 |
/* |
| 35 |
* @str1 valid, normalized, null-terminated UTF-8 string |
| 36 |
* @str2 valid, normalized, null-terminated UTF-8 string |
| 37 |
* |
| 38 |
* Like u_strcoll(), but do casefolding before comparing. |
| 39 |
*/ |
| 40 |
int u_strcasecoll(const char *str1, const char *str2); |
| 41 |
|
| 42 |
/* |
| 43 |
* @str1 valid, normalized, null-terminated UTF-8 string or NULL |
| 44 |
* @str2 valid, normalized, null-terminated UTF-8 string or NULL |
| 45 |
* |
| 46 |
* Like u_strcasecoll(), but handle NULL pointers gracefully. |
| 47 |
*/ |
| 48 |
int u_strcasecoll0(const char *str1, const char *str2); |
| 49 |
|
| 50 |
/* |
| 51 |
* @str valid, normalized, null-terminated UTF-8 string |
| 52 |
* |
| 53 |
* Converts a string into a collation key that can be compared |
| 54 |
* with other collation keys produced by the same function using |
| 55 |
* strcmp(). |
| 56 |
* |
| 57 |
* Returns a newly allocated string. |
| 58 |
*/ |
| 59 |
char *u_strcoll_key(const char *str); |
| 60 |
|
| 61 |
/* |
| 62 |
* @str valid, normalized, null-terminated UTF-8 string |
| 63 |
* |
| 64 |
* Like u_strcoll_key(), but do casefolding before generating key. |
| 65 |
* |
| 66 |
* Returns a newly allocated string. |
| 67 |
*/ |
| 68 |
char *u_strcasecoll_key(const char *str); |
| 69 |
|
| 70 |
/* |
| 71 |
* @str valid, normalized, null-terminated UTF-8 string or NULL |
| 72 |
* |
| 73 |
* Like u_strcasecoll_key(), but handle NULL pointers gracefully. |
| 74 |
*/ |
| 75 |
char *u_strcasecoll_key0(const char *str); |
| 76 |
|
| 77 |
#endif |