summaryrefslogtreecommitdiff
path: root/phonenumberutil.h
diff options
context:
space:
mode:
authordbeaumont@google.com <dbeaumont@google.com@ee073f10-1060-11df-b6a4-87a95322a99c>2012-10-11 16:44:08 +0000
committerdbeaumont@google.com <dbeaumont@google.com@ee073f10-1060-11df-b6a4-87a95322a99c>2012-10-11 16:44:08 +0000
commit93d3e8b6d7867ccac0dd4e6beeadfbc1b76dd116 (patch)
tree9fbfd499cb32cb2c56ab0e438db1f1f0a2216504 /phonenumberutil.h
parent9a7d4586148f6972dbaef524395da1ac1e969f03 (diff)
downloadphonenumbers-93d3e8b6d7867ccac0dd4e6beeadfbc1b76dd116.tar.gz
JAVA/CPP: Release 5.2. Metadata updates and bug fixes. See release notes for more details.
git-svn-id: http://libphonenumber.googlecode.com/svn/trunk/cpp/src/phonenumbers@532 ee073f10-1060-11df-b6a4-87a95322a99c
Diffstat (limited to 'phonenumberutil.h')
-rw-r--r--phonenumberutil.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/phonenumberutil.h b/phonenumberutil.h
index 5b936f6..fe3a83d 100644
--- a/phonenumberutil.h
+++ b/phonenumberutil.h
@@ -157,6 +157,14 @@ class PhoneNumberUtil : public Singleton<PhoneNumberUtil> {
// for.
void GetSupportedRegions(set<string>* regions) const;
+ // Populates a list with the region codes that match the specific country
+ // calling code. For non-geographical country calling codes, the region code
+ // 001 is returned. Also, in the case of no region code being found, the list
+ // is left unchanged.
+ void GetRegionCodesForCountryCallingCode(
+ int country_calling_code,
+ list<string>* region_codes) const;
+
// Gets a PhoneNumberUtil instance to carry out international phone number
// formatting, parsing, or validation. The instance is loaded with phone
// number metadata for a number of most commonly used regions, as specified by
@@ -383,6 +391,10 @@ class PhoneNumberUtil : public Singleton<PhoneNumberUtil> {
// are examined.
// This is useful for determining for example whether a particular number is
// valid for Canada, rather than just a valid NANPA number.
+ // Warning: In most cases, you want to use IsValidNumber instead. For
+ // example, this method will mark numbers from British Crown dependencies
+ // such as the Isle of Man as invalid for the region "GB" (United Kingdom),
+ // since it has its own region code, "IM", which may be undesirable.
bool IsValidNumberForRegion(
const PhoneNumber& number,
const string& region_code) const;
@@ -645,6 +657,11 @@ class PhoneNumberUtil : public Singleton<PhoneNumberUtil> {
// Trims unwanted end characters from a phone number string.
void TrimUnwantedEndChars(string* number) const;
+ // Tests whether a phone number has a geographical association. It checks if
+ // the number is associated to a certain region in the country where it
+ // belongs to. Note that this doesn't verify if the number is actually in use.
+ bool IsNumberGeographical(const PhoneNumber& phone_number) const;
+
// Helper function to check region code is not unknown or null.
bool IsValidRegionCode(const string& region_code) const;
@@ -665,10 +682,6 @@ class PhoneNumberUtil : public Singleton<PhoneNumberUtil> {
// has already been checked.
int GetCountryCodeForValidRegion(const string& region_code) const;
- void GetRegionCodesForCountryCallingCode(
- int country_calling_code,
- list<string>* region_codes) const;
-
const NumberFormat* ChooseFormattingPatternForNumber(
const RepeatedPtrField<NumberFormat>& available_formats,
const string& national_number) const;