28 #include "Requirement.h"
75 virtual void Parse(Value json,
const std::string& path)
override
80 if(json.isMember(
"multipleOf") && json[
"multipleOf"].isInt())
86 if(json.isMember(
"minimum") && json[
"minimum"].isInt())
89 min_ = json[
"minimum"].asInt();
92 if(json.isMember(
"maximum") && json[
"maximum"].isInt())
95 max_ = json[
"maximum"].asInt();
98 if(json.isMember(
"exclusiveMinimum") && json[
"exclusiveMinimum"].isBool())
100 exclMin_ = json[
"exclusiveMinimum"].asBool();
103 if(json.isMember(
"exclusiveMaximum") && json[
"exclusiveMaximum"].isBool())
105 exclMax_ = json[
"exclusiveMaximum"].asBool();
118 virtual void Validate(
const Value& json,
const std::string& path)
override
122 PushError(path +
": Must be of type \"integer\".");
132 PushError(path +
": Value must be greater than " + std::to_string(
min_));
133 else if(json.asInt() <
min_)
134 PushError(path +
": Value cannot be less than " + std::to_string(
min_));
140 PushError(path +
": Value must be less than " + std::to_string(
max_));
141 else if(json.asInt() >
max_)
142 PushError(path +
": Value cannot be greater than " + std::to_string(
max_));
Requirements on Integer values.
bool exclMin_
If True lower bound is exclusive.
bool maxSet_
If True upper bound is an active requirement.
virtual void Validate(const Value &json, const std::string &path) override
Validate JSON value.
bool exclMax_
If True upper bound is exclusive.
IntegerRequirement()
Constructor.
virtual void Reset() override
Reset requirement.
int min_
Lower bound for range requirement.
bool multSet_
If True multiple of is a requirement.
bool minSet_
If True lower bound is an active requirement.
virtual void Parse(Value json, const std::string &path) override
Parse JSON value to set up Requirement.
int max_
Upper bound for range requirement.
std::string path_
Path for JSON path specification.
int multipleOf_
Multiple of requirement.
Requirements on input files.
virtual void ClearNotices()
Clear list of notice messages.
virtual void ClearErrors()
Clear list of error messages.
void PushError(const std::string &error)
Add error to list of error messages.