#include "phonenumbers/phonenumbermatcher.h"
#ifndef I18N_PHONENUMBERS_USE_ICU_REGEXP
#error phonenumbermatcher depends on ICU \
(i.e. I18N_PHONENUMBERS_USE_ICU_REGEXP must be set)
#endif
#include <ctype.h>
#include <stddef.h>
#include <limits>
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include <unicode/uchar.h>
#include "phonenumbers/alternate_format.h"
#include "phonenumbers/base/logging.h"
#include "phonenumbers/base/memory/scoped_ptr.h"
#include "phonenumbers/base/memory/singleton.h"
#include "phonenumbers/callback.h"
#include "phonenumbers/default_logger.h"
#include "phonenumbers/encoding_utils.h"
#include "phonenumbers/normalize_utf8.h"
#include "phonenumbers/phonemetadata.pb.h"
#include "phonenumbers/phonenumber.pb.h"
#include "phonenumbers/phonenumbermatch.h"
#include "phonenumbers/phonenumberutil.h"
#include "phonenumbers/regexp_adapter.h"
#include "phonenumbers/regexp_adapter_icu.h"
#include "phonenumbers/regexp_cache.h"
#include "phonenumbers/stringutil.h"
#include "phonenumbers/utf/unicodetext.h"
#ifdef I18N_PHONENUMBERS_USE_RE2
#include "phonenumbers/regexp_adapter_re2.h"
#endif
map;
numeric_limits;
string;
namespace i18n {
namespace phonenumbers {
namespace {
string Limit(int lower, int upper) { … }
bool IsInvalidPunctuationSymbol(char32 character) { … }
bool ContainsOnlyValidXChars(const PhoneNumber& number, const string& candidate,
const PhoneNumberUtil& util) { … }
bool AllNumberGroupsRemainGrouped(
const PhoneNumberUtil& util,
const PhoneNumber& number,
const string& normalized_candidate,
const std::vector<string>& formatted_number_groups) { … }
bool LoadAlternateFormats(PhoneMetadataCollection* alternate_formats) { … }
}
class PhoneNumberMatcherRegExps : public Singleton<PhoneNumberMatcherRegExps> { … };
class AlternateFormats : public Singleton<AlternateFormats> { … };
PhoneNumberMatcher::PhoneNumberMatcher(const PhoneNumberUtil& util,
const string& text,
const string& region_code,
PhoneNumberMatcher::Leniency leniency,
int max_tries)
: … { … }
PhoneNumberMatcher::PhoneNumberMatcher(const string& text,
const string& region_code)
: … { … }
PhoneNumberMatcher::~PhoneNumberMatcher() { … }
bool PhoneNumberMatcher::IsInputUtf8() { … }
bool PhoneNumberMatcher::IsLatinLetter(char32 letter) { … }
bool PhoneNumberMatcher::ParseAndVerify(const string& candidate, int offset,
PhoneNumberMatch* match) { … }
bool PhoneNumberMatcher::VerifyAccordingToLeniency(
Leniency leniency, const PhoneNumber& number,
const string& candidate) const { … }
bool PhoneNumberMatcher::ExtractInnerMatch(const string& candidate, int offset,
PhoneNumberMatch* match) { … }
bool PhoneNumberMatcher::ExtractMatch(const string& candidate, int offset,
PhoneNumberMatch* match) { … }
bool PhoneNumberMatcher::HasNext() { … }
bool PhoneNumberMatcher::Next(PhoneNumberMatch* match) { … }
bool PhoneNumberMatcher::Find(int index, PhoneNumberMatch* match) { … }
bool PhoneNumberMatcher::CheckNumberGroupingIsValid(
const PhoneNumber& phone_number,
const string& candidate,
ResultCallback4<bool, const PhoneNumberUtil&, const PhoneNumber&,
const string&, const std::vector<string>&>* checker) const { … }
void PhoneNumberMatcher::GetNationalNumberGroups(
const PhoneNumber& number,
std::vector<string>* digit_blocks) const { … }
void PhoneNumberMatcher::GetNationalNumberGroupsForPattern(
const PhoneNumber& number,
const NumberFormat* formatting_pattern,
std::vector<string>* digit_blocks) const { … }
bool PhoneNumberMatcher::IsNationalPrefixPresentIfRequired(
const PhoneNumber& number) const { … }
bool PhoneNumberMatcher::AllNumberGroupsAreExactlyPresent(
const PhoneNumberUtil& util,
const PhoneNumber& phone_number,
const string& normalized_candidate,
const std::vector<string>& formatted_number_groups) const { … }
bool PhoneNumberMatcher::ContainsMoreThanOneSlashInNationalNumber(
const PhoneNumber& number,
const string& candidate,
const PhoneNumberUtil& util) { … }
}
}