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

Side by Side Diff: content/common/android/address_parser.cc

Issue 102593002: Convert string16 to base::string16 in content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "content/common/android/address_parser.h" 5 #include "content/common/android/address_parser.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "content/common/android/address_parser_internal.h" 9 #include "content/common/android/address_parser_internal.h"
10 10
(...skipping 30 matching lines...) Expand all
41 }; 41 };
42 42
43 } // anonymous namespace 43 } // anonymous namespace
44 44
45 namespace content { 45 namespace content {
46 46
47 namespace address_parser { 47 namespace address_parser {
48 48
49 using namespace internal; 49 using namespace internal;
50 50
51 bool FindAddress(const string16& text, string16* address) { 51 bool FindAddress(const base::string16& text, base::string16* address) {
52 size_t start, end; 52 size_t start, end;
53 if (FindAddress(text.begin(), text.end(), &start, &end)) { 53 if (FindAddress(text.begin(), text.end(), &start, &end)) {
54 address->assign(text.substr(start, end)); 54 address->assign(text.substr(start, end));
55 return true; 55 return true;
56 } 56 }
57 return false; 57 return false;
58 } 58 }
59 59
60 bool FindAddress(const string16::const_iterator& begin, 60 bool FindAddress(const base::string16::const_iterator& begin,
61 const string16::const_iterator& end, 61 const base::string16::const_iterator& end,
62 size_t* start_pos, 62 size_t* start_pos,
63 size_t* end_pos) { 63 size_t* end_pos) {
64 HouseNumberParser house_number_parser; 64 HouseNumberParser house_number_parser;
65 65
66 // Keep going through the input string until a potential house number is 66 // Keep going through the input string until a potential house number is
67 // detected. Start tokenizing the following words to find a valid 67 // detected. Start tokenizing the following words to find a valid
68 // street name within a word range. Then, find a state name followed 68 // street name within a word range. Then, find a state name followed
69 // by a valid zip code for that state. Also keep a look for any other 69 // by a valid zip code for that state. Also keep a look for any other
70 // possible house numbers to continue from in case of no match and for 70 // possible house numbers to continue from in case of no match and for
71 // state names not followed by a zip code (e.g. New York, NY 10000). 71 // state names not followed by a zip code (e.g. New York, NY 10000).
(...skipping 21 matching lines...) Expand all
93 for (; next_word <= kMaxAddressWords + 1; ++next_word) { 93 for (; next_word <= kMaxAddressWords + 1; ++next_word) {
94 94
95 // Extract a new word from the tokenizer. 95 // Extract a new word from the tokenizer.
96 if (next_word == words.size()) { 96 if (next_word == words.size()) {
97 do { 97 do {
98 if (!tokenizer.GetNext()) 98 if (!tokenizer.GetNext())
99 return false; 99 return false;
100 100
101 // Check the number of address lines. 101 // Check the number of address lines.
102 if (tokenizer.token_is_delim() && newline_delimiters.find( 102 if (tokenizer.token_is_delim() && newline_delimiters.find(
103 *tokenizer.token_begin()) != string16::npos) { 103 *tokenizer.token_begin()) != base::string16::npos) {
104 ++num_lines; 104 ++num_lines;
105 } 105 }
106 } while (tokenizer.token_is_delim()); 106 } while (tokenizer.token_is_delim());
107 107
108 if (num_lines > kMaxAddressLines) 108 if (num_lines > kMaxAddressLines)
109 break; 109 break;
110 110
111 words.push_back(Word(tokenizer.token_begin(), tokenizer.token_end())); 111 words.push_back(Word(tokenizer.token_begin(), tokenizer.token_end()));
112 } 112 }
113 113
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 it = words[next_word].end; 210 it = words[next_word].end;
211 } 211 }
212 } 212 }
213 213
214 return false; 214 return false;
215 } 215 }
216 216
217 } // namespace address_parser 217 } // namespace address_parser
218 218
219 } // namespace content 219 } // namespace content
OLDNEW
« no previous file with comments | « content/common/android/address_parser.h ('k') | content/common/android/address_parser_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698