#include "components/optimization_guide/core/model_execution/redactor.h"
#include <algorithm>
#include "base/containers/heap_array.h"
#include "base/debug/dump_without_crashing.h"
#include "base/memory/ptr_util.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "components/optimization_guide/proto/redaction.pb.h"
#include "third_party/re2/src/re2/re2.h"
namespace optimization_guide {
Redactor::Rule::Rule(std::unique_ptr<re2::RE2> re,
Redactor::Behavior behavior,
std::string replacement_string,
int matching_group,
size_t min_pattern_length,
size_t max_pattern_length)
: … { … }
Redactor::Rule::Rule(Rule&& r) = default;
Redactor::Rule::~Rule() = default;
Redactor::Redactor(std::vector<Rule>&& rules) { … }
Redactor::~Redactor() = default;
Redactor Redactor::FromProto(const proto::RedactRules& proto_rules) { … }
RedactResult Redactor::Redact(const std::string& input,
std::string& output) const { … }
RedactResult Redactor::Rule::Process(const std::string& input,
std::string& output) const { … }
std::string Redactor::Rule::GetReplacementString(std::string_view match) const { … }
bool Redactor::Rule::IsValidMatch(const std::string_view& match) const { … }
}