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_
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"
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
{
22 typedef std::vector
<base::string16
> Tokens
;
23 typedef std::vector
<gfx::Range
> Mappings
;
25 explicit TokenizedString(const base::string16
& text
);
28 const base::string16
& text() const { return text_
; }
29 const Tokens
& tokens() const { return tokens_
; }
30 const Mappings
& mappings() const { return mappings_
; }
36 const base::string16 text_
;
38 // Broken down tokens and the index mapping of tokens in original string.
42 DISALLOW_COPY_AND_ASSIGN(TokenizedString
);
45 } // namespace app_list
47 #endif // UI_APP_LIST_SEARCH_TOKENIZED_STRING_H_