chromium/third_party/libphonenumber/dist/cpp/src/phonenumbers/asyoutypeformatter.cc

// Copyright (C) 2011 The Libphonenumber Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#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 =;

// This is the minimum length of national number accrued that is required to
// trigger the formatter. The first element of the leading_digits_pattern of
// each number_format contains a regular expression that matches up to this
// number of digits.
const size_t kMinLeadingDigitsLength =;

// The digits that have not been entered yet will be represented by a \u2008,
// the punctuation space.
const char kDigitPlaceholder[] =; /* " " */

// Character used when appropriate to separate a prefix, such as a long NDD or a
// country calling code, from the national number.
const char kSeparatorBeforeNationalNumber =;

// A set of characters that, if found in a national prefix formatting rules, are
// an indicator to us that we should separate the national prefix from the
// number when formatting.
const char kNationalPrefixSeparatorsPattern[] =;

// Matches all the groups contained in 'input' against 'pattern'.
void MatchAllGroups(const string& pattern,
                    const string& input,
                    const AbstractRegExpFactory& regexp_factory,
                    RegExpCache* cache,
                    string* group) {}

PhoneMetadata CreateEmptyMetadata() {}

}  // namespace

AsYouTypeFormatter::AsYouTypeFormatter(const string& region_code)
    :{}

// The metadata needed by this class is the same for all regions sharing the
// same country calling code. Therefore, we return the metadata for "main"
// region for this country calling 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) {}

// Returns the number of bytes contained in the given UnicodeString up to the
// specified position.
// static
int AsYouTypeFormatter::ConvertUnicodeStringPosition(const UnicodeString& s,
                                                     int pos) {}

}  // namespace phonenumbers
}  // namespace i18n