/src/icu/source/common/unistr_titlecase_brkiter.cpp
Line  | Count  | Source (jump to first uncovered line)  | 
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_titlecase_brkiter.cpp  | 
9  |  | *   encoding:   UTF-8  | 
10  |  | *   tab size:   8 (not used)  | 
11  |  | *   indentation:2  | 
12  |  | *  | 
13  |  | *   created on: 2011may30  | 
14  |  | *   created by: Markus W. Scherer  | 
15  |  | *  | 
16  |  | *   Titlecasing functions that are based on BreakIterator  | 
17  |  | *   were moved here to break dependency cycles among parts of the common library.  | 
18  |  | */  | 
19  |  |  | 
20  |  | #include "unicode/utypes.h"  | 
21  |  |  | 
22  |  | #if !UCONFIG_NO_BREAK_ITERATION  | 
23  |  |  | 
24  |  | #include "unicode/brkiter.h"  | 
25  |  | #include "unicode/locid.h"  | 
26  |  | #include "unicode/ucasemap.h"  | 
27  |  | #include "unicode/unistr.h"  | 
28  |  | #include "ucasemap_imp.h"  | 
29  |  |  | 
30  |  | U_NAMESPACE_BEGIN  | 
31  |  |  | 
32  |  | UnicodeString &  | 
33  | 0  | UnicodeString::toTitle(BreakIterator *iter) { | 
34  | 0  |     return toTitle(iter, Locale::getDefault(), 0);  | 
35  | 0  | }  | 
36  |  |  | 
37  |  | UnicodeString &  | 
38  | 0  | UnicodeString::toTitle(BreakIterator *iter, const Locale &locale) { | 
39  | 0  |     return toTitle(iter, locale, 0);  | 
40  | 0  | }  | 
41  |  |  | 
42  |  | UnicodeString &  | 
43  | 0  | UnicodeString::toTitle(BreakIterator *iter, const Locale &locale, uint32_t options) { | 
44  | 0  |     LocalPointer<BreakIterator> ownedIter;  | 
45  | 0  |     UErrorCode errorCode = U_ZERO_ERROR;  | 
46  | 0  |     iter = ustrcase_getTitleBreakIterator(&locale, "", options, iter, ownedIter, errorCode);  | 
47  | 0  |     if (iter == nullptr) { | 
48  | 0  |         setToBogus();  | 
49  | 0  |         return *this;  | 
50  | 0  |     }  | 
51  | 0  |     caseMap(ustrcase_getCaseLocale(locale.getBaseName()), options, iter, ustrcase_internalToTitle);  | 
52  | 0  |     return *this;  | 
53  | 0  | }  | 
54  |  |  | 
55  |  | U_NAMESPACE_END  | 
56  |  |  | 
57  |  | #endif  // !UCONFIG_NO_BREAK_ITERATION  |