| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } | 48 } |
| 49 | 49 |
| 50 Collator::Collator(const char* locale) | 50 Collator::Collator(const char* locale) |
| 51 : m_collator(0), | 51 : m_collator(0), |
| 52 m_locale(locale ? strdup(locale) : 0), | 52 m_locale(locale ? strdup(locale) : 0), |
| 53 m_lowerFirst(false) { | 53 m_lowerFirst(false) { |
| 54 setEquivalentLocale(m_locale, m_equivalentLocale); | 54 setEquivalentLocale(m_locale, m_equivalentLocale); |
| 55 } | 55 } |
| 56 | 56 |
| 57 std::unique_ptr<Collator> Collator::userDefault() { | 57 std::unique_ptr<Collator> Collator::userDefault() { |
| 58 return wrapUnique(new Collator(0)); | 58 return WTF::wrapUnique(new Collator(0)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 Collator::~Collator() { | 61 Collator::~Collator() { |
| 62 releaseCollator(); | 62 releaseCollator(); |
| 63 free(m_locale); | 63 free(m_locale); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void Collator::setOrderLowerFirst(bool lowerFirst) { | 66 void Collator::setOrderLowerFirst(bool lowerFirst) { |
| 67 m_lowerFirst = lowerFirst; | 67 m_lowerFirst = lowerFirst; |
| 68 } | 68 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 void Collator::setEquivalentLocale(const char* locale, char* equivalentLocale) { | 132 void Collator::setEquivalentLocale(const char* locale, char* equivalentLocale) { |
| 133 UErrorCode status = U_ZERO_ERROR; | 133 UErrorCode status = U_ZERO_ERROR; |
| 134 UBool isAvailable; | 134 UBool isAvailable; |
| 135 ucol_getFunctionalEquivalent(equivalentLocale, ulocFullnameCapacity, | 135 ucol_getFunctionalEquivalent(equivalentLocale, ulocFullnameCapacity, |
| 136 "collation", locale, &isAvailable, &status); | 136 "collation", locale, &isAvailable, &status); |
| 137 if (U_FAILURE(status)) | 137 if (U_FAILURE(status)) |
| 138 strcpy(equivalentLocale, "root"); | 138 strcpy(equivalentLocale, "root"); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace WTF | 141 } // namespace WTF |
| OLD | NEW |