INCLUDE (CheckIncludeFileCXX)
CHECK_INCLUDE_FILE_CXX ("tr1/unordered_map" HAVE_CXX_TR1_UNORDERED_MAP)
if (HAVE_CXX_TR1_UNORDERED_MAP)
- add_definitions ("-DUSE_TR1_UNORDERED_MAP")
+ add_definitions ("-DI18N_PHONENUMBERS_USE_TR1_UNORDERED_MAP")
endif ()
endif ()
# regexp_factory.h and regexp_adapter_test.cc.
# When both ICU regexp and RE2 are defined, the regexp engine adapter defaults
# to RE2 unless the ICU implementation is instantiated explictly obviously.
- add_definitions (-DUSE_RE2)
+ add_definitions ("-DI18N_PHONENUMBERS_USE_RE2")
list (APPEND SOURCES "src/phonenumbers/regexp_adapter_re2.cc")
endif ()
if (${USE_ICU_REGEXP} STREQUAL "ON")
- add_definitions (-DUSE_ICU_REGEXP)
+ add_definitions ("-DI18N_PHONENUMBERS_USE_ICU_REGEXP")
list (APPEND SOURCES "src/phonenumbers/regexp_adapter_icu.cc")
# The phone number matcher needs ICU.
list (APPEND SOURCES "src/phonenumbers/alternate_format.cc")
#ifndef I18N_PHONENUMBERS_BASE_BASICTYPES_H_
#define I18N_PHONENUMBERS_BASE_BASICTYPES_H_
-#pragma once
#include <limits.h> // So we can set the bounds of our types
#include <stddef.h> // For size_t
#include <stdint.h> // For intptr_t.
#endif
+namespace i18n {
+namespace phonenumbers {
+
#ifdef INT64_MAX
// INT64_MAX is defined if C99 stdint.h is included; use the
// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
+#if !defined(DISALLOW_COPY_AND_ASSIGN)
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
-
-// An older, deprecated, politically incorrect name for the above.
-// NOTE: The usage of this macro was baned from our code base, but some
-// third_party libraries are yet using it.
-// TODO(tfarina): Figure out how to fix the usage of this macro in the
-// third_party libraries and get rid of it.
-#define DISALLOW_EVIL_CONSTRUCTORS(TypeName) DISALLOW_COPY_AND_ASSIGN(TypeName)
-
-// A macro to disallow all the implicit constructors, namely the
-// default constructor, copy constructor and operator= functions.
-//
-// This should be used in the private: declarations for a class
-// that wants to prevent anyone from instantiating it. This is
-// especially useful for classes containing only static methods.
-#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
- TypeName(); \
- DISALLOW_COPY_AND_ASSIGN(TypeName)
+#endif
// The arraysize(arr) macro returns the # of elements in an array arr.
// The expression is a compile-time constant, and therefore can be
char (&ArraySizeHelper(const T (&array)[N]))[N];
#endif
+#if !defined(arraysize)
#define arraysize(array) (sizeof(ArraySizeHelper(array)))
+#endif
// ARRAYSIZE_UNSAFE performs essentially the same calculation as arraysize,
// but can be used on anonymous types or types defined inside
// where a pointer is 4 bytes, this means all pointers to a type whose
// size is 3 or greater than 4 will be (righteously) rejected.
+#if !defined(ARRAYSIZE_UNSAFE)
#define ARRAYSIZE_UNSAFE(a) \
((sizeof(a) / sizeof(*(a))) / \
static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))
-
-
-// Use implicit_cast as a safe version of static_cast or const_cast
-// for upcasting in the type hierarchy (i.e. casting a pointer to Foo
-// to a pointer to SuperclassOfFoo or casting a pointer to Foo to
-// a const pointer to Foo).
-// When you use implicit_cast, the compiler checks that the cast is safe.
-// Such explicit implicit_casts are necessary in surprisingly many
-// situations where C++ demands an exact type match instead of an
-// argument type convertable to a target type.
-//
-// The From type can be inferred, so the preferred syntax for using
-// implicit_cast is the same as for static_cast etc.:
-//
-// implicit_cast<ToType>(expr)
-//
-// implicit_cast would have been part of the C++ standard library,
-// but the proposal was submitted too late. It will probably make
-// its way into the language in the future.
-template<typename To, typename From>
-inline To implicit_cast(From const &f) {
- return f;
-}
+#endif
// The COMPILE_ASSERT macro can be used to verify that a compile time
// expression is true. For example, you could use it to verify the
struct CompileAssert {
};
-#undef COMPILE_ASSERT
+#if !defined(COMPILE_ASSERT)
#define COMPILE_ASSERT(expr, msg) \
typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
+#endif
-// Implementation details of COMPILE_ASSERT:
-//
-// - COMPILE_ASSERT works by defining an array type that has -1
-// elements (and thus is invalid) when the expression is false.
-//
-// - The simpler definition
-//
-// #define COMPILE_ASSERT(expr, msg) typedef char msg[(expr) ? 1 : -1]
-//
-// does not work, as gcc supports variable-length arrays whose sizes
-// are determined at run-time (this is gcc's extension and not part
-// of the C++ standard). As a result, gcc fails to reject the
-// following code with the simple definition:
-//
-// int foo;
-// COMPILE_ASSERT(foo, msg); // not supposed to compile as foo is
-// // not a compile-time constant.
-//
-// - By using the type CompileAssert<(bool(expr))>, we ensures that
-// expr is a compile-time constant. (Template arguments must be
-// determined at compile-time.)
-//
-// - The outter parentheses in CompileAssert<(bool(expr))> are necessary
-// to work around a bug in gcc 3.4.4 and 4.0.1. If we had written
-//
-// CompileAssert<bool(expr)>
-//
-// instead, these compilers will refuse to compile
-//
-// COMPILE_ASSERT(5 > 0, some_message);
-//
-// (They seem to think the ">" in "5 > 0" marks the end of the
-// template argument list.)
-//
-// - The array size is (bool(expr) ? 1 : -1), instead of simply
-//
-// ((expr) ? 1 : -1).
-//
-// This is to avoid running into a bug in MS VC 7.1, which
-// causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.
-
-// Used to explicitly mark the return value of a function as unused. If you are
-// really sure you don't want to do anything with the return value of a function
-// that has been marked WARN_UNUSED_RESULT, wrap it with this. Example:
-//
-// scoped_ptr<MyType> my_var = ...;
-// if (TakeOwnership(my_var.get()) == SUCCESS)
-// ignore_result(my_var.release());
-//
-template<typename T>
-inline void ignore_result(const T&) {
-}
+} // namespace phonenumbers
+} // namespace i18n
#endif // I18N_PHONENUMBERS_BASE_BASICTYPES_H_
}
};
-namespace internal {
-
// Minimal implementation of the core logic of scoped_ptr, suitable for
// reuse in both scoped_ptr and its specializations.
template <class T, class D>
DISALLOW_COPY_AND_ASSIGN(scoped_ptr_impl);
};
-} // namespace internal
-} // namespace phonenumbers
-} // namespace i18n
-
// A scoped_ptr<T> is like a T*, except that the destructor of scoped_ptr<T>
// automatically deletes the pointer it holds (if any).
// That is, scoped_ptr<T> owns the T object that it points to.
// unique_ptr<> features. Known deficiencies include not supporting move-only
// deleteres, function pointers as deleters, and deleters with reference
// types.
-template <class T, class D = i18n::phonenumbers::DefaultDeleter<T> >
+template <class T, class D = DefaultDeleter<T> >
class scoped_ptr {
public:
// The element and deleter types.
// implementation of scoped_ptr.
template <typename U, typename V>
scoped_ptr(scoped_ptr<U, V> other) : impl_(&other.impl_) {
- COMPILE_ASSERT(!i18n::phonenumbers::is_array<U>::value,
- U_cannot_be_an_array);
+ COMPILE_ASSERT(!is_array<U>::value, U_cannot_be_an_array);
}
// operator=. Allows assignment from a scoped_ptr rvalue for a convertible
// scoped_ptr.
template <typename U, typename V>
scoped_ptr& operator=(scoped_ptr<U, V> rhs) {
- COMPILE_ASSERT(!i18n::phonenumbers::is_array<U>::value,
- U_cannot_be_an_array);
+ COMPILE_ASSERT(!is_array<U>::value, U_cannot_be_an_array);
impl_.TakeState(&rhs.impl_);
return *this;
}
// Allow scoped_ptr<element_type> to be used in boolean expressions, but not
// implicitly convertible to a real bool (which is dangerous).
private:
- typedef i18n::phonenumbers::internal::scoped_ptr_impl<
- element_type, deleter_type> scoped_ptr::*Testable;
+ typedef scoped_ptr_impl<element_type, deleter_type> scoped_ptr::*Testable;
public:
operator Testable() const { return impl_.get() ? &scoped_ptr::impl_ : NULL; }
private:
// Needed to reach into |impl_| in the constructor.
template <typename U, typename V> friend class scoped_ptr;
- i18n::phonenumbers::internal::scoped_ptr_impl<
- element_type, deleter_type> impl_;
+ scoped_ptr_impl<element_type, deleter_type> impl_;
// Forbid comparison of scoped_ptr types. If U != T, it totally
// doesn't make sense, and if U == T, it still doesn't make sense
// Allow scoped_ptr<element_type> to be used in boolean expressions, but not
// implicitly convertible to a real bool (which is dangerous).
private:
- typedef i18n::phonenumbers::internal::scoped_ptr_impl<
- element_type, deleter_type> scoped_ptr::*Testable;
+ typedef scoped_ptr_impl<element_type, deleter_type> scoped_ptr::*Testable;
public:
operator Testable() const { return impl_.get() ? &scoped_ptr::impl_ : NULL; }
enum { type_must_be_complete = sizeof(element_type) };
// Actually hold the data.
- i18n::phonenumbers::internal::scoped_ptr_impl<
- element_type, deleter_type> impl_;
+ scoped_ptr_impl<element_type, deleter_type> impl_;
// Disable initialization from any type other than element_type*, by
// providing a constructor that matches such an initialization, but is
return scoped_ptr<T>(ptr);
}
+} // namespace phonenumbers
+} // namespace i18n
+
#endif // !I18N_PHONENUMBERS_USE_BOOST
#endif // I18N_PHONENUMBERS_BASE_MEMORY_SCOPED_PTR_H_
// Author: Philippe Liard
-#ifndef I18N_PHONENUMBERS_BASE_THREAD_SAFETY_CHECK_H_
-#define I18N_PHONENUMBERS_BASE_THREAD_SAFETY_CHECK_H_
+#ifndef I18N_PHONENUMBERS_BASE_THREAD_CHECKER_H_
+#define I18N_PHONENUMBERS_BASE_THREAD_CHECKER_H_
#if !defined(I18N_PHONENUMBERS_USE_BOOST)
// user of the library know that it can't be used in a thread-safe manner when
// it is not depending on Boost.
#if !defined(I18N_PHONENUMBERS_NO_THREAD_SAFETY)
-#error "Building without Boost, please provide -DNO_THREAD_SAFETY"
+#error Building without Boost, please provide \
+ -DI18N_PHONENUMBERS_NO_THREAD_SAFETY
#endif
#endif
} // namespace phonenumbers
} // namespace i18n
-#endif // I18N_PHONENUMBERS_BASE_THREAD_SAFETY_CHECK_H_
+#endif // I18N_PHONENUMBERS_BASE_THREAD_CHECKER_H_
// Author: Philippe Liard
-// This file should not be compiled when using Google base/.
-#ifndef USE_GOOGLE_BASE
-
#include <iostream>
#include "phonenumbers/default_logger.h"
} // namespace phonenumbers
} // namespace i18n
-
-#endif // USE_GOOGLE_BASE
#include "phonenumbers/logger.h"
-#ifdef USE_GOOGLE_BASE
+#include <sstream>
+#include <string>
namespace i18n {
namespace phonenumbers {
-// If Google base/ is used, LOG() and VLOG() from base/logging.h are used
-// therefore the default logger implementation (StdoutLogger) instantiated in
-// phonenumberutil will actually never be used.
-typedef NullLogger StdoutLogger;
-
-} // namespace phonenumbers
-} // namespace i18n
-
-#else
-
-#include <sstream>
-#include <string>
-
+using i18n::phonenumbers::Logger;
using std::string;
using std::stringstream;
-// Make the logging functions private (not declared in logger.h) as the client
-// should not have any reason to use them.
-namespace {
-
-using i18n::phonenumbers::Logger;
-
// Class template used to inline the right implementation for the T -> string
// conversion.
template <typename T>
Logger* const impl_;
};
-} // namespace
-
-namespace i18n {
-namespace phonenumbers {
-
inline LoggerHandler VLOG(int n) {
Logger* const logger_impl = Logger::mutable_logger_impl();
if (logger_impl->level() < n) {
} // namespace phonenumbers
} // namespace i18n
-#endif // USE_GOOGLE_BASE
#endif // I18N_PHONENUMBERS_DEFAULT_LOGGER_H_
#include "phonenumbers/phonenumbermatcher.h"
-#ifndef USE_ICU_REGEXP
-#error phonenumbermatcher depends on ICU (i.e. USE_ICU_REGEXP must be set)
-#endif // USE_ICU_REGEXP
+#ifndef I18N_PHONENUMBERS_USE_ICU_REGEXP
+#error phonenumbermatcher depends on ICU \
+ (i.e. I18N_PHONENUMBERS_USE_ICU_REGEXP must be set)
+#endif // I18N_PHONENUMBERS_USE_ICU_REGEXP
#include <ctype.h>
#include <iostream>
#include "phonenumbers/regexp_adapter_icu.h"
#include "phonenumbers/stringutil.h"
-#ifdef USE_RE2
+#ifdef I18N_PHONENUMBERS_USE_RE2
#include "phonenumbers/regexp_adapter_re2.h"
-#endif // USE_RE2_AND_ICU
+#endif // I18N_PHONENUMBERS_USE_RE2_AND_ICU
using std::cerr;
using std::endl;
}
} // namespace
-#ifdef USE_GOOGLE_BASE
-class PhoneNumberMatcherRegExps {
- friend struct DefaultSingletonTraits<PhoneNumberMatcherRegExps>;
-#else
class PhoneNumberMatcherRegExps : public Singleton<PhoneNumberMatcherRegExps> {
- friend class Singleton<PhoneNumberMatcherRegExps>;
-#endif // USE_GOOGLE_BASE
private:
+ friend class Singleton<PhoneNumberMatcherRegExps>;
+
string opening_parens_;
string closing_parens_;
string non_parens_;
// Phone number pattern allowing optional punctuation.
scoped_ptr<const RegExp> pattern_;
-#ifdef USE_GOOGLE_BASE
- static PhoneNumberMatcherRegExps* GetInstance() {
- return Singleton<PhoneNumberMatcherRegExps>::get();
- }
-#endif // USE_GOOGLE_BASE
-
PhoneNumberMatcherRegExps()
: opening_parens_("(\\[\xEF\xBC\x88\xEF\xBC\xBB" /* "(\\[([" */),
closing_parens_(")\\]\xEF\xBC\x89\xEF\xBC\xBD" /* ")\\])]" */),
PhoneNumberUtil::GetInstance()->GetExtnPatternsForMatching(),
")?")),
regexp_factory_for_pattern_(new ICURegExpFactory()),
-#ifdef USE_RE2
+#ifdef I18N_PHONENUMBERS_USE_RE2
regexp_factory_(new RE2RegExpFactory()),
#else
regexp_factory_(new ICURegExpFactory()),
-#endif // USE_RE2
+#endif // I18N_PHONENUMBERS_USE_RE2
pub_pages_(regexp_factory_->CreateRegExp(
"\\d{1,5}-+\\d{1,5}\\s{0,4}\\(\\d{1,4}")),
slash_separated_dates_(regexp_factory_->CreateRegExp(
DISALLOW_COPY_AND_ASSIGN(PhoneNumberMatcherRegExps);
};
-#ifdef USE_GOOGLE_BASE
-class AlternateFormats {
- friend struct DefaultSingletonTraits<AlternateFormats>;
-#else
class AlternateFormats : public Singleton<AlternateFormats> {
- friend class Singleton<AlternateFormats>;
-#endif // USE_GOOGLE_BASE
public:
PhoneMetadataCollection format_data_;
map<int, const PhoneMetadata*> calling_code_to_alternate_formats_map_;
-#ifdef USE_GOOGLE_BASE
- static AlternateFormats* GetInstance() {
- return Singleton<AlternateFormats>::get();
- }
-#endif // USE_GOOGLE_BASE
-
AlternateFormats()
: format_data_(),
calling_code_to_alternate_formats_map_() {
} // namespace
void PhoneNumberUtil::SetLogger(Logger* logger) {
- Logger::set_logger_impl(logger);
+ logger_.reset(logger);
+ Logger::set_logger_impl(logger_.get());
}
class PhoneNumberRegExpsAndMappings {
// Private constructor. Also takes care of initialisation.
PhoneNumberUtil::PhoneNumberUtil()
- : logger_(Logger::set_logger_impl(new StdoutLogger())),
+ : logger_(Logger::set_logger_impl(new NullLogger())),
reg_exps_(new PhoneNumberRegExpsAndMappings),
country_calling_code_to_region_code_map_(new vector<IntRegionsPair>()),
nanpa_regions_(new set<string>()),
// Public wrapper function to get a PhoneNumberUtil instance with the default
// metadata file.
// static
-#ifdef USE_GOOGLE_BASE
PhoneNumberUtil* PhoneNumberUtil::GetInstance() {
- return Singleton<PhoneNumberUtil>::get();
+ return Singleton<PhoneNumberUtil>::GetInstance();
}
-#endif
const string& PhoneNumberUtil::GetExtnPatternsForMatching() const {
return reg_exps_->extn_patterns_for_matching_;
// codes can be found here:
// http://www.iso.org/iso/english_country_names_and_code_elements
-#ifdef USE_GOOGLE_BASE
-class PhoneNumberUtil {
- friend struct DefaultSingletonTraits<PhoneNumberUtil>;
-#else
class PhoneNumberUtil : public Singleton<PhoneNumberUtil> {
- friend class Singleton<PhoneNumberUtil>;
-#endif
+ private:
friend class AsYouTypeFormatter;
friend class PhoneNumberMatcher;
friend class PhoneNumberMatcherRegExps;
friend class PhoneNumberUtilTest;
friend class ShortNumberUtil;
friend class ShortNumberUtilTest;
+ friend class Singleton<PhoneNumberUtil>;
+
public:
~PhoneNumberUtil();
static const char kRegionCodeForNonGeoEntity[];
//
// The PhoneNumberUtil is implemented as a singleton. Therefore, calling
// GetInstance multiple times will only result in one instance being created.
-#ifdef USE_GOOGLE_BASE
static PhoneNumberUtil* GetInstance();
-#endif
// Returns true if the number is a valid vanity (alpha) number such as 800
// MICROSOFT. A valid vanity number will start with at least 3 digits and will
MatchType IsNumberMatchWithOneString(const PhoneNumber& first_number,
const string& second_number) const;
- // Overrides the default logging system. The provided logger destruction is
- // handled by this class (i.e don't delete it).
- static void SetLogger(Logger* logger);
+ // Overrides the default logging system. This takes ownership of the provided
+ // logger.
+ void SetLogger(Logger* logger);
// Gets an AsYouTypeFormatter for the specific region.
// Returns an AsYouTypeFormatter object, which could be used to format phone
RegExpCache::RegExpCache(const AbstractRegExpFactory& regexp_factory,
size_t min_items)
: regexp_factory_(regexp_factory),
-#ifdef USE_TR1_UNORDERED_MAP
+#ifdef I18N_PHONENUMBERS_USE_TR1_UNORDERED_MAP
cache_impl_(new CacheImpl(min_items))
#else
cache_impl_(new CacheImpl())
#include "phonenumbers/base/memory/scoped_ptr.h"
#include "phonenumbers/base/synchronization/lock.h"
-#ifdef USE_TR1_UNORDERED_MAP
+#ifdef I18N_PHONENUMBERS_USE_TR1_UNORDERED_MAP
# include <tr1/unordered_map>
#else
# include <map>
class RegExpCache {
private:
-#ifdef USE_TR1_UNORDERED_MAP
+#ifdef I18N_PHONENUMBERS_USE_TR1_UNORDERED_MAP
typedef std::tr1::unordered_map<string, const RegExp*> CacheImpl;
#else
typedef std::map<string, const RegExp*> CacheImpl;
#define I18N_PHONENUMBERS_REGEXP_ADAPTER_FACTORY_H_
// This file selects the right implementation of the abstract regexp factory at
-// compile time depending on the compilation flags (USE_RE2). The default
-// abstract regexp factory implementation can be obtained using the type
-// RegExpFactory. This will be set to RE2RegExpFactory if RE2 is used or
+// compile time depending on the compilation flags (I18N_PHONENUMBERS_USE_RE2).
+// The default abstract regexp factory implementation can be obtained using the
+// type RegExpFactory. This will be set to RE2RegExpFactory if RE2 is used or
// ICURegExpFactory otherwise.
-#ifdef USE_RE2
+#ifdef I18N_PHONENUMBERS_USE_RE2
#include "phonenumbers/regexp_adapter_re2.h"
#else
#include "phonenumbers/regexp_adapter_icu.h"
-#endif // USE_RE2
+#endif // I18N_PHONENUMBERS_USE_RE2
namespace i18n {
namespace phonenumbers {
-#ifdef USE_RE2
+#ifdef I18N_PHONENUMBERS_USE_RE2
typedef RE2RegExpFactory RegExpFactory;
#else
typedef ICURegExpFactory RegExpFactory;
-#endif // USE_RE2
+#endif // I18N_PHONENUMBERS_USE_RE2
} // namespace phonenumbers
} // namespace i18n
#include <cassert>
#include "phonenumbers/utf/unicodetext.h"
-//#include "phonenumbers/base/logging.h"
#include "phonenumbers/utf/stringpiece.h"
//#include "utf/stringprintf.h"
#include "phonenumbers/utf/utf.h"
#include "phonenumbers/utf/unilib.h"
+namespace i18n {
+namespace phonenumbers {
+
using std::stringstream;
using std::max;
using std::hex;
return result;
}
+
+} // namespace phonenumbers
+} // namespace i18n
#include <string>
#include <utility>
#include "phonenumbers/base/basictypes.h"
-//#include "util/utf8/public/config.h"
+
+namespace i18n {
+namespace phonenumbers {
using std::string;
using std::bidirectional_iterator_tag;
return string(t.utf8_data(), t.utf8_length());
}
+} // namespace phonenumbers
+} // namespace i18n
+
#endif // UTIL_UTF8_UNICODETEXT_H__
#include "phonenumbers/base/basictypes.h"
#include "phonenumbers/utf/utf.h"
+namespace i18n {
+namespace phonenumbers {
namespace UniLib {
namespace {
}
} // namespace UniLib
+} // namespace phonenumbers
+} // namespace i18n
#include <string>
#include "phonenumbers/base/basictypes.h"
+namespace i18n {
+namespace phonenumbers {
namespace UniLib {
// Returns true unless a surrogate code point
}
} // namespace UniLib
+} // namespace phonenumbers
+} // namespace i18n
#endif // UTIL_UTF8_PUBLIC_UNILIB_H_
#include "phonenumbers/base/logging.h"
#include "phonenumbers/base/memory/scoped_ptr.h"
+#include "phonenumbers/default_logger.h"
#include "phonenumbers/phonenumberutil.h"
#include "phonenumbers/test_util.h"
class AsYouTypeFormatterTest : public testing::Test {
protected:
AsYouTypeFormatterTest() : phone_util_(*PhoneNumberUtil::GetInstance()) {
+ PhoneNumberUtil::GetInstance()->SetLogger(new StdoutLogger());
}
const PhoneMetadata* GetCurrentMetadata() const {
#include "phonenumbers/base/basictypes.h"
#include "phonenumbers/base/memory/scoped_ptr.h"
#include "phonenumbers/base/memory/singleton.h"
+#include "phonenumbers/default_logger.h"
#include "phonenumbers/phonenumber.h"
#include "phonenumbers/phonenumber.pb.h"
#include "phonenumbers/phonenumbermatch.h"
RegionCode::US(),
PhoneNumberMatcher::VALID, 5),
offset_(0) {
+ PhoneNumberUtil::GetInstance()->SetLogger(new StdoutLogger());
}
bool IsLatinLetter(char32 letter) {
#include <gtest/gtest.h>
+#include "phonenumbers/default_logger.h"
#include "phonenumbers/phonemetadata.pb.h"
#include "phonenumbers/phonenumber.h"
#include "phonenumbers/phonenumber.pb.h"
class PhoneNumberUtilTest : public testing::Test {
protected:
PhoneNumberUtilTest() : phone_util_(*PhoneNumberUtil::GetInstance()) {
+ PhoneNumberUtil::GetInstance()->SetLogger(new StdoutLogger());
}
// Wrapper functions for private functions that we want to test.
#include <gtest/gtest.h>
+#include "phonenumbers/default_logger.h"
#include "phonenumbers/phonenumberutil.h"
#include "phonenumbers/shortnumberutil.h"
#include "phonenumbers/test_util.h"
class ShortNumberUtilTest : public testing::Test {
protected:
ShortNumberUtilTest() : short_util_() {
+ PhoneNumberUtil::GetInstance()->SetLogger(new StdoutLogger());
}
const ShortNumberUtil short_util_;
#include "phonenumbers/utf/unicodetext.h"
namespace i18n {
-namespace unicodetext {
+namespace phonenumbers {
TEST(UnicodeTextTest, Iterator) {
struct value {
}
}
-} // namespace unicodetext
+} // namespace phonenumbers
} // namespace i18n