1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
/*********************************************************
* Copyright (C) 2008 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation version 2.1 and no later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
*********************************************************/
/*
* unicodeICU.h --
*
* Unicode operations that depend on the third-party ICU support
* library.
*/
#ifndef _UNICODE_ICU_H_
#define _UNICODE_ICU_H_
#define INCLUDE_ALLOW_USERLEVEL
#ifndef USE_ICU
#error These interfaces require the ICU library (define USE_ICU).
#endif
#include "includeCheck.h"
#include "unicodeBase.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
UNICODE_COMPARE_DEFAULT = 0,
UNICODE_COMPARE_IGNORE_ACCENTS,
UNICODE_COMPARE_IGNORE_CASE,
UNICODE_COMPARE_IGNORE_PUNCTUATION
} UnicodeCompareOption;
/*
* Different languages and cultures have unique rules for how strings
* are compared and sorted. For example:
*
* Swedish: z < "o with umlaut"
* German: "o with umlaut" < z
*
* When producing a result visible to the user (like a sorted list of
* virtual machine names) string comparsion must obey the rules set by
* the user's language and culture, collectively called the "locale".
*/
int Unicode_CompareWithLocale(ConstUnicode str1,
ConstUnicode str2,
const char *locale,
UnicodeCompareOption compareOption);
/*
* Transforms the case of the string using the given locale's rules.
*
* Pass in a NULL locale to use the process's default locale.
*
* Changing the case of a string can change its length, so don't
* assume the string is the same length after calling these functions.
*/
Unicode Unicode_ToLower(ConstUnicode str, const char *locale);
Unicode Unicode_ToUpper(ConstUnicode str, const char *locale);
#ifdef HAVE_ICU_38
Unicode Unicode_ToTitle(ConstUnicode str, const char *locale);
#endif
typedef enum {
UNICODE_NORMAL_FORM_C, // "e with acute accent" -> U+00E9
UNICODE_NORMAL_FORM_D // "e with acute accent" -> U+0065 U+0302
} UnicodeNormalizationForm;
/*
* Normalizes Unicode characters composed of multiple parts into a
* standard form.
*/
Unicode Unicode_Normalize(ConstUnicode str,
UnicodeNormalizationForm form);
#ifdef __cplusplus
}
#endif
#endif // _UNICODE_ICU_H_
|