Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ui / app_list / search / tokenized_string.h
blob1af03f6202fec4956348e7ad59b084423f9a24a8
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_APP_LIST_SEARCH_TOKENIZED_STRING_H_
6 #define UI_APP_LIST_SEARCH_TOKENIZED_STRING_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "base/strings/string16.h"
12 #include "ui/app_list/app_list_export.h"
13 #include "ui/gfx/range/range.h"
15 namespace app_list {
17 // TokenizedString takes a string and breaks it down into token words. It
18 // first breaks using BreakIterator to get all the words. Then it breaks
19 // the words again at camel case boundaries and alpha/number boundaries.
20 class APP_LIST_EXPORT TokenizedString {
21 public:
22 typedef std::vector<base::string16> Tokens;
23 typedef std::vector<gfx::Range> Mappings;
25 explicit TokenizedString(const base::string16& text);
26 ~TokenizedString();
28 const base::string16& text() const { return text_; }
29 const Tokens& tokens() const { return tokens_; }
30 const Mappings& mappings() const { return mappings_; }
32 private:
33 void Tokenize();
35 // Input text.
36 const base::string16 text_;
38 // Broken down tokens and the index mapping of tokens in original string.
39 Tokens tokens_;
40 Mappings mappings_;
42 DISALLOW_COPY_AND_ASSIGN(TokenizedString);
45 } // namespace app_list
47 #endif // UI_APP_LIST_SEARCH_TOKENIZED_STRING_H_