| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef LocaleICU_h | 31 #ifndef LocaleICU_h |
| 32 #define LocaleICU_h | 32 #define LocaleICU_h |
| 33 | 33 |
| 34 #include <unicode/udat.h> |
| 35 #include <unicode/unum.h> |
| 34 #include "platform/DateComponents.h" | 36 #include "platform/DateComponents.h" |
| 35 #include "platform/text/PlatformLocale.h" | 37 #include "platform/text/PlatformLocale.h" |
| 36 #include "wtf/Forward.h" | 38 #include "wtf/Forward.h" |
| 39 #include "wtf/OwnPtr.h" |
| 37 #include "wtf/text/CString.h" | 40 #include "wtf/text/CString.h" |
| 38 #include "wtf/text/WTFString.h" | 41 #include "wtf/text/WTFString.h" |
| 39 #include <memory> | |
| 40 #include <unicode/udat.h> | |
| 41 #include <unicode/unum.h> | |
| 42 | 42 |
| 43 namespace blink { | 43 namespace blink { |
| 44 | 44 |
| 45 // We should use this class only for LocalizedNumberICU.cpp, LocalizedDateICU.cp
p, | 45 // We should use this class only for LocalizedNumberICU.cpp, LocalizedDateICU.cp
p, |
| 46 // and LocalizedNumberICUTest.cpp. | 46 // and LocalizedNumberICUTest.cpp. |
| 47 class PLATFORM_EXPORT LocaleICU : public Locale { | 47 class PLATFORM_EXPORT LocaleICU : public Locale { |
| 48 public: | 48 public: |
| 49 static std::unique_ptr<LocaleICU> create(const char* localeString); | 49 static PassOwnPtr<LocaleICU> create(const char* localeString); |
| 50 ~LocaleICU() override; | 50 ~LocaleICU() override; |
| 51 | 51 |
| 52 const Vector<String>& weekDayShortLabels() override; | 52 const Vector<String>& weekDayShortLabels() override; |
| 53 unsigned firstDayOfWeek() override; | 53 unsigned firstDayOfWeek() override; |
| 54 bool isRTL() override; | 54 bool isRTL() override; |
| 55 String dateFormat() override; | 55 String dateFormat() override; |
| 56 String monthFormat() override; | 56 String monthFormat() override; |
| 57 String shortMonthFormat() override; | 57 String shortMonthFormat() override; |
| 58 String timeFormat() override; | 58 String timeFormat() override; |
| 59 String shortTimeFormat() override; | 59 String shortTimeFormat() override; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 73 | 73 |
| 74 bool detectSignAndGetDigitRange(const String& input, bool& isNegative, unsig
ned& startIndex, unsigned& endIndex); | 74 bool detectSignAndGetDigitRange(const String& input, bool& isNegative, unsig
ned& startIndex, unsigned& endIndex); |
| 75 unsigned matchedDecimalSymbolIndex(const String& input, unsigned& position); | 75 unsigned matchedDecimalSymbolIndex(const String& input, unsigned& position); |
| 76 | 76 |
| 77 bool initializeShortDateFormat(); | 77 bool initializeShortDateFormat(); |
| 78 UDateFormat* openDateFormat(UDateFormatStyle timeStyle, UDateFormatStyle dat
eStyle) const; | 78 UDateFormat* openDateFormat(UDateFormatStyle timeStyle, UDateFormatStyle dat
eStyle) const; |
| 79 UDateFormat* openDateFormatForStandAloneMonthLabels(bool isShort) const; | 79 UDateFormat* openDateFormatForStandAloneMonthLabels(bool isShort) const; |
| 80 | 80 |
| 81 void initializeCalendar(); | 81 void initializeCalendar(); |
| 82 | 82 |
| 83 std::unique_ptr<Vector<String>> createLabelVector(const UDateFormat*, UDateF
ormatSymbolType, int32_t startIndex, int32_t size); | 83 PassOwnPtr<Vector<String>> createLabelVector(const UDateFormat*, UDateFormat
SymbolType, int32_t startIndex, int32_t size); |
| 84 void initializeDateTimeFormat(); | 84 void initializeDateTimeFormat(); |
| 85 | 85 |
| 86 CString m_locale; | 86 CString m_locale; |
| 87 UNumberFormat* m_numberFormat; | 87 UNumberFormat* m_numberFormat; |
| 88 UDateFormat* m_shortDateFormat; | 88 UDateFormat* m_shortDateFormat; |
| 89 bool m_didCreateDecimalFormat; | 89 bool m_didCreateDecimalFormat; |
| 90 bool m_didCreateShortDateFormat; | 90 bool m_didCreateShortDateFormat; |
| 91 | 91 |
| 92 std::unique_ptr<Vector<String>> m_weekDayShortLabels; | 92 OwnPtr<Vector<String>> m_weekDayShortLabels; |
| 93 unsigned m_firstDayOfWeek; | 93 unsigned m_firstDayOfWeek; |
| 94 std::unique_ptr<Vector<String>> m_monthLabels; | 94 OwnPtr<Vector<String>> m_monthLabels; |
| 95 String m_dateFormat; | 95 String m_dateFormat; |
| 96 String m_monthFormat; | 96 String m_monthFormat; |
| 97 String m_shortMonthFormat; | 97 String m_shortMonthFormat; |
| 98 String m_timeFormatWithSeconds; | 98 String m_timeFormatWithSeconds; |
| 99 String m_timeFormatWithoutSeconds; | 99 String m_timeFormatWithoutSeconds; |
| 100 String m_dateTimeFormatWithSeconds; | 100 String m_dateTimeFormatWithSeconds; |
| 101 String m_dateTimeFormatWithoutSeconds; | 101 String m_dateTimeFormatWithoutSeconds; |
| 102 UDateFormat* m_mediumTimeFormat; | 102 UDateFormat* m_mediumTimeFormat; |
| 103 UDateFormat* m_shortTimeFormat; | 103 UDateFormat* m_shortTimeFormat; |
| 104 Vector<String> m_shortMonthLabels; | 104 Vector<String> m_shortMonthLabels; |
| 105 Vector<String> m_standAloneMonthLabels; | 105 Vector<String> m_standAloneMonthLabels; |
| 106 Vector<String> m_shortStandAloneMonthLabels; | 106 Vector<String> m_shortStandAloneMonthLabels; |
| 107 Vector<String> m_timeAMPMLabels; | 107 Vector<String> m_timeAMPMLabels; |
| 108 bool m_didCreateTimeFormat; | 108 bool m_didCreateTimeFormat; |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 } // namespace blink | 111 } // namespace blink |
| 112 #endif | 112 #endif |
| OLD | NEW |