Index: base/i18n/string_search.h |
diff --git a/base/i18n/string_search.h b/base/i18n/string_search.h |
index 9d18631039831acbb30850f3cdcd8393899b9501..138606f8c60c3fceaa1c70b2746e26e7f3a10b29 100644 |
--- a/base/i18n/string_search.h |
+++ b/base/i18n/string_search.h |
@@ -8,6 +8,8 @@ |
#include "base/i18n/base_i18n_export.h" |
#include "base/strings/string16.h" |
+struct UStringSearch; |
+ |
namespace base { |
namespace i18n { |
@@ -24,6 +26,27 @@ BASE_I18N_EXPORT |
size_t* match_index, |
size_t* match_length); |
+// This class is for speeding up multiple StringSearchIgnoringCaseAndAccents() |
+// with the same |find_this| argument. |find_this| is passed as the constructor |
+// argument, and precomputation for searching is done only at that timing. |
+class BASE_I18N_EXPORT FixedPatternStringSearchIgnoringCaseAndAccents { |
+ public: |
+ explicit FixedPatternStringSearchIgnoringCaseAndAccents( |
+ const string16& find_this); |
+ ~FixedPatternStringSearchIgnoringCaseAndAccents(); |
+ |
+ // Returns true if |in_this| contains |find_this|. If |match_index| or |
+ // |match_length| are non-NULL, they are assigned the start position and total |
+ // length of the match. |
+ bool Search(const string16& in_this, |
+ size_t* match_index, |
+ size_t* match_length); |
+ |
+ private: |
+ string16 find_this_; |
+ UStringSearch* search_; |
+}; |
+ |
} // namespace i18n |
} // namespace base |