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

Requires a given Requirement to fail. More...

#include <NotRequirement.h>

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

Public Member Functions

 NotRequirement ()
 Constructor.
 
virtual void ClearErrors () override
 Clear list of error messages.
 
virtual void ClearNotices () override
 Clear list of notices.
 
virtual void Reset () override
 Reset Requirement.
 
virtual void Parse (Value json, const std::string &path) override
 Parse JSON value and generate Requirement to be negated. More...
 
virtual void Validate (const Value &json, const std::string &path) override
 Validate that JSON value fails the given Requirement. 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

std::unique_ptr< Requirementreq_
 Requirement to negate.
 

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 a given Requirement to fail.

Definition at line 37 of file NotRequirement.h.

Member Function Documentation

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

Parse JSON value and generate Requirement to be negated.

Parameters
jsonJSON input value.
pathPath for JSON path specification.

Implements Json::Requirement.

Definition at line 78 of file NotRequirement.h.

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

79  {
80  Reset();
81  RequirementLoader loader;
82 
83  auto& head = json.isMember("not") ? json["not"] : json;
84  if((req_ = loader.LoadRequirement(head)))
85  req_->Parse(head, path);
86  }
virtual void Reset() override
Reset Requirement.
std::unique_ptr< Requirement > req_
Requirement to negate.

Here is the call graph for this function:

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

Validate that JSON value fails the given Requirement.

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

Calls validate on the Requirement to be negated and checks if it has an error. If it has not, it passed the validation and an error is added to this Requirement.

Implements Json::Requirement.

Definition at line 97 of file NotRequirement.h.

References Json::Requirement::PushError().

98  {
99  req_->Validate(json, path);
100  if(!req_->HasErrors())
101  PushError(path + ": Value must not validate against requirement.");
102  }
void PushError(const std::string &error)
Add error to list of error messages.
Definition: Requirement.h:53
std::unique_ptr< Requirement > req_
Requirement to negate.

Here is the call graph for this function:


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