#ifndef TOOLS_JSON_SCHEMA_COMPILER_MANIFEST_PARSE_UTIL_H_
#define TOOLS_JSON_SCHEMA_COMPILER_MANIFEST_PARSE_UTIL_H_
#include <string>
#include <string_view>
#include <vector>
#include "base/check.h"
#include "base/values.h"
#include "tools/json_schema_compiler/util.h"
namespace json_schema_compiler {
namespace manifest_parse_util {
void PopulateInvalidEnumValueError(
std::string_view key,
std::string_view value,
std::u16string& error,
std::vector<std::string_view>& error_path_reversed);
void PopulateInvalidChoiceValueError(
std::string_view key,
std::u16string& error,
std::vector<std::string_view>& error_path_reversed);
void PopulateKeyIsRequiredError(
std::string_view key,
std::u16string& error,
std::vector<std::string_view>& error_path_reversed);
std::u16string GetArrayParseError(size_t error_index,
const std::u16string& item_error);
void PopulateFinalError(std::u16string& error,
std::vector<std::string_view>& error_path_reversed);
const base::Value* FindKeyOfType(
const base::Value::Dict& dict,
std::string_view key,
base::Value::Type expected_type,
std::u16string& error,
std::vector<std::string_view>& error_path_reversed);
bool ParseFromDictionary(const base::Value::Dict& dict,
std::string_view key,
int& out,
std::u16string& error,
std::vector<std::string_view>& error_path_reversed);
bool ParseFromDictionary(const base::Value::Dict& dict,
std::string_view key,
bool& out,
std::u16string& error,
std::vector<std::string_view>& error_path_reversed);
bool ParseFromDictionary(const base::Value::Dict& dict,
std::string_view key,
double& out,
std::u16string& error,
std::vector<std::string_view>& error_path_reversed);
bool ParseFromDictionary(const base::Value::Dict& dict,
std::string_view key,
std::string& out,
std::u16string& error,
std::vector<std::string_view>& error_path_reversed);
template <typename T>
bool ParseFromDictionary(const base::Value::Dict& dict,
std::string_view key,
std::vector<T>& out,
std::u16string& error,
std::vector<std::string_view>& error_path_reversed);
template <typename T>
bool ParseFromDictionary(const base::Value::Dict& dict,
std::string_view key,
std::unique_ptr<T>& out,
std::u16string& error,
std::vector<std::string_view>& error_path_reversed);
template <typename T>
bool ParseFromDictionary(const base::Value::Dict& dict,
std::string_view key,
std::optional<T>& out_opt,
std::u16string& error,
std::vector<std::string_view>& error_path_reversed);
template <typename T>
bool ParseFromDictionary(const base::Value::Dict& dict,
std::string_view key,
T& out,
std::u16string& error,
std::vector<std::string_view>& error_path_reversed) { … }
template <typename T>
bool ParseFromDictionary(const base::Value::Dict& dict,
std::string_view key,
std::vector<T>& out,
std::u16string& error,
std::vector<std::string_view>& error_path_reversed) { … }
template <typename T>
bool ParseFromDictionary(const base::Value::Dict& dict,
std::string_view key,
std::unique_ptr<T>& out,
std::u16string& error,
std::vector<std::string_view>& error_path_reversed) { … }
template <typename T>
bool ParseFromDictionary(const base::Value::Dict& dict,
std::string_view key,
std::optional<T>& out_opt,
std::u16string& error,
std::vector<std::string_view>& error_path_reversed) { … }
StringToEnumConverter;
template <typename T>
bool ParseEnumFromDictionary(
const base::Value::Dict& dict,
std::string_view key,
StringToEnumConverter<T> converter,
bool is_optional_property,
T none_value,
T& out,
std::u16string& error,
std::vector<std::string_view>& error_path_reversed) { … }
template <typename T>
bool ParseEnumArrayFromDictionary(
const base::Value::Dict& dict,
std::string_view key,
StringToEnumConverter<T> converter,
T none_value,
std::vector<T>& out,
std::u16string& error,
std::vector<std::string_view>& error_path_reversed) { … }
template <typename T>
bool ParseEnumArrayFromDictionary(
const base::Value::Dict& dict,
std::string_view key,
StringToEnumConverter<T> converter,
T none_value,
std::optional<std::vector<T>>& out,
std::u16string& error,
std::vector<std::string_view>& error_path_reversed) { … }
template <typename T>
bool ParseChoicesFromDictionary(
const base::Value::Dict& dict,
std::string_view key,
T& out,
std::u16string& error,
std::vector<std::string_view>& error_path_reversed) { … }
}
}
#endif