1 | // © 2016 and later: Unicode, Inc. and others. |
2 | // License & terms of use: http://www.unicode.org/copyright.html |
3 | /* |
4 | ******************************************************************************* |
5 | * Copyright (C) 2011, International Business Machines |
6 | * Corporation and others. All Rights Reserved. |
7 | ******************************************************************************* |
8 | * file name: unistr_case_locale.cpp |
9 | * encoding: UTF-8 |
10 | * tab size: 8 (not used) |
11 | * indentation:4 |
12 | * |
13 | * created on: 2011may31 |
14 | * created by: Markus W. Scherer |
15 | * |
16 | * Locale-sensitive case mapping functions (ones that call uloc_getDefault()) |
17 | * were moved here to break dependency cycles among parts of the common library. |
18 | */ |
19 | |
20 | #include "unicode/utypes.h" |
21 | #include "unicode/locid.h" |
22 | #include "unicode/ucasemap.h" |
23 | #include "unicode/unistr.h" |
24 | #include "ucasemap_imp.h" |
25 | |
26 | U_NAMESPACE_BEGIN |
27 | |
28 | //======================================== |
29 | // Write implementation |
30 | //======================================== |
31 | |
32 | UnicodeString & |
33 | UnicodeString::toLower() { |
34 | return caseMap(ustrcase_getCaseLocale(NULL), 0, |
35 | UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalToLower); |
36 | } |
37 | |
38 | UnicodeString & |
39 | UnicodeString::toLower(const Locale &locale) { |
40 | return caseMap(ustrcase_getCaseLocale(locale.getBaseName()), 0, |
41 | UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalToLower); |
42 | } |
43 | |
44 | UnicodeString & |
45 | UnicodeString::toUpper() { |
46 | return caseMap(ustrcase_getCaseLocale(NULL), 0, |
47 | UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalToUpper); |
48 | } |
49 | |
50 | UnicodeString & |
51 | UnicodeString::toUpper(const Locale &locale) { |
52 | return caseMap(ustrcase_getCaseLocale(locale.getBaseName()), 0, |
53 | UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalToUpper); |
54 | } |
55 | |
56 | U_NAMESPACE_END |
57 | |