| 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 14 matching lines...) Expand all Loading... |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #ifndef WTF_Collator_h | 29 #ifndef WTF_Collator_h |
| 30 #define WTF_Collator_h | 30 #define WTF_Collator_h |
| 31 | 31 |
| 32 #include "wtf/FastAllocBase.h" | 32 #include "wtf/FastAllocBase.h" |
| 33 #include "wtf/Noncopyable.h" | 33 #include "wtf/Noncopyable.h" |
| 34 #include "wtf/PassOwnPtr.h" | 34 #include "wtf/PassOwnPtr.h" |
| 35 #include "wtf/WTFExport.h" |
| 35 #include "wtf/unicode/Unicode.h" | 36 #include "wtf/unicode/Unicode.h" |
| 36 | 37 |
| 37 #if !UCONFIG_NO_COLLATION | 38 #if !UCONFIG_NO_COLLATION |
| 38 struct UCollator; | 39 struct UCollator; |
| 39 #endif | 40 #endif |
| 40 | 41 |
| 41 namespace WTF { | 42 namespace WTF { |
| 42 | 43 |
| 43 class Collator { | 44 class WTF_EXPORT Collator { |
| 44 WTF_MAKE_NONCOPYABLE(Collator); WTF_MAKE_FAST_ALLOCATED; | 45 WTF_MAKE_NONCOPYABLE(Collator); WTF_MAKE_FAST_ALLOCATED; |
| 45 public: | 46 public: |
| 46 enum Result { Equal = 0, Greater = 1, Less = -1 }; | 47 enum Result { Equal = 0, Greater = 1, Less = -1 }; |
| 47 | 48 |
| 48 Collator(const char* locale); // Parsing is lenient; e.g. language ident
ifiers (such as "en-US") are accepted, too. | 49 Collator(const char* locale); // Parsing is lenient; e.g. language ident
ifiers (such as "en-US") are accepted, too. |
| 49 ~Collator(); | 50 ~Collator(); |
| 50 void setOrderLowerFirst(bool); | 51 void setOrderLowerFirst(bool); |
| 51 | 52 |
| 52 static PassOwnPtr<Collator> userDefault(); | 53 static PassOwnPtr<Collator> userDefault(); |
| 53 | 54 |
| 54 Result collate(const ::UChar*, size_t, const ::UChar*, size_t) const; | 55 Result collate(const ::UChar*, size_t, const ::UChar*, size_t) const; |
| 55 | 56 |
| 56 private: | 57 private: |
| 57 #if !UCONFIG_NO_COLLATION | 58 #if !UCONFIG_NO_COLLATION |
| 58 void createCollator() const; | 59 void createCollator() const; |
| 59 void releaseCollator(); | 60 void releaseCollator(); |
| 60 mutable UCollator* m_collator; | 61 mutable UCollator* m_collator; |
| 61 #endif | 62 #endif |
| 62 char* m_locale; | 63 char* m_locale; |
| 63 bool m_lowerFirst; | 64 bool m_lowerFirst; |
| 64 }; | 65 }; |
| 65 } | 66 } |
| 66 | 67 |
| 67 using WTF::Collator; | 68 using WTF::Collator; |
| 68 | 69 |
| 69 #endif | 70 #endif |
| OLD | NEW |