1#ifndef SOURCEMETA_BLAZE_EVALUATOR_VALUE_H
2#define SOURCEMETA_BLAZE_EVALUATOR_VALUE_H
4#include <sourcemeta/core/json.h>
5#include <sourcemeta/core/jsonpointer.h>
6#include <sourcemeta/core/regex.h>
12#include <unordered_set>
16namespace sourcemeta::blaze {
21 [[nodiscard]]
auto to_json()
const -> sourcemeta::core::JSON {
22 return sourcemeta::core::JSON{
nullptr};
25 static auto from_json(
const sourcemeta::core::JSON &)
26 -> std::optional<ValueNone> {
38 std::unordered_set<sourcemeta::core::JSON,
39 sourcemeta::core::HashJSON<sourcemeta::core::JSON>>;
48 std::pair<ValueString, sourcemeta::core::JSON::Object::hash_type>;
74 using first_type = sourcemeta::core::Regex;
78 [[nodiscard]]
auto to_json()
const -> sourcemeta::core::JSON {
79 return sourcemeta::core::to_json(this->second);
82 static auto from_json(
const sourcemeta::core::JSON &value)
83 -> std::optional<ValueRegex> {
84 if (!value.is_string()) {
88 auto string{value.to_string()};
89 auto regex{sourcemeta::core::to_regex(
string)};
90 if (!regex.has_value()) {
95 return ValueRegex{std::move(regex).value(), std::move(
string)};
107using ValueRange = std::tuple<std::size_t, std::optional<std::size_t>,
bool>;
149 std::tuple<ValueStringSet, ValueStrings, std::vector<ValueRegex>>;
172 std::pair<std::vector<ValueNamedIndex>, std::vector<ValueIndexPair>>;
181 std::pair<std::vector<std::pair<ValueStringSet::hash_type, ValueString>>,
182 std::vector<ValueIndexPair>>;
203 std::tuple<ValueString, sourcemeta::core::JSON::Object::hash_type, bool>>;
std::pair< std::vector< std::pair< ValueStringSet::hash_type, ValueString > >, std::vector< ValueIndexPair > > ValueStringHashes
Definition evaluator_value.h:180
sourcemeta::core::JSON::Type ValueType
Definition evaluator_value.h:64
std::vector< ValueString > ValueStrings
Definition evaluator_value.h:52
sourcemeta::core::JSON::String ValueString
Definition evaluator_value.h:43
std::pair< ValueTypes, ValueRange > ValueTypesWithSize
Definition evaluator_value.h:198
sourcemeta::core::JSONPropertySet ValueStringSet
Definition evaluator_value.h:56
sourcemeta::core::Pointer ValuePointer
Definition evaluator_value.h:157
std::tuple< ValueStringSet, ValueStrings, std::vector< ValueRegex > > ValuePropertyFilter
Definition evaluator_value.h:148
sourcemeta::core::JSON ValueJSON
Definition evaluator_value.h:33
std::tuple< sourcemeta::core::JSON::Object::hash_type, ValueUnsignedInteger, ValueString > ValueNamedIndex
Definition evaluator_value.h:163
std::vector< std::tuple< ValueString, sourcemeta::core::JSON::Object::hash_type, bool > > ValueObjectProperties
Definition evaluator_value.h:202
std::pair< ValueType, ValueStringSet > ValueTypedProperties
Definition evaluator_value.h:176
std::pair< ValueType, ValueStringHashes > ValueTypedHashes
Definition evaluator_value.h:186
sourcemeta::core::JSON::TypeSet ValueTypes
Definition evaluator_value.h:60
std::pair< ValueIntegerBounds, ValueRange > ValueIntegerBoundsWithSize
Definition evaluator_value.h:194
std::pair< std::vector< ValueNamedIndex >, std::vector< ValueIndexPair > > ValueNamedIndexes
Definition evaluator_value.h:171
bool ValueBoolean
Definition evaluator_value.h:111
std::pair< std::size_t, std::size_t > ValueIndexPair
Definition evaluator_value.h:153
std::size_t ValueUnsignedInteger
Definition evaluator_value.h:101
std::pair< ValueString, sourcemeta::core::JSON::Object::hash_type > ValueProperty
Definition evaluator_value.h:47
std::tuple< std::size_t, std::optional< std::size_t >, bool > ValueRange
Definition evaluator_value.h:107
std::pair< std::int64_t, std::int64_t > ValueIntegerBounds
Definition evaluator_value.h:190
sourcemeta::core::JSONObject< ValueString, ValueStrings, sourcemeta::core::PropertyHashJSON< ValueString > > ValueStringMap
Definition evaluator_value.h:142
ValueNumberType
Definition evaluator_value.h:207
ValueStringType
Definition evaluator_value.h:115
std::unordered_set< sourcemeta::core::JSON, sourcemeta::core::HashJSON< sourcemeta::core::JSON > > ValueSet
Definition evaluator_value.h:37