| 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 22 matching lines...) Expand all Loading... |
| 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/WTFExport.h" |
| 36 #include "wtf/text/Unicode.h" | 36 #include "wtf/text/Unicode.h" |
| 37 | 37 |
| 38 struct UCollator; | 38 struct UCollator; |
| 39 | 39 |
| 40 namespace WTF { | 40 namespace WTF { |
| 41 | 41 |
| 42 class WTF_EXPORT Collator { | 42 class WTF_EXPORT Collator { |
| 43 WTF_MAKE_NONCOPYABLE(Collator); | 43 WTF_MAKE_NONCOPYABLE(Collator); |
| 44 USING_FAST_MALLOC(Collator); | 44 USING_FAST_MALLOC(Collator); |
| 45 public: | |
| 46 enum Result { Equal = 0, Greater = 1, Less = -1 }; | |
| 47 | 45 |
| 48 // From ICU's uloc.h (ULOC_FULLNAME_CAPACITY) | 46 public: |
| 49 static const size_t ulocFullnameCapacity = 157; | 47 enum Result { Equal = 0, Greater = 1, Less = -1 }; |
| 50 | 48 |
| 51 Collator(const char* locale); // Parsing is lenient; e.g. language identifie
rs (such as "en-US") are accepted, too. | 49 // From ICU's uloc.h (ULOC_FULLNAME_CAPACITY) |
| 52 ~Collator(); | 50 static const size_t ulocFullnameCapacity = 157; |
| 53 void setOrderLowerFirst(bool); | |
| 54 | 51 |
| 55 static PassOwnPtr<Collator> userDefault(); | 52 Collator( |
| 53 const char* |
| 54 locale); // Parsing is lenient; e.g. language identifiers (such as "e
n-US") are accepted, too. |
| 55 ~Collator(); |
| 56 void setOrderLowerFirst(bool); |
| 56 | 57 |
| 57 Result collate(const ::UChar*, size_t, const ::UChar*, size_t) const; | 58 static PassOwnPtr<Collator> userDefault(); |
| 58 | 59 |
| 59 private: | 60 Result collate(const ::UChar*, size_t, const ::UChar*, size_t) const; |
| 60 void createCollator() const; | |
| 61 void releaseCollator(); | |
| 62 void setEquivalentLocale(const char*, char*); | |
| 63 mutable UCollator* m_collator; | |
| 64 | 61 |
| 65 char* m_locale; | 62 private: |
| 66 char m_equivalentLocale[ulocFullnameCapacity]; | 63 void createCollator() const; |
| 67 bool m_lowerFirst; | 64 void releaseCollator(); |
| 65 void setEquivalentLocale(const char*, char*); |
| 66 mutable UCollator* m_collator; |
| 67 |
| 68 char* m_locale; |
| 69 char m_equivalentLocale[ulocFullnameCapacity]; |
| 70 bool m_lowerFirst; |
| 68 }; | 71 }; |
| 69 | |
| 70 } | 72 } |
| 71 | 73 |
| 72 using WTF::Collator; | 74 using WTF::Collator; |
| 73 | 75 |
| 74 #endif | 76 #endif |
| OLD | NEW |