chromium/third_party/libaddressinput/src/cpp/src/validation_task.cc

// Copyright (C) 2014 Google Inc.
//
// 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 "validation_task.h"

#include <libaddressinput/address_data.h>
#include <libaddressinput/address_field.h>
#include <libaddressinput/address_metadata.h>
#include <libaddressinput/address_problem.h>
#include <libaddressinput/address_validator.h>
#include <libaddressinput/callback.h>
#include <libaddressinput/supplier.h>

#include <algorithm>
#include <cassert>
#include <cstddef>
#include <string>

#include <re2/re2.h>

#include "lookup_key.h"
#include "post_box_matchers.h"
#include "rule.h"
#include "util/re2ptr.h"
#include "util/size.h"

namespace i18n {
namespace addressinput {

ValidationTask::ValidationTask(const AddressData& address, bool allow_postal,
                               bool require_name, const FieldProblemMap* filter,
                               FieldProblemMap* problems,
                               const AddressValidator::Callback& validated)
    :{}

ValidationTask::~ValidationTask() = default;

void ValidationTask::Run(Supplier* supplier) {}

void ValidationTask::Validate(bool success,
                              const LookupKey& lookup_key,
                              const Supplier::RuleHierarchy& hierarchy) {}

// A field will return an UNEXPECTED_FIELD problem type if the current value of
// that field is not empty and the field should not be used by that region.
void ValidationTask::CheckUnexpectedField(
    const std::string& region_code) const {}

// A field will return an MISSING_REQUIRED_FIELD problem type if the current
// value of that field is empty and the field is required by that region.
void ValidationTask::CheckMissingRequiredField(
    const std::string& region_code) const {}

// A field is UNKNOWN_VALUE if the metadata contains a list of possible values
// for the field and the address data server could not match the current value
// of that field to one of those possible values, therefore returning nullptr.
void ValidationTask::CheckUnknownValue(
    const Supplier::RuleHierarchy& hierarchy) const {}

void ValidationTask::CheckUnsupportedField() const {}

// Note that it is assumed that CheckUnexpectedField has already been called.
void ValidationTask::CheckPostalCodeFormatAndValue(
    const Supplier::RuleHierarchy& hierarchy) const {}

void ValidationTask::CheckUsesPoBox(
    const Supplier::RuleHierarchy& hierarchy) const {}

void ValidationTask::ReportProblem(AddressField field,
                                   AddressProblem problem) const {}

void ValidationTask::ReportProblemMaybe(AddressField field,
                                        AddressProblem problem) const {}

bool ValidationTask::ShouldReport(AddressField field,
                                  AddressProblem problem) const {}

}  // namespace addressinput
}  // namespace i18n