]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/unistr_case_locale.cpp
2 *******************************************************************************
3 * Copyright (C) 2011, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 *******************************************************************************
6 * file name: unistr_case_locale.cpp
8 * tab size: 8 (not used)
11 * created on: 2011may31
12 * created by: Markus W. Scherer
14 * Locale-sensitive case mapping functions (ones that call uloc_getDefault())
15 * were moved here to break dependency cycles among parts of the common library.
18 #include "unicode/utypes.h"
19 #include "unicode/locid.h"
20 #include "unicode/unistr.h"
26 //========================================
27 // Write implementation
28 //========================================
31 * Set parameters on an empty UCaseMap, for UCaseMap-less API functions.
32 * Do this fast because it is called with every function call.
35 setTempCaseMap(UCaseMap
*csm
, const char *locale
) {
37 csm
->csp
=ucase_getSingleton();
39 if(locale
!=NULL
&& locale
[0]==0) {
42 ustrcase_setTempCaseMapLocale(csm
, locale
);
47 UnicodeString::toLower() {
48 return toLower(Locale::getDefault());
52 UnicodeString::toLower(const Locale
&locale
) {
53 UCaseMap csm
=UCASEMAP_INITIALIZER
;
54 setTempCaseMap(&csm
, locale
.getName());
55 return caseMap(&csm
, ustrcase_internalToLower
);
59 UnicodeString::toUpper() {
60 return toUpper(Locale::getDefault());
64 UnicodeString::toUpper(const Locale
&locale
) {
65 UCaseMap csm
=UCASEMAP_INITIALIZER
;
66 setTempCaseMap(&csm
, locale
.getName());
67 return caseMap(&csm
, ustrcase_internalToUpper
);