unistr_case_locale.cpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. #include "unicode/utypes.h"
  20. #include "unicode/locid.h"
  21. #include "unicode/ucasemap.h"
  22. #include "unicode/unistr.h"
  23. #include "ucasemap_imp.h"
  24. U_NAMESPACE_BEGIN
  25. //========================================
  26. // Write implementation
  27. //========================================
  28. UnicodeString &
  29. UnicodeString::toLower() {
  30. return caseMap(ustrcase_getCaseLocale(nullptr), 0,
  31. UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalToLower);
  32. }
  33. UnicodeString &
  34. UnicodeString::toLower(const Locale &locale) {
  35. return caseMap(ustrcase_getCaseLocale(locale.getBaseName()), 0,
  36. UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalToLower);
  37. }
  38. UnicodeString &
  39. UnicodeString::toUpper() {
  40. return caseMap(ustrcase_getCaseLocale(nullptr), 0,
  41. UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalToUpper);
  42. }
  43. UnicodeString &
  44. UnicodeString::toUpper(const Locale &locale) {
  45. return caseMap(ustrcase_getCaseLocale(locale.getBaseName()), 0,
  46. UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalToUpper);
  47. }
  48. U_NAMESPACE_END