From: David Yonge-Mallo Date: Fri, 16 Jan 2015 11:05:56 +0000 (+0100) Subject: Fully quality std::* names. X-Git-Tag: upstream/7.0.6~58 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Flibphonenumber.git;a=commitdiff_plain;h=4c53c080b631c138cda02bddfe83d46d30c7e510 Fully quality std::* names. --- diff --git a/cpp/src/phonenumbers/default_logger.cc b/cpp/src/phonenumbers/default_logger.cc index c54b640..fd68024 100644 --- a/cpp/src/phonenumbers/default_logger.cc +++ b/cpp/src/phonenumbers/default_logger.cc @@ -21,11 +21,10 @@ namespace i18n { namespace phonenumbers { -using std::cout; using std::string; void StdoutLogger::WriteMessage(const string& msg) { - cout << " " << msg; + std::cout << " " << msg; } void StdoutLogger::WriteLevel() { @@ -34,24 +33,24 @@ void StdoutLogger::WriteLevel() { verbosity_level = LOG_FATAL; } - cout << "["; + std::cout << "["; // Handle verbose logs first. if (verbosity_level > LOG_DEBUG) { - cout << "VLOG" << (verbosity_level - LOG_DEBUG); + std::cout << "VLOG" << (verbosity_level - LOG_DEBUG); } else { switch (verbosity_level) { - case LOG_FATAL: cout << "FATAL"; break; + case LOG_FATAL: std::cout << "FATAL"; break; #ifdef ERROR // In case ERROR is defined by MSVC (i.e not set to LOG_ERROR). case ERROR: #endif - case LOG_ERROR: cout << "ERROR"; break; - case LOG_WARNING: cout << "WARNING"; break; - case LOG_INFO: cout << "INFO"; break; - case LOG_DEBUG: cout << "DEBUG"; break; + case LOG_ERROR: std::cout << "ERROR"; break; + case LOG_WARNING: std::cout << "WARNING"; break; + case LOG_INFO: std::cout << "INFO"; break; + case LOG_DEBUG: std::cout << "DEBUG"; break; } } - cout << "]"; + std::cout << "]"; } } // namespace phonenumbers diff --git a/cpp/src/phonenumbers/phonenumbermatcher.cc b/cpp/src/phonenumbers/phonenumbermatcher.cc index d36f6c2..f7d4368 100644 --- a/cpp/src/phonenumbers/phonenumbermatcher.cc +++ b/cpp/src/phonenumbers/phonenumbermatcher.cc @@ -55,7 +55,6 @@ #include "phonenumbers/regexp_adapter_re2.h" #endif // I18N_PHONENUMBERS_USE_RE2_AND_ICU -using std::make_pair; using std::map; using std::numeric_limits; using std::string; @@ -372,7 +371,7 @@ class AlternateFormats : public Singleton { it != format_data_.metadata().end(); ++it) { calling_code_to_alternate_formats_map_.insert( - make_pair(it->country_code(), &*it)); + std::make_pair(it->country_code(), &*it)); } } diff --git a/cpp/src/phonenumbers/phonenumberutil.cc b/cpp/src/phonenumbers/phonenumberutil.cc index e960891..9904145 100644 --- a/cpp/src/phonenumbers/phonenumberutil.cc +++ b/cpp/src/phonenumbers/phonenumberutil.cc @@ -52,9 +52,6 @@ namespace i18n { namespace phonenumbers { -using std::make_pair; -using std::sort; - using google::protobuf::RepeatedPtrField; // static constants @@ -289,70 +286,70 @@ void PhoneNumberUtil::SetLogger(Logger* logger) { class PhoneNumberRegExpsAndMappings { private: void InitializeMapsAndSets() { - diallable_char_mappings_.insert(make_pair('+', '+')); - diallable_char_mappings_.insert(make_pair('*', '*')); + diallable_char_mappings_.insert(std::make_pair('+', '+')); + diallable_char_mappings_.insert(std::make_pair('*', '*')); // Here we insert all punctuation symbols that we wish to respect when // formatting alpha numbers, as they show the intended number groupings. all_plus_number_grouping_symbols_.insert( - make_pair(ToUnicodeCodepoint("-"), '-')); + std::make_pair(ToUnicodeCodepoint("-"), '-')); all_plus_number_grouping_symbols_.insert( - make_pair(ToUnicodeCodepoint("\xEF\xBC\x8D" /* "-" */), '-')); + std::make_pair(ToUnicodeCodepoint("\xEF\xBC\x8D" /* "-" */), '-')); all_plus_number_grouping_symbols_.insert( - make_pair(ToUnicodeCodepoint("\xE2\x80\x90" /* "‐" */), '-')); + std::make_pair(ToUnicodeCodepoint("\xE2\x80\x90" /* "‐" */), '-')); all_plus_number_grouping_symbols_.insert( - make_pair(ToUnicodeCodepoint("\xE2\x80\x91" /* "‑" */), '-')); + std::make_pair(ToUnicodeCodepoint("\xE2\x80\x91" /* "‑" */), '-')); all_plus_number_grouping_symbols_.insert( - make_pair(ToUnicodeCodepoint("\xE2\x80\x92" /* "‒" */), '-')); + std::make_pair(ToUnicodeCodepoint("\xE2\x80\x92" /* "‒" */), '-')); all_plus_number_grouping_symbols_.insert( - make_pair(ToUnicodeCodepoint("\xE2\x80\x93" /* "–" */), '-')); + std::make_pair(ToUnicodeCodepoint("\xE2\x80\x93" /* "–" */), '-')); all_plus_number_grouping_symbols_.insert( - make_pair(ToUnicodeCodepoint("\xE2\x80\x94" /* "—" */), '-')); + std::make_pair(ToUnicodeCodepoint("\xE2\x80\x94" /* "—" */), '-')); all_plus_number_grouping_symbols_.insert( - make_pair(ToUnicodeCodepoint("\xE2\x80\x95" /* "―" */), '-')); + std::make_pair(ToUnicodeCodepoint("\xE2\x80\x95" /* "―" */), '-')); all_plus_number_grouping_symbols_.insert( - make_pair(ToUnicodeCodepoint("\xE2\x88\x92" /* "−" */), '-')); + std::make_pair(ToUnicodeCodepoint("\xE2\x88\x92" /* "−" */), '-')); all_plus_number_grouping_symbols_.insert( - make_pair(ToUnicodeCodepoint("/"), '/')); + std::make_pair(ToUnicodeCodepoint("/"), '/')); all_plus_number_grouping_symbols_.insert( - make_pair(ToUnicodeCodepoint("\xEF\xBC\x8F" /* "/" */), '/')); + std::make_pair(ToUnicodeCodepoint("\xEF\xBC\x8F" /* "/" */), '/')); all_plus_number_grouping_symbols_.insert( - make_pair(ToUnicodeCodepoint(" "), ' ')); + std::make_pair(ToUnicodeCodepoint(" "), ' ')); all_plus_number_grouping_symbols_.insert( - make_pair(ToUnicodeCodepoint("\xE3\x80\x80" /* " " */), ' ')); + std::make_pair(ToUnicodeCodepoint("\xE3\x80\x80" /* " " */), ' ')); all_plus_number_grouping_symbols_.insert( - make_pair(ToUnicodeCodepoint("\xE2\x81\xA0"), ' ')); + std::make_pair(ToUnicodeCodepoint("\xE2\x81\xA0"), ' ')); all_plus_number_grouping_symbols_.insert( - make_pair(ToUnicodeCodepoint("."), '.')); + std::make_pair(ToUnicodeCodepoint("."), '.')); all_plus_number_grouping_symbols_.insert( - make_pair(ToUnicodeCodepoint("\xEF\xBC\x8E" /* "." */), '.')); + std::make_pair(ToUnicodeCodepoint("\xEF\xBC\x8E" /* "." */), '.')); // Only the upper-case letters are added here - the lower-case versions are // added programmatically. - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("A"), '2')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("B"), '2')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("C"), '2')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("D"), '3')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("E"), '3')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("F"), '3')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("G"), '4')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("H"), '4')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("I"), '4')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("J"), '5')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("K"), '5')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("L"), '5')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("M"), '6')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("N"), '6')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("O"), '6')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("P"), '7')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("Q"), '7')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("R"), '7')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("S"), '7')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("T"), '8')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("U"), '8')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("V"), '8')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("W"), '9')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("X"), '9')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("Y"), '9')); - alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("Z"), '9')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("A"), '2')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("B"), '2')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("C"), '2')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("D"), '3')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("E"), '3')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("F"), '3')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("G"), '4')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("H"), '4')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("I"), '4')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("J"), '5')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("K"), '5')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("L"), '5')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("M"), '6')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("N"), '6')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("O"), '6')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("P"), '7')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("Q"), '7')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("R"), '7')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("S"), '7')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("T"), '8')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("U"), '8')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("V"), '8')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("W"), '9')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("X"), '9')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("Y"), '9')); + alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("Z"), '9')); map lower_case_mappings; map alpha_letters; for (map::const_iterator it = alpha_mappings_.begin(); @@ -362,12 +359,12 @@ class PhoneNumberRegExpsAndMappings { if (it->first < 128) { char letter_as_upper = static_cast(it->first); char32 letter_as_lower = static_cast(tolower(letter_as_upper)); - lower_case_mappings.insert(make_pair(letter_as_lower, it->second)); + lower_case_mappings.insert(std::make_pair(letter_as_lower, it->second)); // Add the letters in both variants to the alpha_letters map. This just // pairs each letter with its upper-case representation so that it can // be retained when normalising alpha numbers. - alpha_letters.insert(make_pair(letter_as_lower, letter_as_upper)); - alpha_letters.insert(make_pair(it->first, letter_as_upper)); + alpha_letters.insert(std::make_pair(letter_as_lower, letter_as_upper)); + alpha_letters.insert(std::make_pair(it->first, letter_as_upper)); } } // In the Java version we don't insert the lower-case mappings in the map, @@ -382,13 +379,13 @@ class PhoneNumberRegExpsAndMappings { alpha_letters.end()); // Add the ASCII digits so that they don't get deleted by NormalizeHelper(). for (char c = '0'; c <= '9'; ++c) { - diallable_char_mappings_.insert(make_pair(c, c)); - alpha_phone_mappings_.insert(make_pair(c, c)); - all_plus_number_grouping_symbols_.insert(make_pair(c, c)); + diallable_char_mappings_.insert(std::make_pair(c, c)); + alpha_phone_mappings_.insert(std::make_pair(c, c)); + all_plus_number_grouping_symbols_.insert(std::make_pair(c, c)); } - mobile_token_mappings_.insert(make_pair(52, '1')); - mobile_token_mappings_.insert(make_pair(54, '9')); + mobile_token_mappings_.insert(std::make_pair(52, '1')); + mobile_token_mappings_.insert(std::make_pair(54, '9')); } // Small string helpers since StrCat has a maximum number of arguments. These @@ -611,9 +608,9 @@ PhoneNumberUtil::PhoneNumberUtil() int country_calling_code = it->country_code(); if (kRegionCodeForNonGeoEntity == region_code) { country_code_to_non_geographical_metadata_map_->insert( - make_pair(country_calling_code, *it)); + std::make_pair(country_calling_code, *it)); } else { - region_to_metadata_map_->insert(make_pair(region_code, *it)); + region_to_metadata_map_->insert(std::make_pair(region_code, *it)); } map* >::iterator calling_code_in_map = country_calling_code_to_region_map.find(country_calling_code); @@ -628,7 +625,7 @@ PhoneNumberUtil::PhoneNumberUtil() list* list_with_region_code = new list(); list_with_region_code->push_back(region_code); country_calling_code_to_region_map.insert( - make_pair(country_calling_code, list_with_region_code)); + std::make_pair(country_calling_code, list_with_region_code)); } if (country_calling_code == kNanpaCountryCode) { nanpa_regions_->insert(region_code); @@ -640,9 +637,9 @@ PhoneNumberUtil::PhoneNumberUtil() country_calling_code_to_region_map.begin(), country_calling_code_to_region_map.end()); // Sort all the pairs in ascending order according to country calling code. - sort(country_calling_code_to_region_code_map_->begin(), - country_calling_code_to_region_code_map_->end(), - OrderByFirst()); + std::sort(country_calling_code_to_region_code_map_->begin(), + country_calling_code_to_region_code_map_->end(), + OrderByFirst()); } PhoneNumberUtil::~PhoneNumberUtil() { diff --git a/cpp/src/phonenumbers/regexp_cache.cc b/cpp/src/phonenumbers/regexp_cache.cc index 57a139a..d0365a2 100644 --- a/cpp/src/phonenumbers/regexp_cache.cc +++ b/cpp/src/phonenumbers/regexp_cache.cc @@ -23,7 +23,6 @@ #include "phonenumbers/base/synchronization/lock.h" #include "phonenumbers/regexp_adapter.h" -using std::make_pair; using std::string; namespace i18n { @@ -53,7 +52,7 @@ const RegExp& RegExpCache::GetRegExp(const string& pattern) { if (it != cache_impl_->end()) return *it->second; const RegExp* regexp = regexp_factory_.CreateRegExp(pattern); - cache_impl_->insert(make_pair(pattern, regexp)); + cache_impl_->insert(std::make_pair(pattern, regexp)); return *regexp; } diff --git a/cpp/src/phonenumbers/shortnumberinfo.cc b/cpp/src/phonenumbers/shortnumberinfo.cc index 8e7efa8..2bd73fc 100644 --- a/cpp/src/phonenumbers/shortnumberinfo.cc +++ b/cpp/src/phonenumbers/shortnumberinfo.cc @@ -32,7 +32,6 @@ namespace i18n { namespace phonenumbers { -using std::make_pair; using std::map; using std::string; @@ -59,7 +58,7 @@ ShortNumberInfo::ShortNumberInfo() it != metadata_collection.metadata().end(); ++it) { const string& region_code = it->id(); - region_to_short_metadata_map_->insert(make_pair(region_code, *it)); + region_to_short_metadata_map_->insert(std::make_pair(region_code, *it)); } regions_where_emergency_numbers_must_be_exact_->insert("BR"); regions_where_emergency_numbers_must_be_exact_->insert("CL"); diff --git a/cpp/test/phonenumbers/phonenumberutil_test.cc b/cpp/test/phonenumbers/phonenumberutil_test.cc index 13e97df..31fd893 100644 --- a/cpp/test/phonenumbers/phonenumberutil_test.cc +++ b/cpp/test/phonenumbers/phonenumberutil_test.cc @@ -39,9 +39,7 @@ namespace i18n { namespace phonenumbers { -using std::endl; using std::find; -using std::make_pair; using std::ostream; using google::protobuf::RepeatedPtrField; diff --git a/cpp/test/phonenumbers/test_util.cc b/cpp/test/phonenumbers/test_util.cc index e418218..48c07e3 100644 --- a/cpp/test/phonenumbers/test_util.cc +++ b/cpp/test/phonenumbers/test_util.cc @@ -20,42 +20,39 @@ #include "phonenumbers/phonenumber.pb.h" #include "phonenumbers/test_util.h" -using std::cout; -using std::endl; - namespace i18n { namespace phonenumbers { ostream& operator<<(ostream& os, const PhoneNumber& number) { - os << endl - << "country_code: " << number.country_code() << endl - << "national_number: " << number.national_number() << endl; + os << std::endl + << "country_code: " << number.country_code() << std::endl + << "national_number: " << number.national_number() << std::endl; if (number.has_extension()) { - os << "extension: " << number.extension() << endl; + os << "extension: " << number.extension() << std::endl; } if (number.has_italian_leading_zero()) { - os << "italian_leading_zero: " << number.italian_leading_zero() << endl; + os << "italian_leading_zero: " << number.italian_leading_zero() << std::endl; } if (number.has_raw_input()) { - os << "raw_input: " << number.raw_input() << endl; + os << "raw_input: " << number.raw_input() << std::endl; } if (number.has_country_code_source()) { - os << "country_code_source: " << number.country_code_source() << endl; + os << "country_code_source: " << number.country_code_source() << std::endl; } if (number.has_preferred_domestic_carrier_code()) { os << "preferred_domestic_carrier_code: " - << number.preferred_domestic_carrier_code() << endl; + << number.preferred_domestic_carrier_code() << std::endl; } return os; } ostream& operator<<(ostream& os, const vector& numbers) { - os << "[" << endl; + os << "[" << std::endl; for (vector::const_iterator it = numbers.begin(); it != numbers.end(); ++it) { os << *it; } - os << endl << "]" << endl; + os << std::endl << "]" << std::endl; return os; }