OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef APP_L10N_UTIL_COLLATOR_H_ | 5 #ifndef APP_L10N_UTIL_COLLATOR_H_ |
6 #define APP_L10N_UTIL_COLLATOR_H_ | 6 #define APP_L10N_UTIL_COLLATOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <functional> | 10 #include <functional> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "unicode/coll.h" | 15 #include "unicode/coll.h" |
16 | 16 |
17 namespace l10n_util { | 17 namespace l10n_util { |
18 | 18 |
19 // Compares the two strings using the specified collator. | 19 // Compares the two strings using the specified collator. |
20 UCollationResult CompareStringWithCollator(const icu::Collator* collator, | |
21 const std::wstring& lhs, | |
22 const std::wstring& rhs); | |
23 UCollationResult CompareString16WithCollator(const icu::Collator* collator, | 20 UCollationResult CompareString16WithCollator(const icu::Collator* collator, |
24 const string16& lhs, | 21 const string16& lhs, |
25 const string16& rhs); | 22 const string16& rhs); |
26 | 23 |
27 // Used by SortStringsUsingMethod. Invokes a method on the objects passed to | 24 // Used by SortStringsUsingMethod. Invokes a method on the objects passed to |
28 // operator (), comparing the string results using a collator. | 25 // operator (), comparing the string results using a collator. |
29 template <class T, class Method> | 26 template <class T, class Method> |
30 class StringMethodComparatorWithCollator | 27 class StringMethodComparatorWithCollator |
31 : public std::binary_function<const string16&, | 28 : public std::binary_function<const string16&, |
32 const string16&, | 29 const string16&, |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 void SortVectorWithStringKey(const std::string& locale, | 145 void SortVectorWithStringKey(const std::string& locale, |
149 std::vector<Element>* elements, | 146 std::vector<Element>* elements, |
150 bool needs_stable_sort) { | 147 bool needs_stable_sort) { |
151 SortVectorWithStringKey<Element>(locale, elements, 0, elements->size(), | 148 SortVectorWithStringKey<Element>(locale, elements, 0, elements->size(), |
152 needs_stable_sort); | 149 needs_stable_sort); |
153 } | 150 } |
154 | 151 |
155 } // namespace l10n_util | 152 } // namespace l10n_util |
156 | 153 |
157 #endif // APP_L10N_UTIL_COLLATOR_H_ | 154 #endif // APP_L10N_UTIL_COLLATOR_H_ |
OLD | NEW |