#include "components/optimization_guide/core/model_execution/substitution.h"
#include <sys/types.h>
#include <optional>
#include <sstream>
#include <string>
#include <vector>
#include "base/debug/dump_without_crashing.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "components/optimization_guide/core/model_execution/on_device_model_execution_proto_descriptors.h"
#include "components/optimization_guide/core/model_execution/on_device_model_execution_proto_value_utils.h"
#include "components/optimization_guide/proto/descriptors.pb.h"
#include "components/optimization_guide/proto/substitution.pb.h"
namespace optimization_guide {
namespace {
RepeatedPtrField;
struct ResolutionContext { … };
bool EvaluateCondition(const ResolutionContext& ctx,
const proto::Condition& condition) { … }
bool AndConditions(const ResolutionContext& ctx,
const RepeatedPtrField<proto::Condition>& conditions) { … }
bool OrConditions(const ResolutionContext& ctx,
const RepeatedPtrField<proto::Condition>& conditions) { … }
bool DoConditionsApply(const ResolutionContext& ctx,
const proto::ConditionList& conditions) { … }
class StringBuilder { … };
StringBuilder::Error StringBuilder::ResolveProtoField(
const ResolutionContext& ctx,
const proto::ProtoField& field) { … }
StringBuilder::Error StringBuilder::ResolveRangeExpr(
const ResolutionContext& ctx,
const proto::RangeExpr& expr) { … }
StringBuilder::Error StringBuilder::ResolveIndexExpr(
const ResolutionContext& ctx,
const proto::IndexExpr& expr) { … }
StringBuilder::Error StringBuilder::ResolveStringArg(
const ResolutionContext& ctx,
const proto::StringArg& candidate) { … }
StringBuilder::Error StringBuilder::ResolveSubstitution(
const ResolutionContext& ctx,
const proto::StringSubstitution& arg) { … }
StringBuilder::Error StringBuilder::ResolveSubstitutedString(
const ResolutionContext& ctx,
const proto::SubstitutedString& substitution) { … }
}
std::optional<SubstitutionResult> CreateSubstitutions(
const google::protobuf::MessageLite& request,
const google::protobuf::RepeatedPtrField<proto::SubstitutedString>&
config_substitutions) { … }
}