Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Unified Diff: icu51/source/common/unistr_case_locale.cpp

Issue 20882002: Check in the pristine copy of ICU 51.2 (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « icu51/source/common/unistr_case.cpp ('k') | icu51/source/common/unistr_cnv.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: icu51/source/common/unistr_case_locale.cpp
===================================================================
--- icu51/source/common/unistr_case_locale.cpp (revision 0)
+++ icu51/source/common/unistr_case_locale.cpp (revision 0)
@@ -0,0 +1,70 @@
+/*
+*******************************************************************************
+* Copyright (C) 2011, International Business Machines
+* Corporation and others. All Rights Reserved.
+*******************************************************************************
+* file name: unistr_case_locale.cpp
+* encoding: US-ASCII
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2011may31
+* created by: Markus W. Scherer
+*
+* Locale-sensitive case mapping functions (ones that call uloc_getDefault())
+* were moved here to break dependency cycles among parts of the common library.
+*/
+
+#include "unicode/utypes.h"
+#include "unicode/locid.h"
+#include "unicode/unistr.h"
+#include "cmemory.h"
+#include "ustr_imp.h"
+
+U_NAMESPACE_BEGIN
+
+//========================================
+// Write implementation
+//========================================
+
+/*
+ * Set parameters on an empty UCaseMap, for UCaseMap-less API functions.
+ * Do this fast because it is called with every function call.
+ */
+static inline void
+setTempCaseMap(UCaseMap *csm, const char *locale) {
+ if(csm->csp==NULL) {
+ csm->csp=ucase_getSingleton();
+ }
+ if(locale!=NULL && locale[0]==0) {
+ csm->locale[0]=0;
+ } else {
+ ustrcase_setTempCaseMapLocale(csm, locale);
+ }
+}
+
+UnicodeString &
+UnicodeString::toLower() {
+ return toLower(Locale::getDefault());
+}
+
+UnicodeString &
+UnicodeString::toLower(const Locale &locale) {
+ UCaseMap csm=UCASEMAP_INITIALIZER;
+ setTempCaseMap(&csm, locale.getName());
+ return caseMap(&csm, ustrcase_internalToLower);
+}
+
+UnicodeString &
+UnicodeString::toUpper() {
+ return toUpper(Locale::getDefault());
+}
+
+UnicodeString &
+UnicodeString::toUpper(const Locale &locale) {
+ UCaseMap csm=UCASEMAP_INITIALIZER;
+ setTempCaseMap(&csm, locale.getName());
+ return caseMap(&csm, ustrcase_internalToUpper);
+}
+
+U_NAMESPACE_END
Property changes on: icu51/source/common/unistr_case_locale.cpp
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « icu51/source/common/unistr_case.cpp ('k') | icu51/source/common/unistr_cnv.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698