#include "phonenumbers/asyoutypeformatter.h"
#include <math.h>
#include <cctype>
#include <list>
#include <string>
#include <google/protobuf/message_lite.h>
#include "phonenumbers/base/logging.h"
#include "phonenumbers/phonemetadata.pb.h"
#include "phonenumbers/phonenumberutil.h"
#include "phonenumbers/regexp_cache.h"
#include "phonenumbers/regexp_factory.h"
#include "phonenumbers/stringutil.h"
#include "phonenumbers/unicodestring.h"
namespace i18n {
namespace phonenumbers {
RepeatedPtrField;
namespace {
const char kPlusSign = …;
const size_t kMinLeadingDigitsLength = …;
const char kDigitPlaceholder[] = …;
const char kSeparatorBeforeNationalNumber = …;
const char kNationalPrefixSeparatorsPattern[] = …;
void MatchAllGroups(const string& pattern,
const string& input,
const AbstractRegExpFactory& regexp_factory,
RegExpCache* cache,
string* group) { … }
PhoneMetadata CreateEmptyMetadata() { … }
}
AsYouTypeFormatter::AsYouTypeFormatter(const string& region_code)
: … { … }
const PhoneMetadata* AsYouTypeFormatter::GetMetadataForRegion(
const string& region_code) const { … }
bool AsYouTypeFormatter::MaybeCreateNewTemplate() { … }
void AsYouTypeFormatter::GetAvailableFormats(const string& leading_digits) { … }
void AsYouTypeFormatter::NarrowDownPossibleFormats(
const string& leading_digits) { … }
void AsYouTypeFormatter::SetShouldAddSpaceAfterNationalPrefix(
const NumberFormat& format) { … }
bool AsYouTypeFormatter::CreateFormattingTemplate(const NumberFormat& format) { … }
void AsYouTypeFormatter::GetFormattingTemplate(
const string& number_pattern,
const string& number_format,
UnicodeString* formatting_template) { … }
void AsYouTypeFormatter::Clear() { … }
const string& AsYouTypeFormatter::InputDigit(char32 next_char, string* result) { … }
const string& AsYouTypeFormatter::InputDigitAndRememberPosition(
char32 next_char,
string* result) { … }
void AsYouTypeFormatter::InputDigitWithOptionToRememberPosition(
char32 next_char,
bool remember_position,
string* phone_number) { … }
void AsYouTypeFormatter::AttemptToChoosePatternWithPrefixExtracted(
string* formatted_number) { … }
const string& AsYouTypeFormatter::GetExtractedNationalPrefix() const { … }
bool AsYouTypeFormatter::AbleToExtractLongerNdd() { … }
void AsYouTypeFormatter::AttemptToFormatAccruedDigits(
string* formatted_result) { … }
int AsYouTypeFormatter::GetRememberedPosition() const { … }
void AsYouTypeFormatter::AppendNationalNumber(const string& national_number,
string* phone_number) const { … }
void AsYouTypeFormatter::AttemptToChooseFormattingPattern(
string* formatted_number) { … }
void AsYouTypeFormatter::InputAccruedNationalNumber(string* number) { … }
bool AsYouTypeFormatter::IsNanpaNumberWithNationalPrefix() const { … }
void AsYouTypeFormatter::RemoveNationalPrefixFromNationalNumber(
string* national_prefix) { … }
bool AsYouTypeFormatter::AttemptToExtractIdd() { … }
bool AsYouTypeFormatter::AttemptToExtractCountryCode() { … }
char AsYouTypeFormatter::NormalizeAndAccrueDigitsAndPlusSign(
char32 next_char,
bool remember_position) { … }
void AsYouTypeFormatter::InputDigitHelper(char next_char, string* number) { … }
int AsYouTypeFormatter::ConvertUnicodeStringPosition(const UnicodeString& s,
int pos) { … }
}
}