chromium/components/autofill/core/browser/data_model/autofill_i18n_api.cc

// Copyright 2023 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/data_model/autofill_i18n_api.h"

#include <memory>
#include <string>

#include "base/containers/contains.h"
#include "base/containers/flat_map.h"
#include "base/feature_list.h"
#include "base/notreached.h"
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/browser/country_type.h"
#include "components/autofill/core/browser/data_model/autofill_i18n_formatting_expressions.h"
#include "components/autofill/core/browser/data_model/autofill_i18n_hierarchies.h"
#include "components/autofill/core/browser/data_model/autofill_i18n_parsing_expressions.h"
#include "components/autofill/core/browser/data_model/autofill_i18n_stopwords.h"
#include "components/autofill/core/browser/data_model/autofill_structured_address.h"
#include "components/autofill/core/browser/data_model/autofill_structured_address_component.h"
#include "components/autofill/core/browser/data_model/autofill_structured_address_format_provider.h"
#include "components/autofill/core/browser/data_model/autofill_structured_address_name.h"
#include "components/autofill/core/browser/data_model/autofill_structured_address_utils.h"
#include "components/autofill/core/browser/data_model/autofill_synthesized_address_component.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/common/autofill_features.h"

namespace autofill::i18n_model_definition {

namespace {
kAutofillFormattingRulesMap;
kAutofillModelRules;
kAutofillModelStopwords;
kAutofillParsingRulesMap;

// Adjacency mapping, stores for each field type X the list of field types
// which are children of X.
TreeDefinition;

TreeEdgesList;

// Address lines are currently the only computed types. These are are shared by
// all countries.
constexpr FieldTypeSet kAddressComputedTypes =;

std::u16string GetFormattingExpressionOverrides(
    FieldType field_type,
    AddressCountryCode country_code) {}

// Returns an instance of the `AddressComponent` implementation that matches
// the corresponding FieldType if exists. Otherwise, returns a default
// `AddressComponent`.
// Note that nodes do not own their children, rather pointers to them. All
// `AddressComponent` nodes are owned by the `AddressComponentsStore`.
std::unique_ptr<AddressComponent> BuildTreeNode(
    autofill::FieldType type,
    std::vector<AddressComponent*> children) {}

std::unique_ptr<SynthesizedAddressComponent> BuildSynthesizedNode(
    FieldType type,
    const TreeDefinition& tree_def,
    const base::flat_map<FieldType, std::unique_ptr<AddressComponent>>&
        nodes_registry) {}

AddressComponent* BuildSubTree(
    const TreeDefinition& tree_def,
    FieldType root,
    AddressCountryCode country_code,
    base::flat_map<FieldType, std::unique_ptr<AddressComponent>>&
        nodes_registry) {}

TreeEdgesList GetTreeEdges(AddressCountryCode country_code) {}

}  // namespace

AddressComponentsStore CreateAddressComponentModel(
    AddressCountryCode country_code) {}

bool IsSynthesizedType(FieldType field_type, AddressCountryCode country_code) {}

std::u16string GetFormattingExpression(FieldType field_type,
                                       AddressCountryCode country_code) {}

i18n_model_definition::ValueParsingResults ParseValueByI18nRegularExpression(
    std::string_view value,
    FieldType field_type,
    AddressCountryCode country_code) {}

std::optional<std::u16string_view> GetStopwordsExpression(
    FieldType field_type,
    AddressCountryCode country_code) {}

bool IsTypeEnabledForCountry(FieldType field_type,
                             AddressCountryCode country_code) {}

bool IsCustomHierarchyAvailableForCountry(AddressCountryCode country_code) {}

}  // namespace autofill::i18n_model_definition