#include "components/autofill/core/browser/data_model/autofill_structured_address_component.h"
#include <algorithm>
#include <map>
#include <string>
#include <utility>
#include "base/feature_list.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/strings/strcat.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/browser/autofill_type.h"
#include "components/autofill/core/browser/data_model/autofill_i18n_api.h"
#include "components/autofill/core/browser/data_model/autofill_structured_address_format_provider.h"
#include "components/autofill/core/browser/data_model/autofill_structured_address_utils.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/common/autofill_features.h"
namespace autofill {
bool IsLessSignificantVerificationStatus(VerificationStatus left,
VerificationStatus right) { … }
VerificationStatus GetMoreSignificantVerificationStatus(
VerificationStatus left,
VerificationStatus right) { … }
std::ostream& operator<<(std::ostream& os, VerificationStatus status) { … }
AddressComponent::AddressComponent(FieldType storage_type,
SubcomponentsList subcomponents,
unsigned int merge_mode)
: … { … }
AddressComponent::~AddressComponent() = default;
FieldType AddressComponent::GetStorageType() const { … }
FieldType AddressComponent::GetFallbackType(FieldType field_type) const { … }
std::string AddressComponent::GetStorageTypeName() const { … }
void AddressComponent::CopyFrom(const AddressComponent& other) { … }
bool AddressComponent::SameAs(const AddressComponent& other) const { … }
bool AddressComponent::IsAtomic() const { … }
bool AddressComponent::IsValueValid() const { … }
AddressCountryCode AddressComponent::GetCommonCountry(
const AddressComponent& other) const { … }
AddressCountryCode AddressComponent::GetCountryCode() const { … }
bool AddressComponent::IsValueForTypeValid(FieldType field_type,
bool wipe_if_not) { … }
void AddressComponent::RegisterChildNode(AddressComponent* child,
bool set_as_parent_of_child) { … }
VerificationStatus AddressComponent::GetVerificationStatus() const { … }
const std::u16string& AddressComponent::GetValue() const { … }
std::optional<std::u16string> AddressComponent::GetCanonicalizedValue() const { … }
bool AddressComponent::IsValueAssigned() const { … }
void AddressComponent::SetValue(std::u16string value,
VerificationStatus status) { … }
void AddressComponent::UnsetValue() { … }
bool AddressComponent::IsSupportedType(FieldType field_type) const { … }
bool AddressComponent::IsValueReadOnly() const { … }
void AddressComponent::GetSupportedTypes(FieldTypeSet* supported_types) const { … }
void AddressComponent::GetStorableTypes(FieldTypeSet* supported_types) const { … }
void AddressComponent::GetTypes(bool storable_only,
FieldTypeSet* supported_types) const { … }
std::optional<FieldType> AddressComponent::GetStorableTypeOf(
FieldType type) const { … }
const FieldTypeSet AddressComponent::GetAdditionalSupportedFieldTypes() const { … }
void AddressComponent::SetValueForOtherSupportedType(
FieldType field_type,
const std::u16string& value,
const VerificationStatus& status) { … }
std::u16string AddressComponent::GetValueForOtherSupportedType(
FieldType field_type) const { … }
std::u16string AddressComponent::GetFormatString() const { … }
std::vector<FieldType> AddressComponent::GetSubcomponentTypes() const { … }
bool AddressComponent::SetValueForType(
FieldType field_type,
const std::u16string& value,
const VerificationStatus& verification_status) { … }
bool AddressComponent::SetValueForTypeAndResetSubstructure(
FieldType field_type,
const std::u16string& value,
const VerificationStatus& verification_status) { … }
void AddressComponent::UnsetAddressComponentAndItsSubcomponents() { … }
void AddressComponent::UnsetSubcomponents() { … }
void AddressComponent::FillTreeGaps() { … }
const AddressComponent* AddressComponent::GetNodeForType(
FieldType field_type) const { … }
AddressComponent* AddressComponent::GetNodeForType(FieldType field_type) { … }
std::u16string AddressComponent::GetValueForType(FieldType field_type) const { … }
std::u16string AddressComponent::GetValueForComparisonForType(
FieldType field_type,
const AddressComponent& other) const { … }
VerificationStatus AddressComponent::GetVerificationStatusForType(
FieldType field_type) const { … }
FieldType AddressComponent::GetFallbackTypeForType(FieldType field_type) const { … }
bool AddressComponent::UnsetValueForTypeIfSupported(FieldType field_type) { … }
std::vector<const re2::RE2*>
AddressComponent::GetParseRegularExpressionsByRelevance() const { … }
void AddressComponent::ParseValueAndAssignSubcomponents() { … }
bool AddressComponent::ParseValueAndAssignSubcomponentsByI18nParsingRules() { … }
bool AddressComponent::ParseValueAndAssignSubcomponentsByRegularExpressions() { … }
void AddressComponent::
TryParseValueAndAssignSubcomponentsRespectingSetValues() { … }
bool AddressComponent::ParseValueAndAssignSubcomponentsRespectingSetValues(
const std::u16string& value,
const RE2* parse_expression) { … }
bool AddressComponent::IsValueCompatibleWithDescendants(
const std::u16string& value) const { … }
bool AddressComponent::ParseValueAndAssignSubcomponentsByRegularExpression(
const std::u16string& value,
const RE2* parse_expression) { … }
void AddressComponent::ParseValueAndAssignSubcomponentsByFallbackMethod() { … }
void AddressComponent::AssignParsedValuesToSubcomponents(
i18n_model_definition::ValueParsingResults values) { … }
bool AddressComponent::AssignParsedValuesToSubcomponentsRespectingSetValues(
i18n_model_definition::ValueParsingResults values) { … }
bool AddressComponent::AllDescendantsAreEmpty() const { … }
void AddressComponent::WipeRawPtrsForDestruction() { … }
bool AddressComponent::IsValueCompatibleWithAncestors(
const std::u16string& value) const { … }
bool AddressComponent::IsStructureValid() const { … }
bool AddressComponent::WipeInvalidStructure() { … }
std::u16string AddressComponent::GetFormattedValueFromSubcomponents() { … }
void AddressComponent::FormatValueFromSubcomponents() { … }
std::u16string AddressComponent::ReplacePlaceholderTypesWithValues(
std::u16string_view format) const { … }
bool AddressComponent::CompleteFullTree() { … }
void AddressComponent::GenerateTreeSynthesizedNodes() { … }
void AddressComponent::RecursivelyCompleteTree() { … }
int AddressComponent::
MaximumNumberOfAssignedAddressComponentsOnNodeToLeafPaths() const { … }
bool AddressComponent::IsTreeCompletable() { … }
const AddressComponent& AddressComponent::GetRootNode() const { … }
AddressComponent& AddressComponent::GetRootNode() { … }
void AddressComponent::RecursivelyUnsetParsedAndFormattedValues() { … }
void AddressComponent::RecursivelyUnsetSubcomponents() { … }
void AddressComponent::UnsetParsedAndFormattedValuesInEntireTree() { … }
void AddressComponent::MergeVerificationStatuses(
const AddressComponent& newer_component) { … }
void AddressComponent::RegisterSynthesizedSubcomponent(
AddressComponent* synthesized_component) { … }
const std::vector<AddressToken> AddressComponent::GetSortedTokens() const { … }
bool AddressComponent::IsMergeableWithComponent(
const AddressComponent& newer_component) const { … }
bool AddressComponent::MergeWithComponent(
const AddressComponent& newer_component,
bool newer_was_more_recently_used) { … }
bool AddressComponent::HasNewerValuePrecedenceInMerging(
const AddressComponent& newer_component) const { … }
bool AddressComponent::MergeTokenEquivalentComponent(
const AddressComponent& newer_component) { … }
void AddressComponent::ConsumeAdditionalToken(
const std::u16string& token_value) { … }
bool AddressComponent::MergeSubsetComponent(
const AddressComponent& subset_component,
const SortedTokenComparisonResult& token_comparison_result) { … }
int AddressComponent::GetStructureVerificationScore() const { … }
std::u16string AddressComponent::GetNormalizedValue() const { … }
std::u16string AddressComponent::GetValueForComparison(
const AddressComponent& other) const { … }
std::u16string AddressComponent::GetValueForComparison(
const std::u16string& value,
const AddressComponent& other) const { … }
}