28 #include "Requirement.h"
40 std::map<std::string, std::vector<std::string>>
deps_;
61 virtual void Parse(Value json,
const std::string&)
override
65 auto names = json.getMemberNames();
67 for(
auto& value : json)
72 for(
auto& dep : value)
74 deps_[names[i]].push_back(dep.asString());
86 virtual void Validate(
const Value& json,
const std::string& path)
override
90 PushError(path +
": Dependency specified for non-object");
94 for(
auto& dep :
deps_)
96 auto& name = dep.first;
97 if(json.isMember(name))
98 for(
const auto& val : dep.second)
99 if(!json.isMember(val))
100 PushError(path +
": \"" + name +
"\" depends on \"" + val +
"\"");
Requires dependencies to be met.
virtual void Parse(Value json, const std::string &) override
Parse JSON input value.
virtual void Validate(const Value &json, const std::string &path) override
Validate that Requirement is met.
virtual void Reset() override
Reset Requirement.
DependencyRequirement()
Constructor.
~DependencyRequirement()
Destructor.
std::map< std::string, std::vector< std::string > > deps_
Set of dependencies.
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.