SSAGES  0.9.3
Software Suite for Advanced General Ensemble Simulations
Public Member Functions | Private Attributes | List of all members
Json::AllOfRequirement Class Reference

Requires that all of a list of Requirements hold. More...

#include <AllOfRequirement.h>

Inheritance diagram for Json::AllOfRequirement:
Inheritance graph
[legend]

Public Member Functions

 AllOfRequirement ()
 Constructor.
 
virtual void ClearErrors () override
 Clear lists of errors for all Requirements.
 
virtual void ClearNotices () override
 Clear lists of notices for all Requirements.
 
virtual void Reset () override
 Reset all Requirements.
 
virtual void Parse (Value json, const std::string &path) override
 Parse JSON value and add all loaded Requirements. More...
 
virtual void Validate (const Value &json, const std::string &path) override
 Validate that all Requirements are met. More...
 
- Public Member Functions inherited from Json::Requirement
bool HasErrors ()
 Check if errors have occured. More...
 
std::vector< std::string > GetErrors ()
 Get list of error messages. More...
 
virtual bool HasNotices ()
 Check if notices have been queued. More...
 
std::vector< std::string > GetNotices ()
 Get list of notices. More...
 
virtual ~Requirement ()
 Destructor.
 

Private Attributes

RequireList reqs_
 List of Requirements.
 

Additional Inherited Members

- Protected Member Functions inherited from Json::Requirement
void PushError (const std::string &error)
 Add error to list of error messages. More...
 
void PushNotice (const std::string &notice)
 Add message to list of notices. More...
 

Detailed Description

Requires that all of a list of Requirements hold.

Definition at line 38 of file AllOfRequirement.h.

Member Function Documentation

◆ Parse()

virtual void Json::AllOfRequirement::Parse ( Value  json,
const std::string &  path 
)
inlineoverridevirtual

Parse JSON value and add all loaded Requirements.

Parameters
jsonJSON input value.
pathPath for JSON path specification.

This function parses a JSON value and adds all Requirements that are in the "allOf" branch to the list of Requirements.

Implements Json::Requirement.

Definition at line 81 of file AllOfRequirement.h.

82  {
83  Reset();
84  RequirementLoader loader;
85 
86  auto& head = json.isMember("allOf") ? json["allOf"] : json;
87 
88  for(auto& val : head)
89  if(auto req = loader.LoadRequirement(val))
90  {
91  reqs_.push_back(std::move(req));
92  reqs_.back()->Parse(val, path);
93  }
94 
95  }
virtual void Reset() override
Reset all Requirements.
RequireList reqs_
List of Requirements.

References Json::RequirementLoader::LoadRequirement(), reqs_, and Reset().

Here is the call graph for this function:

◆ Validate()

virtual void Json::AllOfRequirement::Validate ( const Value &  json,
const std::string &  path 
)
inlineoverridevirtual

Validate that all Requirements are met.

Parameters
jsonJSON value to validate.
pathPath for JSON path specification.

Implements Json::Requirement.

Definition at line 102 of file AllOfRequirement.h.

103  {
104  for(auto& r : reqs_)
105  {
106  r->Validate(json, path);
107 
108  if(r->HasErrors())
109  for(const auto& error : r->GetErrors())
110  PushError(error);
111 
112  if(r->HasNotices())
113  for(const auto& notice : r->GetNotices())
114  PushNotice(notice);
115  }
116  }
void PushNotice(const std::string &notice)
Add message to list of notices.
Definition: Requirement.h:62
void PushError(const std::string &error)
Add error to list of error messages.
Definition: Requirement.h:53

References Json::Requirement::PushError(), Json::Requirement::PushNotice(), and reqs_.

Here is the call graph for this function:

The documentation for this class was generated from the following file: