phonelib 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -13
- data/README.rdoc +3 -1
- data/data/extended_data.dat +0 -0
- data/data/libphonenumber/cpp/src/phonenumbers/default_logger.cc +9 -10
- data/data/libphonenumber/cpp/src/phonenumbers/lite_metadata.cc +9070 -9088
- data/data/libphonenumber/cpp/src/phonenumbers/metadata.cc +9898 -9916
- data/data/libphonenumber/cpp/src/phonenumbers/phonenumbermatcher.cc +1 -2
- data/data/libphonenumber/cpp/src/phonenumbers/phonenumberutil.cc +58 -61
- data/data/libphonenumber/cpp/src/phonenumbers/regexp_cache.cc +1 -1
- data/data/libphonenumber/cpp/src/phonenumbers/shortnumberinfo.cc +1 -2
- data/data/libphonenumber/cpp/src/phonenumbers/utf/unilib.cc +2 -2
- data/data/libphonenumber/cpp/test/phonenumbers/phonenumberutil_test.cc +0 -2
- data/data/libphonenumber/cpp/test/phonenumbers/test_util.cc +10 -13
- data/data/libphonenumber/java/carrier/pom.xml +4 -4
- data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/1876_en +0 -0
- data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/212_en +0 -0
- data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/233_en +0 -0
- data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/234_en +0 -0
- data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/352_en +0 -0
- data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/60_en +0 -0
- data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/677_en +0 -0
- data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/91_en +0 -0
- data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/92_en +0 -0
- data/data/libphonenumber/java/carrier/src/com/google/i18n/phonenumbers/carrier/data/config +0 -0
- data/data/libphonenumber/java/demo/pom.xml +5 -5
- data/data/libphonenumber/java/geocoder/pom.xml +4 -4
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/PhoneNumberToTimeZonesMapper.java +0 -1
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/352_en +0 -0
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/352_fr +0 -0
- data/data/libphonenumber/java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/91_en +0 -0
- data/data/libphonenumber/java/internal/prefixmapper/pom.xml +3 -3
- data/data/libphonenumber/java/libphonenumber/pom.xml +2 -2
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberMatcher.java +3 -1
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java +4 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BD +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BH +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_EH +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GH +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IN +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JM +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LU +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MA +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MY +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NF +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NG +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PK +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SB +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TT +0 -0
- data/data/libphonenumber/java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TZ +0 -0
- data/data/libphonenumber/java/pom.xml +5 -6
- data/data/libphonenumber/java/release_notes.txt +9 -0
- data/data/libphonenumber/javascript/i18n/phonenumbers/demo-compiled.js +47 -49
- data/data/libphonenumber/javascript/i18n/phonenumbers/metadata.js +20 -20
- data/data/libphonenumber/javascript/i18n/phonenumbers/metadatalite.js +20 -20
- data/data/libphonenumber/resources/PhoneNumberMetadata.xml +59 -87
- data/data/libphonenumber/resources/carrier/en/1.txt +7 -0
- data/data/libphonenumber/resources/carrier/en/212.txt +3 -0
- data/data/libphonenumber/resources/carrier/en/233.txt +3 -0
- data/data/libphonenumber/resources/carrier/en/234.txt +1 -0
- data/data/libphonenumber/resources/carrier/en/352.txt +5 -1
- data/data/libphonenumber/resources/carrier/en/60.txt +2 -0
- data/data/libphonenumber/resources/carrier/en/677.txt +6 -2
- data/data/libphonenumber/resources/carrier/en/91.txt +2 -0
- data/data/libphonenumber/resources/carrier/en/92.txt +1 -0
- data/data/libphonenumber/resources/geocoding/en/352.txt +19 -18
- data/data/libphonenumber/resources/geocoding/en/91.txt +1 -0
- data/data/libphonenumber/resources/geocoding/fr/352.txt +18 -18
- data/data/phone_data.dat +0 -0
- data/lib/phonelib/version.rb +1 -1
- metadata +18 -14
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
#include "phonenumbers/regexp_adapter_re2.h"
|
|
56
56
|
#endif // I18N_PHONENUMBERS_USE_RE2_AND_ICU
|
|
57
57
|
|
|
58
|
-
using std::make_pair;
|
|
59
58
|
using std::map;
|
|
60
59
|
using std::numeric_limits;
|
|
61
60
|
using std::string;
|
|
@@ -372,7 +371,7 @@ class AlternateFormats : public Singleton<AlternateFormats> {
|
|
|
372
371
|
it != format_data_.metadata().end();
|
|
373
372
|
++it) {
|
|
374
373
|
calling_code_to_alternate_formats_map_.insert(
|
|
375
|
-
make_pair(it->country_code(), &*it));
|
|
374
|
+
std::make_pair(it->country_code(), &*it));
|
|
376
375
|
}
|
|
377
376
|
}
|
|
378
377
|
|
|
@@ -52,9 +52,6 @@
|
|
|
52
52
|
namespace i18n {
|
|
53
53
|
namespace phonenumbers {
|
|
54
54
|
|
|
55
|
-
using std::make_pair;
|
|
56
|
-
using std::sort;
|
|
57
|
-
|
|
58
55
|
using google::protobuf::RepeatedPtrField;
|
|
59
56
|
|
|
60
57
|
// static constants
|
|
@@ -289,70 +286,70 @@ void PhoneNumberUtil::SetLogger(Logger* logger) {
|
|
|
289
286
|
class PhoneNumberRegExpsAndMappings {
|
|
290
287
|
private:
|
|
291
288
|
void InitializeMapsAndSets() {
|
|
292
|
-
diallable_char_mappings_.insert(make_pair('+', '+'));
|
|
293
|
-
diallable_char_mappings_.insert(make_pair('*', '*'));
|
|
289
|
+
diallable_char_mappings_.insert(std::make_pair('+', '+'));
|
|
290
|
+
diallable_char_mappings_.insert(std::make_pair('*', '*'));
|
|
294
291
|
// Here we insert all punctuation symbols that we wish to respect when
|
|
295
292
|
// formatting alpha numbers, as they show the intended number groupings.
|
|
296
293
|
all_plus_number_grouping_symbols_.insert(
|
|
297
|
-
make_pair(ToUnicodeCodepoint("-"), '-'));
|
|
294
|
+
std::make_pair(ToUnicodeCodepoint("-"), '-'));
|
|
298
295
|
all_plus_number_grouping_symbols_.insert(
|
|
299
|
-
make_pair(ToUnicodeCodepoint("\xEF\xBC\x8D" /* "-" */), '-'));
|
|
296
|
+
std::make_pair(ToUnicodeCodepoint("\xEF\xBC\x8D" /* "-" */), '-'));
|
|
300
297
|
all_plus_number_grouping_symbols_.insert(
|
|
301
|
-
make_pair(ToUnicodeCodepoint("\xE2\x80\x90" /* "‐" */), '-'));
|
|
298
|
+
std::make_pair(ToUnicodeCodepoint("\xE2\x80\x90" /* "‐" */), '-'));
|
|
302
299
|
all_plus_number_grouping_symbols_.insert(
|
|
303
|
-
make_pair(ToUnicodeCodepoint("\xE2\x80\x91" /* "‑" */), '-'));
|
|
300
|
+
std::make_pair(ToUnicodeCodepoint("\xE2\x80\x91" /* "‑" */), '-'));
|
|
304
301
|
all_plus_number_grouping_symbols_.insert(
|
|
305
|
-
make_pair(ToUnicodeCodepoint("\xE2\x80\x92" /* "‒" */), '-'));
|
|
302
|
+
std::make_pair(ToUnicodeCodepoint("\xE2\x80\x92" /* "‒" */), '-'));
|
|
306
303
|
all_plus_number_grouping_symbols_.insert(
|
|
307
|
-
make_pair(ToUnicodeCodepoint("\xE2\x80\x93" /* "–" */), '-'));
|
|
304
|
+
std::make_pair(ToUnicodeCodepoint("\xE2\x80\x93" /* "–" */), '-'));
|
|
308
305
|
all_plus_number_grouping_symbols_.insert(
|
|
309
|
-
make_pair(ToUnicodeCodepoint("\xE2\x80\x94" /* "—" */), '-'));
|
|
306
|
+
std::make_pair(ToUnicodeCodepoint("\xE2\x80\x94" /* "—" */), '-'));
|
|
310
307
|
all_plus_number_grouping_symbols_.insert(
|
|
311
|
-
make_pair(ToUnicodeCodepoint("\xE2\x80\x95" /* "―" */), '-'));
|
|
308
|
+
std::make_pair(ToUnicodeCodepoint("\xE2\x80\x95" /* "―" */), '-'));
|
|
312
309
|
all_plus_number_grouping_symbols_.insert(
|
|
313
|
-
make_pair(ToUnicodeCodepoint("\xE2\x88\x92" /* "−" */), '-'));
|
|
310
|
+
std::make_pair(ToUnicodeCodepoint("\xE2\x88\x92" /* "−" */), '-'));
|
|
314
311
|
all_plus_number_grouping_symbols_.insert(
|
|
315
|
-
make_pair(ToUnicodeCodepoint("/"), '/'));
|
|
312
|
+
std::make_pair(ToUnicodeCodepoint("/"), '/'));
|
|
316
313
|
all_plus_number_grouping_symbols_.insert(
|
|
317
|
-
make_pair(ToUnicodeCodepoint("\xEF\xBC\x8F" /* "/" */), '/'));
|
|
314
|
+
std::make_pair(ToUnicodeCodepoint("\xEF\xBC\x8F" /* "/" */), '/'));
|
|
318
315
|
all_plus_number_grouping_symbols_.insert(
|
|
319
|
-
make_pair(ToUnicodeCodepoint(" "), ' '));
|
|
316
|
+
std::make_pair(ToUnicodeCodepoint(" "), ' '));
|
|
320
317
|
all_plus_number_grouping_symbols_.insert(
|
|
321
|
-
make_pair(ToUnicodeCodepoint("\xE3\x80\x80" /* " " */), ' '));
|
|
318
|
+
std::make_pair(ToUnicodeCodepoint("\xE3\x80\x80" /* " " */), ' '));
|
|
322
319
|
all_plus_number_grouping_symbols_.insert(
|
|
323
|
-
make_pair(ToUnicodeCodepoint("\xE2\x81\xA0"), ' '));
|
|
320
|
+
std::make_pair(ToUnicodeCodepoint("\xE2\x81\xA0"), ' '));
|
|
324
321
|
all_plus_number_grouping_symbols_.insert(
|
|
325
|
-
make_pair(ToUnicodeCodepoint("."), '.'));
|
|
322
|
+
std::make_pair(ToUnicodeCodepoint("."), '.'));
|
|
326
323
|
all_plus_number_grouping_symbols_.insert(
|
|
327
|
-
make_pair(ToUnicodeCodepoint("\xEF\xBC\x8E" /* "." */), '.'));
|
|
324
|
+
std::make_pair(ToUnicodeCodepoint("\xEF\xBC\x8E" /* "." */), '.'));
|
|
328
325
|
// Only the upper-case letters are added here - the lower-case versions are
|
|
329
326
|
// added programmatically.
|
|
330
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("A"), '2'));
|
|
331
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("B"), '2'));
|
|
332
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("C"), '2'));
|
|
333
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("D"), '3'));
|
|
334
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("E"), '3'));
|
|
335
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("F"), '3'));
|
|
336
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("G"), '4'));
|
|
337
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("H"), '4'));
|
|
338
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("I"), '4'));
|
|
339
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("J"), '5'));
|
|
340
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("K"), '5'));
|
|
341
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("L"), '5'));
|
|
342
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("M"), '6'));
|
|
343
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("N"), '6'));
|
|
344
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("O"), '6'));
|
|
345
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("P"), '7'));
|
|
346
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("Q"), '7'));
|
|
347
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("R"), '7'));
|
|
348
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("S"), '7'));
|
|
349
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("T"), '8'));
|
|
350
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("U"), '8'));
|
|
351
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("V"), '8'));
|
|
352
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("W"), '9'));
|
|
353
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("X"), '9'));
|
|
354
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("Y"), '9'));
|
|
355
|
-
alpha_mappings_.insert(make_pair(ToUnicodeCodepoint("Z"), '9'));
|
|
327
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("A"), '2'));
|
|
328
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("B"), '2'));
|
|
329
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("C"), '2'));
|
|
330
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("D"), '3'));
|
|
331
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("E"), '3'));
|
|
332
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("F"), '3'));
|
|
333
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("G"), '4'));
|
|
334
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("H"), '4'));
|
|
335
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("I"), '4'));
|
|
336
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("J"), '5'));
|
|
337
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("K"), '5'));
|
|
338
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("L"), '5'));
|
|
339
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("M"), '6'));
|
|
340
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("N"), '6'));
|
|
341
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("O"), '6'));
|
|
342
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("P"), '7'));
|
|
343
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("Q"), '7'));
|
|
344
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("R"), '7'));
|
|
345
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("S"), '7'));
|
|
346
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("T"), '8'));
|
|
347
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("U"), '8'));
|
|
348
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("V"), '8'));
|
|
349
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("W"), '9'));
|
|
350
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("X"), '9'));
|
|
351
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("Y"), '9'));
|
|
352
|
+
alpha_mappings_.insert(std::make_pair(ToUnicodeCodepoint("Z"), '9'));
|
|
356
353
|
map<char32, char> lower_case_mappings;
|
|
357
354
|
map<char32, char> alpha_letters;
|
|
358
355
|
for (map<char32, char>::const_iterator it = alpha_mappings_.begin();
|
|
@@ -362,12 +359,12 @@ class PhoneNumberRegExpsAndMappings {
|
|
|
362
359
|
if (it->first < 128) {
|
|
363
360
|
char letter_as_upper = static_cast<char>(it->first);
|
|
364
361
|
char32 letter_as_lower = static_cast<char32>(tolower(letter_as_upper));
|
|
365
|
-
lower_case_mappings.insert(make_pair(letter_as_lower, it->second));
|
|
362
|
+
lower_case_mappings.insert(std::make_pair(letter_as_lower, it->second));
|
|
366
363
|
// Add the letters in both variants to the alpha_letters map. This just
|
|
367
364
|
// pairs each letter with its upper-case representation so that it can
|
|
368
365
|
// be retained when normalising alpha numbers.
|
|
369
|
-
alpha_letters.insert(make_pair(letter_as_lower, letter_as_upper));
|
|
370
|
-
alpha_letters.insert(make_pair(it->first, letter_as_upper));
|
|
366
|
+
alpha_letters.insert(std::make_pair(letter_as_lower, letter_as_upper));
|
|
367
|
+
alpha_letters.insert(std::make_pair(it->first, letter_as_upper));
|
|
371
368
|
}
|
|
372
369
|
}
|
|
373
370
|
// In the Java version we don't insert the lower-case mappings in the map,
|
|
@@ -382,13 +379,13 @@ class PhoneNumberRegExpsAndMappings {
|
|
|
382
379
|
alpha_letters.end());
|
|
383
380
|
// Add the ASCII digits so that they don't get deleted by NormalizeHelper().
|
|
384
381
|
for (char c = '0'; c <= '9'; ++c) {
|
|
385
|
-
diallable_char_mappings_.insert(make_pair(c, c));
|
|
386
|
-
alpha_phone_mappings_.insert(make_pair(c, c));
|
|
387
|
-
all_plus_number_grouping_symbols_.insert(make_pair(c, c));
|
|
382
|
+
diallable_char_mappings_.insert(std::make_pair(c, c));
|
|
383
|
+
alpha_phone_mappings_.insert(std::make_pair(c, c));
|
|
384
|
+
all_plus_number_grouping_symbols_.insert(std::make_pair(c, c));
|
|
388
385
|
}
|
|
389
386
|
|
|
390
|
-
mobile_token_mappings_.insert(make_pair(52, '1'));
|
|
391
|
-
mobile_token_mappings_.insert(make_pair(54, '9'));
|
|
387
|
+
mobile_token_mappings_.insert(std::make_pair(52, '1'));
|
|
388
|
+
mobile_token_mappings_.insert(std::make_pair(54, '9'));
|
|
392
389
|
}
|
|
393
390
|
|
|
394
391
|
// Small string helpers since StrCat has a maximum number of arguments. These
|
|
@@ -611,9 +608,9 @@ PhoneNumberUtil::PhoneNumberUtil()
|
|
|
611
608
|
int country_calling_code = it->country_code();
|
|
612
609
|
if (kRegionCodeForNonGeoEntity == region_code) {
|
|
613
610
|
country_code_to_non_geographical_metadata_map_->insert(
|
|
614
|
-
make_pair(country_calling_code, *it));
|
|
611
|
+
std::make_pair(country_calling_code, *it));
|
|
615
612
|
} else {
|
|
616
|
-
region_to_metadata_map_->insert(make_pair(region_code, *it));
|
|
613
|
+
region_to_metadata_map_->insert(std::make_pair(region_code, *it));
|
|
617
614
|
}
|
|
618
615
|
map<int, list<string>* >::iterator calling_code_in_map =
|
|
619
616
|
country_calling_code_to_region_map.find(country_calling_code);
|
|
@@ -628,7 +625,7 @@ PhoneNumberUtil::PhoneNumberUtil()
|
|
|
628
625
|
list<string>* list_with_region_code = new list<string>();
|
|
629
626
|
list_with_region_code->push_back(region_code);
|
|
630
627
|
country_calling_code_to_region_map.insert(
|
|
631
|
-
make_pair(country_calling_code, list_with_region_code));
|
|
628
|
+
std::make_pair(country_calling_code, list_with_region_code));
|
|
632
629
|
}
|
|
633
630
|
if (country_calling_code == kNanpaCountryCode) {
|
|
634
631
|
nanpa_regions_->insert(region_code);
|
|
@@ -640,9 +637,9 @@ PhoneNumberUtil::PhoneNumberUtil()
|
|
|
640
637
|
country_calling_code_to_region_map.begin(),
|
|
641
638
|
country_calling_code_to_region_map.end());
|
|
642
639
|
// Sort all the pairs in ascending order according to country calling code.
|
|
643
|
-
sort(country_calling_code_to_region_code_map_->begin(),
|
|
644
|
-
|
|
645
|
-
|
|
640
|
+
std::sort(country_calling_code_to_region_code_map_->begin(),
|
|
641
|
+
country_calling_code_to_region_code_map_->end(),
|
|
642
|
+
OrderByFirst());
|
|
646
643
|
}
|
|
647
644
|
|
|
648
645
|
PhoneNumberUtil::~PhoneNumberUtil() {
|
|
@@ -52,7 +52,7 @@ const RegExp& RegExpCache::GetRegExp(const string& pattern) {
|
|
|
52
52
|
if (it != cache_impl_->end()) return *it->second;
|
|
53
53
|
|
|
54
54
|
const RegExp* regexp = regexp_factory_.CreateRegExp(pattern);
|
|
55
|
-
cache_impl_->insert(make_pair(pattern, regexp));
|
|
55
|
+
cache_impl_->insert(std::make_pair(pattern, regexp));
|
|
56
56
|
return *regexp;
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
namespace i18n {
|
|
33
33
|
namespace phonenumbers {
|
|
34
34
|
|
|
35
|
-
using std::make_pair;
|
|
36
35
|
using std::map;
|
|
37
36
|
using std::string;
|
|
38
37
|
|
|
@@ -59,7 +58,7 @@ ShortNumberInfo::ShortNumberInfo()
|
|
|
59
58
|
it != metadata_collection.metadata().end();
|
|
60
59
|
++it) {
|
|
61
60
|
const string& region_code = it->id();
|
|
62
|
-
region_to_short_metadata_map_->insert(make_pair(region_code, *it));
|
|
61
|
+
region_to_short_metadata_map_->insert(std::make_pair(region_code, *it));
|
|
63
62
|
}
|
|
64
63
|
regions_where_emergency_numbers_must_be_exact_->insert("BR");
|
|
65
64
|
regions_where_emergency_numbers_must_be_exact_->insert("CL");
|
|
@@ -53,8 +53,8 @@ int SpanInterchangeValid(const char* begin, int byte_length) {
|
|
|
53
53
|
int bytes_consumed = charntorune(&rune, p, end - p);
|
|
54
54
|
// We want to accept Runeerror == U+FFFD as a valid char, but it is used
|
|
55
55
|
// by chartorune to indicate error. Luckily, the real codepoint is size 3
|
|
56
|
-
// while errors return bytes_consumed
|
|
57
|
-
if ((rune == Runeerror && bytes_consumed
|
|
56
|
+
// while errors return bytes_consumed <= 1.
|
|
57
|
+
if ((rune == Runeerror && bytes_consumed <= 1) ||
|
|
58
58
|
!IsInterchangeValidCodepoint(rune)) {
|
|
59
59
|
break; // Found
|
|
60
60
|
}
|
|
@@ -20,42 +20,39 @@
|
|
|
20
20
|
#include "phonenumbers/phonenumber.pb.h"
|
|
21
21
|
#include "phonenumbers/test_util.h"
|
|
22
22
|
|
|
23
|
-
using std::cout;
|
|
24
|
-
using std::endl;
|
|
25
|
-
|
|
26
23
|
namespace i18n {
|
|
27
24
|
namespace phonenumbers {
|
|
28
25
|
|
|
29
26
|
ostream& operator<<(ostream& os, const PhoneNumber& number) {
|
|
30
|
-
os << endl
|
|
31
|
-
<< "country_code: " << number.country_code() << endl
|
|
32
|
-
<< "national_number: " << number.national_number() << endl;
|
|
27
|
+
os << std::endl
|
|
28
|
+
<< "country_code: " << number.country_code() << std::endl
|
|
29
|
+
<< "national_number: " << number.national_number() << std::endl;
|
|
33
30
|
if (number.has_extension()) {
|
|
34
|
-
os << "extension: " << number.extension() << endl;
|
|
31
|
+
os << "extension: " << number.extension() << std::endl;
|
|
35
32
|
}
|
|
36
33
|
if (number.has_italian_leading_zero()) {
|
|
37
|
-
os << "italian_leading_zero: " << number.italian_leading_zero() << endl;
|
|
34
|
+
os << "italian_leading_zero: " << number.italian_leading_zero() << std::endl;
|
|
38
35
|
}
|
|
39
36
|
if (number.has_raw_input()) {
|
|
40
|
-
os << "raw_input: " << number.raw_input() << endl;
|
|
37
|
+
os << "raw_input: " << number.raw_input() << std::endl;
|
|
41
38
|
}
|
|
42
39
|
if (number.has_country_code_source()) {
|
|
43
|
-
os << "country_code_source: " << number.country_code_source() << endl;
|
|
40
|
+
os << "country_code_source: " << number.country_code_source() << std::endl;
|
|
44
41
|
}
|
|
45
42
|
if (number.has_preferred_domestic_carrier_code()) {
|
|
46
43
|
os << "preferred_domestic_carrier_code: "
|
|
47
|
-
<< number.preferred_domestic_carrier_code() << endl;
|
|
44
|
+
<< number.preferred_domestic_carrier_code() << std::endl;
|
|
48
45
|
}
|
|
49
46
|
return os;
|
|
50
47
|
}
|
|
51
48
|
|
|
52
49
|
ostream& operator<<(ostream& os, const vector<PhoneNumber>& numbers) {
|
|
53
|
-
os << "[" << endl;
|
|
50
|
+
os << "[" << std::endl;
|
|
54
51
|
for (vector<PhoneNumber>::const_iterator it = numbers.begin();
|
|
55
52
|
it != numbers.end(); ++it) {
|
|
56
53
|
os << *it;
|
|
57
54
|
}
|
|
58
|
-
os << endl << "]" << endl;
|
|
55
|
+
os << std::endl << "]" << std::endl;
|
|
59
56
|
return os;
|
|
60
57
|
}
|
|
61
58
|
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
<modelVersion>4.0.0</modelVersion>
|
|
4
4
|
<groupId>com.googlecode.libphonenumber</groupId>
|
|
5
5
|
<artifactId>carrier</artifactId>
|
|
6
|
-
<version>1.
|
|
6
|
+
<version>1.10-SNAPSHOT</version>
|
|
7
7
|
<packaging>jar</packaging>
|
|
8
8
|
<url>http://code.google.com/p/libphonenumber/</url>
|
|
9
9
|
|
|
10
10
|
<parent>
|
|
11
11
|
<groupId>com.googlecode.libphonenumber</groupId>
|
|
12
12
|
<artifactId>libphonenumber-parent</artifactId>
|
|
13
|
-
<version>7.0.
|
|
13
|
+
<version>7.0.3-SNAPSHOT</version>
|
|
14
14
|
</parent>
|
|
15
15
|
|
|
16
16
|
<build>
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
<dependency>
|
|
35
35
|
<groupId>com.googlecode.libphonenumber</groupId>
|
|
36
36
|
<artifactId>libphonenumber</artifactId>
|
|
37
|
-
<version>7.0.
|
|
37
|
+
<version>7.0.3-SNAPSHOT</version>
|
|
38
38
|
</dependency>
|
|
39
39
|
<dependency>
|
|
40
40
|
<groupId>com.googlecode.libphonenumber</groupId>
|
|
41
41
|
<artifactId>prefixmapper</artifactId>
|
|
42
|
-
<version>2.
|
|
42
|
+
<version>2.20-SNAPSHOT</version>
|
|
43
43
|
</dependency>
|
|
44
44
|
</dependencies>
|
|
45
45
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
<parent>
|
|
5
5
|
<artifactId>libphonenumber-parent</artifactId>
|
|
6
6
|
<groupId>com.googlecode.libphonenumber</groupId>
|
|
7
|
-
<version>7.0.
|
|
7
|
+
<version>7.0.3-SNAPSHOT</version>
|
|
8
8
|
</parent>
|
|
9
9
|
<groupId>com.googlecode.libphonenumber</groupId>
|
|
10
10
|
<artifactId>demo</artifactId>
|
|
11
|
-
<version>7.0.
|
|
11
|
+
<version>7.0.3-SNAPSHOT</version>
|
|
12
12
|
|
|
13
13
|
<properties>
|
|
14
14
|
<gae.version>1.5.4</gae.version>
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
<dependency>
|
|
44
44
|
<groupId>com.googlecode.libphonenumber</groupId>
|
|
45
45
|
<artifactId>libphonenumber</artifactId>
|
|
46
|
-
<version>7.0.
|
|
46
|
+
<version>7.0.3-SNAPSHOT</version>
|
|
47
47
|
</dependency>
|
|
48
48
|
<dependency>
|
|
49
49
|
<groupId>com.googlecode.libphonenumber</groupId>
|
|
50
50
|
<artifactId>geocoder</artifactId>
|
|
51
|
-
<version>2.
|
|
51
|
+
<version>2.20-SNAPSHOT</version>
|
|
52
52
|
</dependency>
|
|
53
53
|
<dependency>
|
|
54
54
|
<groupId>com.googlecode.libphonenumber</groupId>
|
|
55
55
|
<artifactId>carrier</artifactId>
|
|
56
|
-
<version>1.
|
|
56
|
+
<version>1.10-SNAPSHOT</version>
|
|
57
57
|
</dependency>
|
|
58
58
|
</dependencies>
|
|
59
59
|
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
<modelVersion>4.0.0</modelVersion>
|
|
4
4
|
<groupId>com.googlecode.libphonenumber</groupId>
|
|
5
5
|
<artifactId>geocoder</artifactId>
|
|
6
|
-
<version>2.
|
|
6
|
+
<version>2.20-SNAPSHOT</version>
|
|
7
7
|
<packaging>jar</packaging>
|
|
8
8
|
<url>http://code.google.com/p/libphonenumber/</url>
|
|
9
9
|
|
|
10
10
|
<parent>
|
|
11
11
|
<groupId>com.googlecode.libphonenumber</groupId>
|
|
12
12
|
<artifactId>libphonenumber-parent</artifactId>
|
|
13
|
-
<version>7.0.
|
|
13
|
+
<version>7.0.3-SNAPSHOT</version>
|
|
14
14
|
</parent>
|
|
15
15
|
|
|
16
16
|
<build>
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
<dependency>
|
|
43
43
|
<groupId>com.googlecode.libphonenumber</groupId>
|
|
44
44
|
<artifactId>libphonenumber</artifactId>
|
|
45
|
-
<version>7.0.
|
|
45
|
+
<version>7.0.3-SNAPSHOT</version>
|
|
46
46
|
</dependency>
|
|
47
47
|
<dependency>
|
|
48
48
|
<groupId>com.googlecode.libphonenumber</groupId>
|
|
49
49
|
<artifactId>prefixmapper</artifactId>
|
|
50
|
-
<version>2.
|
|
50
|
+
<version>2.20-SNAPSHOT</version>
|
|
51
51
|
</dependency>
|
|
52
52
|
</dependencies>
|
|
53
53
|
|
|
@@ -33,7 +33,6 @@ import java.util.logging.Logger;
|
|
|
33
33
|
* An offline mapper from phone numbers to time zones.
|
|
34
34
|
*/
|
|
35
35
|
public class PhoneNumberToTimeZonesMapper {
|
|
36
|
-
private static PhoneNumberToTimeZonesMapper instance = null;
|
|
37
36
|
private static final String MAPPING_DATA_DIRECTORY =
|
|
38
37
|
"/com/google/i18n/phonenumbers/timezones/data/";
|
|
39
38
|
private static final String MAPPING_DATA_FILE_NAME = "map_data";
|