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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 | 45 |
46 public: | 46 public: |
47 enum Result { Equal = 0, Greater = 1, Less = -1 }; | 47 enum Result { Equal = 0, Greater = 1, Less = -1 }; |
48 | 48 |
49 // From ICU's uloc.h (ULOC_FULLNAME_CAPACITY) | 49 // From ICU's uloc.h (ULOC_FULLNAME_CAPACITY) |
50 static const size_t ulocFullnameCapacity = 157; | 50 static const size_t ulocFullnameCapacity = 157; |
51 | 51 |
52 Collator( | 52 // Parsing is lenient; e.g. language identifiers (such as "en-US") are |
53 const char* | 53 // accepted, too. |
54 locale); // Parsing is lenient; e.g. language identifiers (such as "e n-US") are accepted, too. | 54 Collator(const char* locale); |
dcheng
2016/10/01 03:06:14
If we just add explicit here, will things still bu
Nico
2016/10/01 16:42:24
I don't know. I can try in a separate CL.
Nico
2016/10/01 16:54:51
here: https://codereview.chromium.org/2383163003
| |
55 | |
55 ~Collator(); | 56 ~Collator(); |
56 void setOrderLowerFirst(bool); | 57 void setOrderLowerFirst(bool); |
57 | 58 |
58 static std::unique_ptr<Collator> userDefault(); | 59 static std::unique_ptr<Collator> userDefault(); |
59 | 60 |
60 Result collate(const ::UChar*, size_t, const ::UChar*, size_t) const; | 61 Result collate(const ::UChar*, size_t, const ::UChar*, size_t) const; |
61 | 62 |
62 private: | 63 private: |
63 void createCollator() const; | 64 void createCollator() const; |
64 void releaseCollator(); | 65 void releaseCollator(); |
65 void setEquivalentLocale(const char*, char*); | 66 void setEquivalentLocale(const char*, char*); |
66 mutable UCollator* m_collator; | 67 mutable UCollator* m_collator; |
67 | 68 |
68 char* m_locale; | 69 char* m_locale; |
69 char m_equivalentLocale[ulocFullnameCapacity]; | 70 char m_equivalentLocale[ulocFullnameCapacity]; |
70 bool m_lowerFirst; | 71 bool m_lowerFirst; |
71 }; | 72 }; |
72 | 73 |
73 } // namespace WTF | 74 } // namespace WTF |
74 | 75 |
75 using WTF::Collator; | 76 using WTF::Collator; |
76 | 77 |
77 #endif | 78 #endif |
OLD | NEW |