Browse Source

CPP: libphonenumber 4.0

pull/567/head
Philippe Liard 14 years ago
committed by Mihaela Rosca
parent
commit
6153afed92
11 changed files with 18472 additions and 17748 deletions
  1. +8786
    -8445
      cpp/src/phonenumbers/lite_metadata.cc
  2. +9072
    -8725
      cpp/src/phonenumbers/metadata.cc
  3. +4
    -0
      cpp/src/phonenumbers/phonenumbermatcher.cc
  4. +1
    -0
      cpp/src/phonenumbers/phonenumberutil.h
  5. +1
    -0
      cpp/src/phonenumbers/regexp_adapter_icu.cc
  6. +2
    -0
      cpp/src/phonenumbers/regexp_adapter_icu.h
  7. +2
    -0
      cpp/src/phonenumbers/regexp_adapter_re2.h
  8. +0
    -1
      cpp/src/phonenumbers/regexp_cache.cc
  9. +591
    -576
      cpp/src/phonenumbers/test_metadata.cc
  10. +13
    -0
      cpp/test/phonenumbers/phonenumberutil_test.cc
  11. +0
    -1
      cpp/test/phonenumbers/regexp_adapter_test.cc

+ 8786
- 8445
cpp/src/phonenumbers/lite_metadata.cc
File diff suppressed because it is too large
View File


+ 9072
- 8725
cpp/src/phonenumbers/metadata.cc
File diff suppressed because it is too large
View File


+ 4
- 0
cpp/src/phonenumbers/phonenumbermatcher.cc View File

@ -24,8 +24,12 @@
#error phonenumbermatcher depends on ICU (i.e. USE_ICU_REGEXP must be set)
#endif // USE_ICU_REGEXP
#include <ctype.h>
#include <limits>
#include <stddef.h>
#include <string>
#include <vector>
#include <unicode/uchar.h>
#include "base/logging.h"


+ 1
- 0
cpp/src/phonenumbers/phonenumberutil.h View File

@ -20,6 +20,7 @@
#ifndef I18N_PHONENUMBERS_PHONENUMBERUTIL_H_
#define I18N_PHONENUMBERS_PHONENUMBERUTIL_H_
#include <stddef.h>
#include <list>
#include <map>
#include <set>


+ 1
- 0
cpp/src/phonenumbers/regexp_adapter_icu.cc View File

@ -17,6 +17,7 @@
#include "phonenumbers/regexp_adapter_icu.h"
#include <stddef.h>
#include <string>
#include <unicode/regex.h>


+ 2
- 0
cpp/src/phonenumbers/regexp_adapter_icu.h View File

@ -17,6 +17,8 @@
#ifndef I18N_PHONENUMBERS_REGEXP_ADAPTER_ICU_H_
#define I18N_PHONENUMBERS_REGEXP_ADAPTER_ICU_H_
#include <string>
#include "phonenumbers/regexp_adapter.h"
namespace i18n {


+ 2
- 0
cpp/src/phonenumbers/regexp_adapter_re2.h View File

@ -17,6 +17,8 @@
#ifndef I18N_PHONENUMBERS_REGEXP_ADAPTER_RE2_H_
#define I18N_PHONENUMBERS_REGEXP_ADAPTER_RE2_H_
#include <string>
#include "phonenumbers/regexp_adapter.h"
namespace i18n {


+ 0
- 1
cpp/src/phonenumbers/regexp_cache.cc View File

@ -20,7 +20,6 @@
#include <string>
#include <utility>
#include "base/logging.h"
#include "base/synchronization/lock.h"
#include "phonenumbers/regexp_adapter.h"


+ 591
- 576
cpp/src/phonenumbers/test_metadata.cc
File diff suppressed because it is too large
View File


+ 13
- 0
cpp/test/phonenumbers/phonenumberutil_test.cc View File

@ -107,6 +107,10 @@ class PhoneNumberUtilTest : public testing::Test {
return ExactlySameAs(expected_number, actual_number);
}
bool ContainsOnlyValidDigits(const string& s) const {
return phone_util_.ContainsOnlyValidDigits(s);
}
void GetNddPrefixForRegion(const string& region,
bool strip_non_digits,
string* ndd_prefix) const {
@ -118,6 +122,15 @@ class PhoneNumberUtilTest : public testing::Test {
const PhoneNumberUtil& phone_util_;
};
TEST_F(PhoneNumberUtilTest, ContainsOnlyValidDigits) {
EXPECT_TRUE(ContainsOnlyValidDigits(""));
EXPECT_TRUE(ContainsOnlyValidDigits("2"));
EXPECT_TRUE(ContainsOnlyValidDigits("25"));
EXPECT_TRUE(ContainsOnlyValidDigits("\xEF\xBC\x96" /* "6" */));
EXPECT_FALSE(ContainsOnlyValidDigits("a"));
EXPECT_FALSE(ContainsOnlyValidDigits("2a"));
}
TEST_F(PhoneNumberUtilTest, GetSupportedRegions) {
set<string> regions;


+ 0
- 1
cpp/test/phonenumbers/regexp_adapter_test.cc View File

@ -22,7 +22,6 @@
#include <gtest/gtest.h>
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "phonenumbers/stl_util.h"
#include "phonenumbers/stringutil.h"


Loading…
Cancel
Save