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

Side by Side Diff: chrome/browser/spellchecker/word_trimmer.h

Issue 120983002: Update some uses of UTF conversions in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 CHROME_BROWSER_SPELLCHECKER_WORD_TRIMMER_H_ 5 #ifndef CHROME_BROWSER_SPELLCHECKER_WORD_TRIMMER_H_
6 #define CHROME_BROWSER_SPELLCHECKER_WORD_TRIMMER_H_ 6 #define CHROME_BROWSER_SPELLCHECKER_WORD_TRIMMER_H_
7 7
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 9
10 // Trims |text| to contain only the range from |start| to |end| and |keep| words 10 // Trims |text| to contain only the range from |start| to |end| and |keep| words
11 // on either side of the range. The |start| and |end| parameters are character 11 // on either side of the range. The |start| and |end| parameters are character
12 // indexes into |text|. The |keep| parameter is the number of words to keep on 12 // indexes into |text|. The |keep| parameter is the number of words to keep on
13 // either side of the |start|-|end| range. The function updates |start| in 13 // either side of the |start|-|end| range. The function updates |start| in
14 // accordance with the trimming. 14 // accordance with the trimming.
15 // 15 //
16 // Example: 16 // Example:
17 // 17 //
18 // size_t start = 14; 18 // size_t start = 14;
19 // size_t end = 23; 19 // size_t end = 23;
20 // base::string16 text = 20 // base::string16 text =
21 // ASCIIToUTF16("one two three four five six seven eight"); 21 // base::ASCIIToUTF16("one two three four five six seven eight");
22 // int keep = 2; 22 // int keep = 2;
23 // base::string16 trimmed = TrimWords(&start, end, text, keep); 23 // base::string16 trimmed = TrimWords(&start, end, text, keep);
24 // DCHECK(trimmed == ASCIIToUTF16("two three four five six seven")); 24 // DCHECK(trimmed == base::ASCIIToUTF16("two three four five six seven"));
25 // DCHECK(start == 10); 25 // DCHECK(start == 10);
26 // 26 //
27 base::string16 TrimWords(size_t* start, 27 base::string16 TrimWords(size_t* start,
28 size_t end, 28 size_t end,
29 const base::string16& text, 29 const base::string16& text,
30 size_t keep); 30 size_t keep);
31 31
32 #endif // CHROME_BROWSER_SPELLCHECKER_WORD_TRIMMER_H_ 32 #endif // CHROME_BROWSER_SPELLCHECKER_WORD_TRIMMER_H_
OLDNEW
« no previous file with comments | « chrome/browser/spellchecker/spelling_service_client_unittest.cc ('k') | chrome/browser/spellchecker/word_trimmer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698