chromium/components/autofill/core/browser/geo/phone_number_i18n.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/autofill/core/browser/geo/phone_number_i18n.h"

#include <memory>
#include <string_view>
#include <utility>

#include "base/check_op.h"
#include "base/notreached.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/browser/autofill_data_util.h"
#include "components/autofill/core/browser/data_model/autofill_profile.h"
#include "components/autofill/core/browser/geo/autofill_country.h"
#include "third_party/libphonenumber/phonenumber_api.h"

namespace autofill {

namespace {

PhoneNumberUtil;

// Formats the |phone_number| to the specified |format|. Returns the original
// number if the operation is not possible.
std::string FormatPhoneNumber(const std::string& phone_number,
                              const std::string& country_code,
                              PhoneNumberUtil::PhoneNumberFormat format) {}

std::string SanitizeRegion(const std::string& region,
                           const std::string& app_locale) {}

// Formats the given |number| as a human-readable string, and writes the result
// into |formatted_number|.  Also, normalizes the formatted number, and writes
// that result into |normalized_number|.  This function should only be called
// with numbers already known to be valid, i.e. validation should be done prior
// to calling this function.  Note that the |country_code|, which determines
// whether to format in the national or in the international format, is passed
// in explicitly, as |number| might have an implicit country code set, even
// though the original input lacked a country code.
void FormatValidatedNumber(const ::i18n::phonenumbers::PhoneNumber& number,
                           const std::u16string& country_code,
                           std::u16string* formatted_number,
                           std::u16string* normalized_number) {}

// Returns false iff |str| contains any characters from the range 0-31
// (inclusive) or the "delete" character (127). This allows the characters in
// 128-255 because |str| is assumed to be in UTF-8. Note that for all
// multi-byte UTF-8 characters, every byte has its most significant bit set
// (i.e., is in the range 128-255, inclusive), so all bytes <=127 are
// single-byte characters.
bool IsPrintable(std::string_view str) {}

}  // namespace

namespace i18n {

const size_t kMaxPhoneNumberSize =;

// Returns true if |phone_number| is a possible number.
bool IsPossiblePhoneNumber(
    const ::i18n::phonenumbers::PhoneNumber& phone_number) {}

bool IsPossiblePhoneNumber(const std::string& phone_number,
                           const std::string& country_code) {}

bool IsValidPhoneNumber(const std::string& phone_number,
                        const std::string& country_code) {}

// Parses the number stored in |value| as it should be interpreted in the given
// |default_region|, and stores the results into the remaining arguments.
// The |default_region| should be sanitized prior to calling this function.
bool ParsePhoneNumber(const std::u16string& value,
                      const std::string& default_region,
                      std::u16string* country_code,
                      std::u16string* city_code,
                      std::u16string* number,
                      std::string* inferred_region,
                      ::i18n::phonenumbers::PhoneNumber* i18n_number) {}

std::u16string NormalizePhoneNumber(const std::u16string& value,
                                    const std::string& region) {}

bool ConstructPhoneNumber(const std::u16string& input_whole_number,
                          const std::string& region,
                          std::u16string* output_whole_number) {}

bool PhoneNumbersMatch(const std::u16string& number_a,
                       const std::u16string& number_b,
                       const std::string& raw_region,
                       const std::string& app_locale) {}

std::u16string GetFormattedPhoneNumberForDisplay(const AutofillProfile& profile,
                                                 const std::string& locale) {}

std::string FormatPhoneNationallyForDisplay(const std::string& phone_number,
                                            const std::string& country_code) {}

std::string FormatPhoneForDisplay(const std::string& phone_number,
                                  const std::string& country_code) {}

std::string FormatPhoneForResponse(const std::string& phone_number,
                                   const std::string& country_code) {}

PhoneObject::PhoneObject(const std::u16string& number,
                         const std::string& region,
                         bool infer_country_code) {}

PhoneObject::PhoneObject(const PhoneObject& other) {}

PhoneObject::PhoneObject() = default;

PhoneObject::~PhoneObject() = default;

const std::u16string& PhoneObject::GetFormattedNumber() const {}

std::u16string PhoneObject::GetNationallyFormattedNumber() const {}

const std::u16string& PhoneObject::GetWholeNumber() const {}

PhoneObject& PhoneObject::operator=(const PhoneObject& other) {}

}  // namespace i18n
}  // namespace autofill