diff options
Diffstat (limited to 'content/common/android')
-rw-r--r-- | content/common/android/address_parser.cc | 8 | ||||
-rw-r--r-- | content/common/android/address_parser.h | 6 | ||||
-rw-r--r-- | content/common/android/address_parser_internal.cc | 30 | ||||
-rw-r--r-- | content/common/android/address_parser_internal.h | 20 | ||||
-rw-r--r-- | content/common/android/address_parser_unittest.cc | 14 |
5 files changed, 39 insertions, 39 deletions
diff --git a/content/common/android/address_parser.cc b/content/common/android/address_parser.cc index f4587c8..15874fd3 100644 --- a/content/common/android/address_parser.cc +++ b/content/common/android/address_parser.cc @@ -48,7 +48,7 @@ namespace address_parser { using namespace internal; -bool FindAddress(const string16& text, string16* address) { +bool FindAddress(const base::string16& text, base::string16* address) { size_t start, end; if (FindAddress(text.begin(), text.end(), &start, &end)) { address->assign(text.substr(start, end)); @@ -57,8 +57,8 @@ bool FindAddress(const string16& text, string16* address) { return false; } -bool FindAddress(const string16::const_iterator& begin, - const string16::const_iterator& end, +bool FindAddress(const base::string16::const_iterator& begin, + const base::string16::const_iterator& end, size_t* start_pos, size_t* end_pos) { HouseNumberParser house_number_parser; @@ -100,7 +100,7 @@ bool FindAddress(const string16::const_iterator& begin, // Check the number of address lines. if (tokenizer.token_is_delim() && newline_delimiters.find( - *tokenizer.token_begin()) != string16::npos) { + *tokenizer.token_begin()) != base::string16::npos) { ++num_lines; } } while (tokenizer.token_is_delim()); diff --git a/content/common/android/address_parser.h b/content/common/android/address_parser.h index 71a3aba..1a12a32 100644 --- a/content/common/android/address_parser.h +++ b/content/common/android/address_parser.h @@ -17,14 +17,14 @@ namespace address_parser { // Find the first address in some chunk of text. If an address is found in // |text| true is returned and the address is copied into |address|. // Otherwise, false is returned. -bool FindAddress(const string16& text, string16* address); +bool FindAddress(const base::string16& text, base::string16* address); // Find the first address in some chunk of test. |begin| is the starting // position to search from, |end| is the position to search to. |start_pos| // and |end_pos| are set to the starting and ending position of the address, // if found. -CONTENT_EXPORT bool FindAddress(const string16::const_iterator& begin, - const string16::const_iterator& end, +CONTENT_EXPORT bool FindAddress(const base::string16::const_iterator& begin, + const base::string16::const_iterator& end, size_t* start_pos, size_t* end_pos); diff --git a/content/common/android/address_parser_internal.cc b/content/common/android/address_parser_internal.cc index 0970b17..fe14d3b 100644 --- a/content/common/android/address_parser_internal.cc +++ b/content/common/android/address_parser_internal.cc @@ -20,23 +20,23 @@ const size_t kZipPlus4Digits = 9; // Maximum number of digits of a house number, including possible hyphens. const size_t kMaxHouseDigits = 5; -char16 SafePreviousChar(const string16::const_iterator& it, - const string16::const_iterator& begin) { +char16 SafePreviousChar(const base::string16::const_iterator& it, + const base::string16::const_iterator& begin) { if (it == begin) return ' '; return *(it - 1); } -char16 SafeNextChar(const string16::const_iterator& it, - const string16::const_iterator& end) { +char16 SafeNextChar(const base::string16::const_iterator& it, + const base::string16::const_iterator& end) { if (it == end) return ' '; return *(it + 1); } -bool WordLowerCaseEqualsASCII(string16::const_iterator word_begin, - string16::const_iterator word_end, const char* ascii_to_match) { - for (string16::const_iterator it = word_begin; it != word_end; +bool WordLowerCaseEqualsASCII(base::string16::const_iterator word_begin, + base::string16::const_iterator word_end, const char* ascii_to_match) { + for (base::string16::const_iterator it = word_begin; it != word_end; ++it, ++ascii_to_match) { if (!*ascii_to_match || base::ToLowerASCII(*it) != *ascii_to_match) return false; @@ -44,10 +44,10 @@ bool WordLowerCaseEqualsASCII(string16::const_iterator word_begin, return *ascii_to_match == 0 || *ascii_to_match == ' '; } -bool LowerCaseEqualsASCIIWithPlural(string16::const_iterator word_begin, - string16::const_iterator word_end, const char* ascii_to_match, +bool LowerCaseEqualsASCIIWithPlural(base::string16::const_iterator word_begin, + base::string16::const_iterator word_end, const char* ascii_to_match, bool allow_plural) { - for (string16::const_iterator it = word_begin; it != word_end; + for (base::string16::const_iterator it = word_begin; it != word_end; ++it, ++ascii_to_match) { if (!*ascii_to_match && allow_plural && *it == 's' && it + 1 == word_end) return true; @@ -66,8 +66,8 @@ namespace address_parser { namespace internal { -Word::Word(const string16::const_iterator& begin, - const string16::const_iterator& end) +Word::Word(const base::string16::const_iterator& begin, + const base::string16::const_iterator& end) : begin(begin), end(end) { DCHECK(begin <= end); @@ -115,8 +115,8 @@ bool HouseNumberParser::CheckFinished(Word* word) const { } bool HouseNumberParser::Parse( - const string16::const_iterator& begin, - const string16::const_iterator& end, Word* word) { + const base::string16::const_iterator& begin, + const base::string16::const_iterator& end, Word* word) { it_ = begin_ = begin; end_ = end; ResetState(); @@ -417,7 +417,7 @@ bool IsZipValid(const Word& word, size_t state_index) { if (length != kZipDigits && length != kZipPlus4Digits + 1) return false; - for (string16::const_iterator it = word.begin; it != word.end; ++it) { + for (base::string16::const_iterator it = word.begin; it != word.end; ++it) { size_t pos = it - word.begin; if (IsAsciiDigit(*it) || (*it == '-' && pos == kZipDigits)) continue; diff --git a/content/common/android/address_parser_internal.h b/content/common/android/address_parser_internal.h index f236afc..74af6c3 100644 --- a/content/common/android/address_parser_internal.h +++ b/content/common/android/address_parser_internal.h @@ -19,12 +19,12 @@ namespace internal { // Exposed for tests. struct CONTENT_EXPORT Word { - string16::const_iterator begin; - string16::const_iterator end; + base::string16::const_iterator begin; + base::string16::const_iterator end; Word() {} - Word(const string16::const_iterator& begin, - const string16::const_iterator& end); + Word(const base::string16::const_iterator& begin, + const base::string16::const_iterator& end); }; // Exposed for tests. @@ -32,8 +32,8 @@ class CONTENT_EXPORT HouseNumberParser { public: HouseNumberParser() {} - bool Parse(const string16::const_iterator& begin, - const string16::const_iterator& end, + bool Parse(const base::string16::const_iterator& begin, + const base::string16::const_iterator& end, Word* word); private: @@ -48,9 +48,9 @@ class CONTENT_EXPORT HouseNumberParser { // Iterators to the beginning, current position and ending of the string // being currently parsed. - string16::const_iterator begin_; - string16::const_iterator it_; - string16::const_iterator end_; + base::string16::const_iterator begin_; + base::string16::const_iterator it_; + base::string16::const_iterator end_; // Number of digits found in the current result candidate. size_t num_digits_; @@ -63,7 +63,7 @@ class CONTENT_EXPORT HouseNumberParser { }; typedef std::vector<Word> WordList; -typedef base::StringTokenizerT<string16, string16::const_iterator> +typedef base::StringTokenizerT<base::string16, base::string16::const_iterator> String16Tokenizer; // These are exposed for tests. diff --git a/content/common/android/address_parser_unittest.cc b/content/common/android/address_parser_unittest.cc index 30497b2..1a8d17e 100644 --- a/content/common/android/address_parser_unittest.cc +++ b/content/common/android/address_parser_unittest.cc @@ -25,13 +25,13 @@ class AddressParserTest : public testing::Test { } std::string GetHouseNumber(const std::string& content) const { - string16 content_16 = UTF8ToUTF16(content); - string16 result; + base::string16 content_16 = UTF8ToUTF16(content); + base::string16 result; HouseNumberParser parser; Word word; if (parser.Parse(content_16.begin(), content_16.end(), &word)) - result = string16(word.begin, word.end); + result = base::string16(word.begin, word.end); return UTF16ToUTF8(result); } @@ -62,7 +62,7 @@ class AddressParserTest : public testing::Test { size_t state_index; EXPECT_TRUE(GetState(state, &state_index)); - string16 zip_16 = UTF8ToUTF16(zip); + base::string16 zip_16 = UTF8ToUTF16(zip); WordList words; TokenizeWords(zip_16, &words); EXPECT_TRUE(words.size() == 1); @@ -70,7 +70,7 @@ class AddressParserTest : public testing::Test { } bool IsLocationName(const std::string& street) const { - string16 street_16 = UTF8ToUTF16(street); + base::string16 street_16 = UTF8ToUTF16(street); WordList words; TokenizeWords(street_16, &words); EXPECT_TRUE(words.size() == 1); @@ -78,8 +78,8 @@ class AddressParserTest : public testing::Test { } std::string FindAddress(const std::string& content) const { - string16 content_16 = UTF8ToUTF16(content); - string16 result_16; + base::string16 content_16 = UTF8ToUTF16(content); + base::string16 result_16; size_t start, end; if (::FindAddress(content_16.begin(), content_16.end(), &start, &end)) result_16 = content_16.substr(start, end - start); |