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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 : m_collator(0) | 55 : m_collator(0) |
56 , m_locale(locale ? strdup(locale) : 0) | 56 , m_locale(locale ? strdup(locale) : 0) |
57 , m_lowerFirst(false) | 57 , m_lowerFirst(false) |
58 { | 58 { |
59 } | 59 } |
60 | 60 |
61 PassOwnPtr<Collator> Collator::userDefault() | 61 PassOwnPtr<Collator> Collator::userDefault() |
62 { | 62 { |
63 #if OS(DARWIN) && USE(CF) | 63 #if OS(DARWIN) && USE(CF) |
64 // Mac OS X doesn't set UNIX locale to match user-selected one, so ICU defau
lt doesn't work. | 64 // Mac OS X doesn't set UNIX locale to match user-selected one, so ICU defau
lt doesn't work. |
65 #if !OS(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 | 65 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 |
66 RetainPtr<CFLocaleRef> currentLocale(AdoptCF, CFLocaleCopyCurrent()); | 66 RetainPtr<CFLocaleRef> currentLocale(AdoptCF, CFLocaleCopyCurrent()); |
67 CFStringRef collationOrder = (CFStringRef)CFLocaleGetValue(currentLocale.get
(), kCFLocaleCollatorIdentifier); | 67 CFStringRef collationOrder = (CFStringRef)CFLocaleGetValue(currentLocale.get
(), kCFLocaleCollatorIdentifier); |
68 #else | 68 #else |
69 RetainPtr<CFStringRef> collationOrderRetainer(AdoptCF, (CFStringRef)CFPrefer
encesCopyValue(CFSTR("AppleCollationOrder"), kCFPreferencesAnyApplication, kCFPr
eferencesCurrentUser, kCFPreferencesAnyHost)); | 69 RetainPtr<CFStringRef> collationOrderRetainer(AdoptCF, (CFStringRef)CFPrefer
encesCopyValue(CFSTR("AppleCollationOrder"), kCFPreferencesAnyApplication, kCFPr
eferencesCurrentUser, kCFPreferencesAnyHost)); |
70 CFStringRef collationOrder = collationOrderRetainer.get(); | 70 CFStringRef collationOrder = collationOrderRetainer.get(); |
71 #endif | 71 #endif |
72 char buf[256]; | 72 char buf[256]; |
73 if (!collationOrder) | 73 if (!collationOrder) |
74 return adoptPtr(new Collator("")); | 74 return adoptPtr(new Collator("")); |
75 CFStringGetCString(collationOrder, buf, sizeof(buf), kCFStringEncodingASCII)
; | 75 CFStringGetCString(collationOrder, buf, sizeof(buf), kCFStringEncodingASCII)
; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 if (cachedCollator) | 144 if (cachedCollator) |
145 ucol_close(cachedCollator); | 145 ucol_close(cachedCollator); |
146 cachedCollator = m_collator; | 146 cachedCollator = m_collator; |
147 m_collator = 0; | 147 m_collator = 0; |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 } // namespace WTF | 151 } // namespace WTF |
152 | 152 |
153 #endif // !UCONFIG_NO_COLLATION | 153 #endif // !UCONFIG_NO_COLLATION |
OLD | NEW |