Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: ui/base/l10n/l10n_util_collator.h

Issue 7328011: Introduce ui.dll / libui.so for the component build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 UI_BASE_L10N_L10N_UTIL_COLLATOR_H_ 5 #ifndef UI_BASE_L10N_L10N_UTIL_COLLATOR_H_
6 #define UI_BASE_L10N_L10N_UTIL_COLLATOR_H_ 6 #define UI_BASE_L10N_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/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "ui/ui_api.h"
16 #include "unicode/coll.h" 17 #include "unicode/coll.h"
17 18
18 namespace l10n_util { 19 namespace l10n_util {
19 20
20 // Compares the two strings using the specified collator. 21 // Compares the two strings using the specified collator.
21 UCollationResult CompareString16WithCollator(const icu::Collator* collator, 22 UI_API UCollationResult CompareString16WithCollator(
22 const string16& lhs, 23 const icu::Collator* collator,
23 const string16& rhs); 24 const string16& lhs,
25 const string16& rhs);
24 26
25 // Used by SortStringsUsingMethod. Invokes a method on the objects passed to 27 // Used by SortStringsUsingMethod. Invokes a method on the objects passed to
26 // operator (), comparing the string results using a collator. 28 // operator (), comparing the string results using a collator.
27 template <class T, class Method> 29 template <class T, class Method>
28 class StringMethodComparatorWithCollator 30 class StringMethodComparatorWithCollator
29 : public std::binary_function<const string16&, 31 : public std::binary_function<const string16&,
30 const string16&, 32 const string16&,
31 bool> { 33 bool> {
32 public: 34 public:
33 StringMethodComparatorWithCollator(icu::Collator* collator, Method method) 35 StringMethodComparatorWithCollator(icu::Collator* collator, Method method)
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 105
104 return StringComparator<string16>(collator_)(lhs_string_key, 106 return StringComparator<string16>(collator_)(lhs_string_key,
105 rhs_string_key); 107 rhs_string_key);
106 } 108 }
107 109
108 private: 110 private:
109 icu::Collator* collator_; 111 icu::Collator* collator_;
110 }; 112 };
111 113
112 // Specialization of operator() method for string16 version. 114 // Specialization of operator() method for string16 version.
113 template <> 115 template <> UI_API
114 bool StringComparator<string16>::operator()(const string16& lhs, 116 bool StringComparator<string16>::operator()(const string16& lhs,
115 const string16& rhs); 117 const string16& rhs);
116 118
117 // In place sorting of |elements| of a vector according to the string key of 119 // In place sorting of |elements| of a vector according to the string key of
118 // each element in the vector by using collation rules for |locale|. 120 // each element in the vector by using collation rules for |locale|.
119 // |begin_index| points to the start position of elements in the vector which 121 // |begin_index| points to the start position of elements in the vector which
120 // want to be sorted. |end_index| points to the end position of elements in the 122 // want to be sorted. |end_index| points to the end position of elements in the
121 // vector which want to be sorted 123 // vector which want to be sorted
122 template <class Element> 124 template <class Element>
123 void SortVectorWithStringKey(const std::string& locale, 125 void SortVectorWithStringKey(const std::string& locale,
(...skipping 22 matching lines...) Expand all
146 void SortVectorWithStringKey(const std::string& locale, 148 void SortVectorWithStringKey(const std::string& locale,
147 std::vector<Element>* elements, 149 std::vector<Element>* elements,
148 bool needs_stable_sort) { 150 bool needs_stable_sort) {
149 SortVectorWithStringKey<Element>(locale, elements, 0, elements->size(), 151 SortVectorWithStringKey<Element>(locale, elements, 0, elements->size(),
150 needs_stable_sort); 152 needs_stable_sort);
151 } 153 }
152 154
153 } // namespace l10n_util 155 } // namespace l10n_util
154 156
155 #endif // UI_BASE_L10N_L10N_UTIL_COLLATOR_H_ 157 #endif // UI_BASE_L10N_L10N_UTIL_COLLATOR_H_
OLDNEW
« no previous file with comments | « ui/base/l10n/l10n_util.h ('k') | ui/base/l10n/l10n_util_win.h » ('j') | ui/ui.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698