#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_DATA_MODEL_AUTOFILL_STRUCTURED_ADDRESS_UTILS_H_
#define COMPONENTS_AUTOFILL_CORE_BROWSER_DATA_MODEL_AUTOFILL_STRUCTURED_ADDRESS_UTILS_H_
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
#include "base/containers/flat_map.h"
#include "base/no_destructor.h"
#include "base/synchronization/lock.h"
#include "components/autofill/core/browser/autofill_type.h"
#include "components/autofill/core/browser/country_type.h"
#include "components/autofill/core/browser/data_model/autofill_structured_address_constants.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/geo/address_rewriter.h"
#include "third_party/re2/src/re2/re2.h"
namespace autofill {
struct AddressToken { … };
enum class RegEx;
enum class MatchQuantifier { … };
enum class SortedTokenComparisonStatus { … };
struct SortedTokenComparisonResult { … };
struct CaptureOptions { … };
class Re2RegExCache { … };
bool HasCjkNameCharacteristics(const std::string& name);
bool HasHispanicLatinxNameCharacteristics(const std::string& name);
bool HasMiddleNameInitialsCharacteristics(const std::string& middle_name);
std::u16string ReduceToInitials(const std::u16string& value);
std::optional<base::flat_map<std::string, std::string>>
ParseValueByRegularExpression(const std::string& value, const RE2* regex);
std::optional<base::flat_map<std::string, std::string>>
ParseValueByRegularExpression(const std::string& value,
const std::string& pattern);
std::unique_ptr<const RE2> BuildRegExFromPattern(std::string_view pattern);
bool IsPartialMatch(const std::string& value, RegEx regex);
bool IsPartialMatch(const std::string& value, const std::string& pattern);
bool IsPartialMatch(const std::string& value, const RE2* expression);
std::vector<std::string> GetAllPartialMatches(const std::string& value,
const std::string& pattern);
std::vector<std::string> ExtractAllPlaceholders(const std::string& value);
std::string GetPlaceholderToken(std::string_view value);
std::string CaptureTypeWithPattern(
const FieldType& type,
std::initializer_list<std::string_view> pattern_span_initializer_list,
const CaptureOptions& options);
std::string CaptureTypeWithPattern(
const FieldType& type,
std::initializer_list<std::string_view> pattern_span_initializer_list);
std::string NoCapturePattern(const std::string& pattern,
const CaptureOptions& options = CaptureOptions());
std::string CaptureTypeWithAffixedPattern(
const FieldType& type,
const std::string& prefix_pattern,
const std::string& pattern,
const std::string& suffix_pattern,
const CaptureOptions& options = CaptureOptions());
std::string CaptureTypeWithPrefixedPattern(
const FieldType& type,
const std::string& prefix_pattern,
const std::string& pattern,
const CaptureOptions& options = CaptureOptions());
std::string CaptureTypeWithSuffixedPattern(
const FieldType& type,
const std::string& pattern,
const std::string& suffix_pattern,
const CaptureOptions& options = CaptureOptions());
std::string CaptureTypeWithPattern(
const FieldType& type,
const std::string& pattern,
const CaptureOptions options = CaptureOptions());
std::u16string NormalizeAndRewrite(const AddressCountryCode& country_code,
const std::u16string& text,
bool keep_white_space);
std::u16string NormalizeValue(std::u16string_view value,
bool keep_white_space = true);
bool AreSortedTokensEqual(const std::vector<AddressToken>& first,
const std::vector<AddressToken>& second);
bool AreStringTokenEquivalent(const std::u16string& one,
const std::u16string& other);
bool AreStringTokenCompatible(const std::u16string& first,
const std::u16string& second);
std::vector<AddressToken> TokenizeValue(const std::u16string value);
SortedTokenComparisonResult CompareSortedTokens(
const std::vector<AddressToken>& first,
const std::vector<AddressToken>& second);
SortedTokenComparisonResult CompareSortedTokens(const std::u16string& first,
const std::u16string& second);
}
#endif