Code cleanup branch (#618)

* Make height map fallback layer work again
  * Add documentation to joystick button bindings
  * Removed grouped property headers
  * Add new version number constant generated by CMake
  * Make Joystick deadzone work properly
  * Change the startup date on Earth to today
  * Fix key modifier handling
  * Add debugging indices for TreeNodeDebugging
  * Fix script schedule for OsirisRex
  * Do not open Mission schedule automatically
  * Upload default projection texture automatically

  * General code cleanup
  * Fix check_style_guide warnings
  * Remove .clang-format
  * MacOS compile fixes
  * Clang analyzer fixes
This commit is contained in:
Alexander Bock
2018-06-10 04:47:34 +00:00
committed by GitHub
parent 5de728442d
commit 4952f8f977
796 changed files with 22428 additions and 24063 deletions

View File

@@ -27,7 +27,6 @@
#include <ghoul/misc/boolean.h>
#include <ghoul/misc/exception.h>
#include <memory>
#include <string>
#include <vector>
@@ -108,11 +107,13 @@ struct TestResult {
struct SpecificationError : public ghoul::RuntimeError {
/**
* Creates the SpecificationError exception instance.
* \param result The offending TestResult that is passed on
* \param component The component that initiated the specification test
* \pre \p result%'s TestResult::success must be \c false
*
* \param res The offending TestResult that is passed on
* \param comp The component that initiated the specification test
*
* \pre \p res%'s TestResult::success must be \c false
*/
SpecificationError(TestResult result, std::string component);
SpecificationError(TestResult res, std::string comp);
/// The TestResult that caused the SpecificationError to be thrown
TestResult result;
@@ -141,50 +142,54 @@ struct DocumentationEntry {
static const std::string Wildcard;
/**
* The constructor for a DocumentationEntry describing a \p key in a Documentation.
* The constructor for a DocumentationEntry describing a key \p k in a Documentation.
* The value for the key (or each value in the case of the
* DocumentationEntry::Wildcard) is tested using the \p verifier, that specifies the
* conditions that the \p key%'s value has to fulfill. The textual documentation
* DocumentationEntry::Wildcard) is tested using the verifier \p v, that specifies the
* conditions that the \p k%'s value has to fulfill. The textual documentation
* \p doc shall describe the usage of the key-value pair and will be printed for human
* consumption for example in the DocumentationEngine. Each DocumentationEntry can
* further be \p optional.
* \param key The key for which this DocumentationEntry is valid. If this valid is
* equal to DocumentationEntry::Wildcard, each entry in the Documentation that
* contains this DocumentationEntry will be matched
* \param verifier The Verifier that is used to test the \p key%'s value to determine
* if it is a valid value
* further be \p opt.
*
* \param k The key for which this DocumentationEntry is valid. If this valid is
* equal to DocumentationEntry::Wildcard, each entry in the Documentation that
* contains this DocumentationEntry will be matched
* \param v The Verifier that is used to test the \p k%'s value to determine if it is
* a valid value
* \param doc The textual documentation that describes the DocumentationEntry in a
* human readable format
* \param optional Determines whether the Documentation containing this
* DocumentationEntry must have a key \p key, or whether it is optional
* \pre \p key must not be empty
* \pre \p verifier must not be nullptr
* human readable format
* \param opt Determines whether the Documentation containing this DocumentationEntry
* must have a key \p key, or whether it is optional
*
* \pre \p k must not be empty
* \pre \p v must not be nullptr
*/
DocumentationEntry(std::string key, std::shared_ptr<Verifier> verifier,
Optional optional, std::string doc = "");
DocumentationEntry(std::string k, std::shared_ptr<Verifier> v,
Optional opt, std::string doc = "");
/**
* The constructor for a DocumentationEntry describing a \p key in a Documentation.
* The constructor for a DocumentationEntry describing a key \p k in a Documentation.
* The value for the key (or each value in the case of the
* DocumentationEntry::Wildcard) is tested using the \p verifier, that specifies the
* conditions that the \p key%'s value has to fulfill. The textual documentation
* DocumentationEntry::Wildcard) is tested using the verifier \p v, that specifies the
* conditions that the \p k%'s value has to fulfill. The textual documentation
* \p doc shall describe the usage of the key-value pair and will be printed for human
* consumption for example in the DocumentationEngine. Each DocumentationEntry can
* further be \p optional.
* \param key The key for which this DocumentationEntry is valid. If this valid is
* equal to DocumentationEntry::Wildcard, each entry in the Documentation that
* contains this DocumentationEntry will be matched
* \param verifier The Verifier that is used to test the \p key%'s value to determine
* if it is a valid value. The DocumentationEntry will take ownership of the passed
* object
* further be \p opt.
*
* \param k The key for which this DocumentationEntry is valid. If this valid is
* equal to DocumentationEntry::Wildcard, each entry in the Documentation that
* contains this DocumentationEntry will be matched
* \param v The Verifier that is used to test the \p key%'s value to determine if it is
* a valid value. The DocumentationEntry will take ownership of the passed
* object
* \param doc The textual documentation that describes the DocumentationEntry in a
* human readable format
* \param optional Determines whether the Documentation containing this
* DocumentationEntry must have a key \p key, or whether it is optional
* \pre \p key must not be empty
* \pre \p verifier must not be nullptr
* human readable format
* \param opt Determines whether the Documentation containing this DocumentationEntry
* must have a key \p key, or whether it is optional
*
* \pre \p k must not be empty
* \pre \p v must not be nullptr
*/
DocumentationEntry(std::string key, Verifier* verifier, Optional optional,
DocumentationEntry(std::string k, Verifier* v, Optional opt,
std::string doc = "");
/// The key that is described by this DocumentationEntry
@@ -225,29 +230,33 @@ struct Documentation {
using DocumentationEntries = std::vector<documentation::DocumentationEntry>;
/**
* Creates a Documentation with a human-readable \p name and a list of \p entries.
* \param name The human-readable name of this Documentation
* \param id A unique identifier which can be used by applications (or other
* Documentation%s to reference this entry
* \param entries A list of DocumentationEntry%s that describe the individual keys for
* this entrie Documentation
* Creates a Documentation with a human-readable name \p n and a list of entries
* \p ents.
*
* \param n The human-readable name of this Documentation
* \param i A unique identifier which can be used by applications (or other
* Documentation%s to reference this entry
* \param ents A list of DocumentationEntry%s that describe the individual keys for
* this entrie Documentation
*/
Documentation(std::string name, std::string id, DocumentationEntries entries = {});
Documentation(std::string n, std::string i, DocumentationEntries ents = {});
/**
* Creates a Documentation with a human-readable \p name.
* \param name The human-readable name of this Documentation
* \param entries A list of DocumentationEntry%s that describe the individual keys for
* this entrie Documentation
* Creates a Documentation with a human-readable name \p n.
*
* \param n The human-readable name of this Documentation
* \param ents A list of DocumentationEntry%s that describe the individual keys for
* this entrie Documentation
*/
Documentation(std::string name, DocumentationEntries entries = {});
Documentation(std::string n, DocumentationEntries ents = {});
/**
* Creates a Documentation.
*
* \param entries A list of DocumentationEntry%s that describe the individual keys for
* this entrie Documentation
* this entrie Documentation
*/
Documentation(DocumentationEntries entries = {});
Documentation(DocumentationEntries ents = {});
/// The human-readable name of the Documentation
std::string name;
@@ -263,9 +272,10 @@ struct Documentation {
* will contain whether the \p dictionary adheres to the \p documentation and, in
* addition, the list of all offending keys together with the reason why they are
* offending.
*
* \param documentation The Documentation that the \p dictionary is tested against
* \param dictionary The ghoul::Dictionary that is to be tested against the
* \p documentation
* \p documentation
* \return A TestResult that contains the results of the specification testing
*/
TestResult testSpecification(const Documentation& documentation,
@@ -277,11 +287,13 @@ TestResult testSpecification(const Documentation& documentation,
* specification a SpecificationError is thrown, and the exception contains the TestResult
* that contains more information about the offending keys. If the \p dictionary adheres to
* the \p documentation, the method returns normally.
*
* \param documentation The Documentation that the \p dictionary is tested against
* \param dictionary The ghoul::Dictionary that is to be tested against the
* \p documentation
* \p documentation
* \param component The component that is using this method; this argument is passed to the
* SpecificationError that is thrown in case of not adhering to the \p documentation
* SpecificationError that is thrown in case of not adhering to the \p documentation
*
* \throw SpecificationError If the \p dictionary does not adhere to the \p documentation
*/
void testSpecificationAndThrow(const Documentation& documentation,

View File

@@ -25,10 +25,10 @@
#ifndef __OPENSPACE_CORE___DOCUMENTATIONENGINE___H__
#define __OPENSPACE_CORE___DOCUMENTATIONENGINE___H__
#include <openspace/documentation/documentation.h>
#include <openspace/documentation/documentationgenerator.h>
#include <ghoul/designpattern/singleton.h>
#include <openspace/documentation/documentation.h>
#include <ghoul/misc/exception.h>
namespace openspace::documentation {
@@ -50,10 +50,11 @@ public:
/**
* Constructor of a DuplicateDocumentationException storing the offending
* Documentation for later use.
* \param documentation The Documentation whose identifier was previously
* registered
*
* \param doc The Documentation whose identifier was previously
* registered
*/
DuplicateDocumentationException(Documentation documentation);
DuplicateDocumentationException(Documentation doc);
/// The offending Documentation whose identifier was previously registered
Documentation documentation;
@@ -64,20 +65,24 @@ public:
/**
* Adds the \p documentation to the list of Documentation%s that are written to a
* documentation file with the writeDocumentation method.
*
* \param documentation The Documentation object that is to be stored for later use
* \throws DuplicateDocumentationException If the \p documentation has a non-empty
* identifier and it was not unique
*
* \throw DuplicateDocumentationException If the \p documentation has a non-empty
* identifier and it was not unique
*/
void addDocumentation(Documentation documentation);
/**
* Returns a list of all registered Documentation%s
* Returns a list of all registered Documentation%s.
*
* \return A list of all registered Documentation%s
*/
std::vector<Documentation> documentations() const;
/**
* Returns a static reference to the main singleton DocumentationEngine
* Returns a static reference to the main singleton DocumentationEngine.
*
* \return A static reference to the main singleton DocumentationEngine
*/
static DocumentationEngine& ref();

View File

@@ -26,9 +26,7 @@
#define __OPENSPACE_CORE___VERIFIER___H__
#include <openspace/documentation/documentation.h>
#include <ghoul/glm.h>
#include <functional>
#include <type_traits>
@@ -51,15 +49,17 @@ struct Verifier {
* concrete subclass and can range from type testing (for example IntVerifier or
* StringVerifier) to more complex testing (for example DoubleInRangeVerifier or
* TableVerifier).
*
* \param dictionary The dictionary that contains the \p key which is to be tested by
* this Verifier
* this Verifier
* \param key The key inside the \p dictionary that is to be tested
* \return A TestResult struct that contains information about whether the key adheres
* to the demands of the specific Verifier. If it does not, TestResult::offenders will
* either contain \p key or, in the case of a TableVerifier, a list of all offending
* subkeys as fully qualified names.
* to the demands of the specific Verifier. If it does not,
* TestResult::offenders will either contain \p key or, in the case of a
* TableVerifier, a list of all offending subkeys as fully qualified names.
*
* \post If the return values' TestResult::success is \c true, its
* TestResult::offenders is empty
* TestResult::offenders is empty
*/
virtual TestResult operator()(const ghoul::Dictionary& dictionary,
const std::string& key) const = 0;
@@ -68,7 +68,9 @@ struct Verifier {
* This method returns a human-readable string describing the type of object that is
* handled by the Verifier subclass. This is only used for generating a human-readable
* documentation and description of a Documenation object.
*
* \return A human-readable string describing the type of object for the Verifier
*
* \post The return value is not empty
*/
virtual std::string type() const = 0;
@@ -77,8 +79,10 @@ struct Verifier {
* This method returns a human-readable string describing the tests that the concrete
* Verifier subclass implements. This is only used for generating a human-readable
* documentation and description of a Documentation object.
*
* \return A human-readable string describing the tests that are performed by the
* Verifier
* Verifier
*
* \post The return value is not empty
*/
virtual std::string documentation() const = 0;
@@ -101,13 +105,15 @@ struct TemplateVerifier : public Verifier {
/**
* Tests whether the \p key contained in the ghoul::Dictionary \p dictionary exists
* and has the same type as \c T.
*
* \param dictionary The ghoul::Dictionary that contains the \p key to be tested
* \param key The key inside the \p dictinoary that is to be tested
* \return A TestResult that contains the information whether the \p key exists in the
* \p dictionary and whether the key's value's type agrees with \c T.
* \p dictionary and whether the key's value's type agrees with \c T.
*
* \post The return values' TestResult::success is either \c true and
* TestResult::offenders is empty, or it is \c false and TestResult::offenders
* contains \p key
* TestResult::offenders is empty, or it is \c false and TestResult::offenders
* contains \p key
*/
TestResult operator()(const ghoul::Dictionary& dictionary,
const std::string& key) const override;
@@ -124,19 +130,19 @@ struct BoolVerifier : public TemplateVerifier<bool> {
};
/**
* A Verifier that checks whether a given key inside a ghoul::Dictionary is of type
* \c double. No implicit conversion is considered in this testing.
*/
* A Verifier that checks whether a given key inside a ghoul::Dictionary is of type
* \c double. No implicit conversion is considered in this testing.
*/
struct DoubleVerifier : public TemplateVerifier<double> {
std::string type() const override;
};
/**
* A Verifier that checks whether a given key inside a ghoul::Dictionary is of type
* \c int. It will also return \c true if the key's value is of type \c double, but is a
* integer value (for example, <code>0.0</code>, <code>12.0</code>, but not
* <code>0.5</code>).
*/
* A Verifier that checks whether a given key inside a ghoul::Dictionary is of type
* \c int. It will also return \c true if the key's value is of type \c double, but is a
* integer value (for example, <code>0.0</code>, <code>12.0</code>, but not
* <code>0.5</code>).
*/
struct IntVerifier : public TemplateVerifier<int> {
TestResult operator()(const ghoul::Dictionary& dict,
const std::string& key) const override;
@@ -145,31 +151,32 @@ struct IntVerifier : public TemplateVerifier<int> {
};
/**
* A Verifier that checks whether a given key inside a ghoul::Dictionary is of type
* <code>std::string</code>. No implicit conversion is considered in this testing.
*/
* A Verifier that checks whether a given key inside a ghoul::Dictionary is of type
* <code>std::string</code>. No implicit conversion is considered in this testing.
*/
struct StringVerifier : public TemplateVerifier<std::string> {
std::string type() const override;
};
/**
* A Verifier that checks whether a given key inside a ghoul::Dictionary is another
* ghoul::Dictionary. The constructor takes a list of DocumentationEntry%s, which are used
* recursively to check the contained table. If this list is empty, a simple type testing
* is performed instead. If the testing finds any offending keys, it will return those keys
* with fully qualified names, that is, the name of the table will be prepended to the
* offending keys. Example: If the key \c Table is tested and a passed DocumentationEntry
* checks for a nested key \c a and this does not comply, this Verifier will return
* <code>Table.a</code> as an offender.
*/
* A Verifier that checks whether a given key inside a ghoul::Dictionary is another
* ghoul::Dictionary. The constructor takes a list of DocumentationEntry%s, which are used
* recursively to check the contained table. If this list is empty, a simple type testing
* is performed instead. If the testing finds any offending keys, it will return those
* keys with fully qualified names, that is, the name of the table will be prepended to
* the offending keys. Example: If the key \c Table is tested and a passed
* DocumentationEntry checks for a nested key \c a and this does not comply, this Verifier
* will return <code>Table.a</code> as an offender.
*/
struct TableVerifier : public TemplateVerifier<ghoul::Dictionary> {
/**
* This constructor takes a list of DocumentationEntry%s that are used recursively to
* check the table (= ghoul::Dictionary) contained in the key's value. Similar to the
* Documentation, these DocumentationEntry%s can be Exhaustive or not.
*
* \param documentationEntries The DocumentationEntry%s that are used to recursively
* test the ghoul::Dictionary that is contained inside. If this list is empty, only a
* type check is performed
* test the ghoul::Dictionary that is contained inside. If this list is empty,
* only a type check is performed
*/
TableVerifier(std::vector<DocumentationEntry> documentationEntries = {});
@@ -179,12 +186,13 @@ struct TableVerifier : public TemplateVerifier<ghoul::Dictionary> {
* provided in the constructor. If the testing finds any offending keys, it will
* return those keys with fully qualified names, that is, the name of the table will
* be prepended to the offending keys.
*
* \param dictionary The ghoul::Dictionary that is to be tested for the \p key
* \param key The key for which the \p dictionary is tested
* \return A TestResult containing the results of the testing. If DocumentationEntry%s
* were specified in the constructor and one of those values find an offending key
* inside the table, it's name will be returned with a fully qualified name by
* prepending the name (= \key) of the table.
* were specified in the constructor and one of those values find an offending
* key inside the table, it's name will be returned with a fully qualified
* name by prepending the name (= \key) of the table.
*/
TestResult operator()(const ghoul::Dictionary& dictionary,
const std::string& key) const override;
@@ -201,6 +209,7 @@ struct TableVerifier : public TemplateVerifier<ghoul::Dictionary> {
struct StringListVerifier : public TableVerifier {
/**
* Constructor for a StringListVerifier.
*
* \param elementDocumentation The documentation for each string in the list
*/
StringListVerifier(std::string elementDocumentation = "");
@@ -209,13 +218,14 @@ struct StringListVerifier : public TableVerifier {
};
/**
* A Verifier that checks whether all values contained in a Table are of type \c int.
*/
* A Verifier that checks whether all values contained in a Table are of type \c int.
*/
struct IntListVerifier : public TableVerifier {
/**
* Constructor for a IntListVerifier.
* \param elementDocumentation The documentation for each string in the list
*/
* Constructor for a IntListVerifier.
*
* \param elementDocumentation The documentation for each string in the list
*/
IntListVerifier(std::string elementDocumentation = "");
std::string type() const override;
@@ -242,25 +252,25 @@ struct Vector2Verifier : public TemplateVerifier<glm::tvec2<T>>, public VectorVe
};
/**
* This Verifier checks whether the value is of type <code>glm::tvec3<T></code>
*/
* This Verifier checks whether the value is of type <code>glm::tvec3<T></code>
*/
template <typename T>
struct Vector3Verifier : public TemplateVerifier<glm::tvec3<T>>, public VectorVerifier {
std::string type() const override;
};
/**
* This Verifier checks whether the value is of type <code>glm::tvec4<T></code>
*/
* This Verifier checks whether the value is of type <code>glm::tvec4<T></code>
*/
template <typename T>
struct Vector4Verifier : public TemplateVerifier<glm::tvec4<T>>, public VectorVerifier {
std::string type() const override;
};
/**
* A Verifier that checks whether all values contained in a Table are of
* type <code>glm::tvec2<T></code>
*/
* A Verifier that checks whether all values contained in a Table are of
* type <code>glm::tvec2<T></code>
*/
template <typename T>
struct Vector2ListVerifier : public TableVerifier {
Vector2ListVerifier(std::string elementDocumentation = "") : TableVerifier({
@@ -274,9 +284,9 @@ struct Vector2ListVerifier : public TableVerifier {
};
/**
* A Verifier that checks whether all values contained in a Table are of
* type <code>glm::tvec3<T></code>
*/
* A Verifier that checks whether all values contained in a Table are of
* type <code>glm::tvec3<T></code>
*/
template <typename T>
struct Vector3ListVerifier : public TableVerifier {
Vector3ListVerifier(std::string elementDocumentation = "") : TableVerifier({
@@ -290,9 +300,9 @@ struct Vector3ListVerifier : public TableVerifier {
};
/**
* A Verifier that checks whether all values contained in a Table are of
* type <code>glm::tvec4<T></code>
*/
* A Verifier that checks whether all values contained in a Table are of
* type <code>glm::tvec4<T></code>
*/
template <typename T>
struct Vector4ListVerifier : public TableVerifier {
Vector4ListVerifier(std::string elementDocumentation = "") : TableVerifier({
@@ -309,16 +319,16 @@ struct Vector4ListVerifier : public TableVerifier {
//----------------------------------------------------------------------------------------
/**
* This struct is the base class for all Verifier%s that check for \c glm matrix types.
* The template parameter for the subclasses is the containing type, not the full matrix
* type. For example to check for <code>glm::dmat4x3</code>, one would create a
* <code>Matrix4x3Verifier<double></code>.
*/
* This struct is the base class for all Verifier%s that check for \c glm matrix types.
* The template parameter for the subclasses is the containing type, not the full matrix
* type. For example to check for <code>glm::dmat4x3</code>, one would create a
* <code>Matrix4x3Verifier<double></code>.
*/
struct MatrixVerifier {};
/**
* This Verifier checks whether the value is of type <code>glm::mat2x2<T></code>
*/
* This Verifier checks whether the value is of type <code>glm::mat2x2<T></code>
*/
template <typename T>
struct Matrix2x2Verifier :
public TemplateVerifier<glm::tmat2x2<T>>, public MatrixVerifier
@@ -327,8 +337,8 @@ struct Matrix2x2Verifier :
};
/**
* This Verifier checks whether the value is of type <code>glm::mat2x3<T></code>
*/
* This Verifier checks whether the value is of type <code>glm::mat2x3<T></code>
*/
template <typename T>
struct Matrix2x3Verifier :
public TemplateVerifier<glm::tmat2x3<T>>, public MatrixVerifier {
@@ -336,8 +346,8 @@ struct Matrix2x3Verifier :
};
/**
* This Verifier checks whether the value is of type <code>glm::mat2x4<T></code>
*/
* This Verifier checks whether the value is of type <code>glm::mat2x4<T></code>
*/
template <typename T>
struct Matrix2x4Verifier :
public TemplateVerifier<glm::tmat2x4<T>>, public MatrixVerifier {
@@ -345,8 +355,8 @@ struct Matrix2x4Verifier :
};
/**
* This Verifier checks whether the value is of type <code>glm::mat3x2<T></code>
*/
* This Verifier checks whether the value is of type <code>glm::mat3x2<T></code>
*/
template <typename T>
struct Matrix3x2Verifier :
public TemplateVerifier<glm::tmat3x2<T>>, public MatrixVerifier {
@@ -354,8 +364,8 @@ struct Matrix3x2Verifier :
};
/**
* This Verifier checks whether the value is of type <code>glm::mat3x3<T></code>
*/
* This Verifier checks whether the value is of type <code>glm::mat3x3<T></code>
*/
template <typename T>
struct Matrix3x3Verifier :
public TemplateVerifier<glm::tmat3x3<T>>, public MatrixVerifier {
@@ -363,8 +373,8 @@ struct Matrix3x3Verifier :
};
/**
* This Verifier checks whether the value is of type <code>glm::mat3x4<T></code>
*/
* This Verifier checks whether the value is of type <code>glm::mat3x4<T></code>
*/
template <typename T>
struct Matrix3x4Verifier :
public TemplateVerifier<glm::tmat3x4<T>>, public MatrixVerifier {
@@ -372,8 +382,8 @@ struct Matrix3x4Verifier :
};
/**
* This Verifier checks whether the value is of type <code>glm::mat4x2<T></code>
*/
* This Verifier checks whether the value is of type <code>glm::mat4x2<T></code>
*/
template <typename T>
struct Matrix4x2Verifier :
public TemplateVerifier<glm::tmat4x2<T>>, public MatrixVerifier {
@@ -381,8 +391,8 @@ struct Matrix4x2Verifier :
};
/**
* This Verifier checks whether the value is of type <code>glm::mat4x3<T></code>
*/
* This Verifier checks whether the value is of type <code>glm::mat4x3<T></code>
*/
template <typename T>
struct Matrix4x3Verifier :
public TemplateVerifier<glm::tmat4x3<T>>, public MatrixVerifier {
@@ -390,8 +400,8 @@ struct Matrix4x3Verifier :
};
/**
* This Verifier checks whether the value is of type <code>glm::mat4x4<T></code>
*/
* This Verifier checks whether the value is of type <code>glm::mat4x4<T></code>
*/
template <typename T>
struct Matrix4x4Verifier :
public TemplateVerifier<glm::tmat4x4<T>>, public MatrixVerifier {
@@ -432,13 +442,14 @@ struct OperatorVerifier : public T {
* \p key%'s value is correct using the template paramater \c T as a verifier. Then,
* the \p key%'s value is checked against the stored OperatorVerifier::value using the
* \c Operator.
*
* \param dictionary The ghoul::Dictionary that contains the \p key to be tested
* \param key The key inside the \p dictinoary that is to be tested
* \return A TestResult containing the results of the specification testing. If the
* \p key%'s value has the wrong type, it will be added to the TestResult's offense
* list with the reason TestResult::Offense::Reason::WrongType; if the \c Operator
* returns false, it will be added with the reason TestResult::Offense::Verification
* instead.
* \p key%'s value has the wrong type, it will be added to the TestResult's
* offense list with the reason TestResult::Offense::Reason::WrongType; if the
* \c Operator returns false, it will be added with the reason
* TestResult::Offense::Verification instead.
*/
TestResult operator()(const ghoul::Dictionary& dictionary,
const std::string& key) const override;
@@ -479,10 +490,10 @@ struct LessVerifier : public OperatorVerifier<T, std::less<typename T::Type>> {
};
/**
* This Verifier checks whether the incoming value is smaller than or equal to the stored
* value. Due to the operator type restrictions, \c T cannot be a subclass of (or the same
* as) BoolVerifier, StringVerifier, TableVerifier, or VectorVerifier.
*/
* This Verifier checks whether the incoming value is smaller than or equal to the stored
* value. Due to the operator type restrictions, \c T cannot be a subclass of (or the same
* as) BoolVerifier, StringVerifier, TableVerifier, or VectorVerifier.
*/
template <typename T>
struct LessEqualVerifier : public OperatorVerifier<T, std::less_equal<typename T::Type>> {
static_assert(
@@ -510,10 +521,10 @@ struct LessEqualVerifier : public OperatorVerifier<T, std::less_equal<typename T
};
/**
* This Verifier checks whether the incoming value is strictly greater than the stored
* value. Due to the operator type restrictions, \c T cannot be a subclass of (or the same
* as) BoolVerifier, StringVerifier, TableVerifier, or VectorVerifier.
*/
* This Verifier checks whether the incoming value is strictly greater than the stored
* value. Due to the operator type restrictions, \c T cannot be a subclass of (or the same
* as) BoolVerifier, StringVerifier, TableVerifier, or VectorVerifier.
*/
template <typename T>
struct GreaterVerifier : public OperatorVerifier<T, std::greater<typename T::Type>> {
static_assert(
@@ -541,10 +552,10 @@ struct GreaterVerifier : public OperatorVerifier<T, std::greater<typename T::Typ
};
/**
* This Verifier checks whether the incoming value is greater than or equal to the stored
* value. Due to the operator type restrictions, \c T cannot be a subclass of (or the same
* as) BoolVerifier, StringVerifier, TableVerifier, or VectorVerifier.
*/
* This Verifier checks whether the incoming value is greater than or equal to the stored
* value. Due to the operator type restrictions, \c T cannot be a subclass of (or the same
* as) BoolVerifier, StringVerifier, TableVerifier, or VectorVerifier.
*/
template <typename T>
struct GreaterEqualVerifier : public OperatorVerifier<T,
std::greater_equal<typename T::Type>>
@@ -574,9 +585,10 @@ struct GreaterEqualVerifier : public OperatorVerifier<T,
};
/**
* This Verifier checks whether the incoming value is equal to the stored value. Due to the
* operator type restrictions, \c T cannot be a subclass of (or the same as) TableVerifier.
*/
* This Verifier checks whether the incoming value is equal to the stored value. Due to
* the operator type restrictions, \c T cannot be a subclass of (or the same as)
* TableVerifier.
*/
template <typename T>
struct EqualVerifier : public OperatorVerifier<T, std::equal_to<typename T::Type>> {
static_assert(!std::is_base_of<TableVerifier, T>::value, "T cannot be TableVerifier");
@@ -589,10 +601,10 @@ struct EqualVerifier : public OperatorVerifier<T, std::equal_to<typename T::Type
};
/**
* This Verifier checks whether the incoming value is unequal to the store value. Due to
* the operator type restrictions, \c T cannot be a subclass of (or the same as)
* TableVerifier.
*/
* This Verifier checks whether the incoming value is unequal to the store value. Due to
* the operator type restrictions, \c T cannot be a subclass of (or the same as)
* TableVerifier.
*/
template <typename T>
struct UnequalVerifier : public OperatorVerifier<T, std::not_equal_to<typename T::Type>> {
static_assert(!std::is_base_of<TableVerifier, T>::value, "T cannot be TableVerifier");
@@ -621,6 +633,7 @@ struct InListVerifier : public T {
/**
* Constructs an InListVerifier that checks whether the incoming value is of the
* correct type and whether the value is part of the list passed as \p values.
*
* \param values The list of values against which the incoming value is tested
*/
InListVerifier(std::vector<typename T::Type> values);
@@ -629,13 +642,14 @@ struct InListVerifier : public T {
* Tests whether the \p key exists in the \p dictionary, whether it has the correct
* type by invoking the template parameter \c T, and then tests if the \p key's value
* is part of the list passed to the constructor.
*
* \param dictionary The ghoul::Dictionary that contains the \p key
* \param key The key that is contained in the \p dictionary and whose value is tested
* \return A TestResult containing the results of the specification testing. If the
* \p key%'s value has the wrong type, it will be added to the TestResult's offense
* list with the reason TestResult::Offense::Reason::WrongType; if the value is not
* in the list, it will be added with the reason TestResult::Offense::Verification
* instead.
* \p key%'s value has the wrong type, it will be added to the TestResult's
* offense list with the reason TestResult::Offense::Reason::WrongType; if the
* value is not in the list, it will be added with the reason
* TestResult::Offense::Verification instead.
*/
TestResult operator()(const ghoul::Dictionary& dictionary,
const std::string& key) const override;
@@ -647,33 +661,36 @@ struct InListVerifier : public T {
};
/**
* This Verifier checks whether the incoming value is of the correct type, using the
* Verifier passed as a template parameter \c T and then checks whether it is not part of a
* list that is passed to the constructor. To the missing equality operator, \c T cannot
* be a subclass of (or the same as) TableVerifier.
*/
* This Verifier checks whether the incoming value is of the correct type, using the
* Verifier passed as a template parameter \c T and then checks whether it is not part of
* a list that is passed to the constructor. To the missing equality operator, \c T cannot
* be a subclass of (or the same as) TableVerifier.
*/
template <typename T>
struct NotInListVerifier : public T {
static_assert(!std::is_base_of<TableVerifier, T>::value, "T cannot be TableVerifier");
/**
* Constructs a NotInListVerifier that checks whether the incoming value is of the
* correct type and whether the value is not part of the list passed as \p values.
* \param values The list of values against which the incoming value is tested
*/
* Constructs a NotInListVerifier that checks whether the incoming value is of the
* correct type and whether the value is not part of the list passed as \p values.
*
* \param values The list of values against which the incoming value is tested
*/
NotInListVerifier(std::vector<typename T::Type> values);
/**
* Tests whether the \p key exists in the \p dictionary, whether it has the correct
* type by invoking the template parameter \c T, and then tests if the \p key's value
* is not part of the list passed to the constructor.
* \param dictionary The ghoul::Dictionary that contains the \p key
* \param key The key that is contained in the \p dictionary and whose value is tested
* \return A TestResult containing the results of the specification testing. If the
* \p key%'s value has the wrong type, it will be added to the TestResult's offense
* list with the reason TestResult::Offense::Reason::WrongType; if the value is in the
* list, it will be added with the reason TestResult::Offense::Verification instead.
*/
* Tests whether the \p key exists in the \p dictionary, whether it has the correct
* type by invoking the template parameter \c T, and then tests if the \p key's value
* is not part of the list passed to the constructor.
*
* \param dictionary The ghoul::Dictionary that contains the \p key
* \param key The key that is contained in the \p dictionary and whose value is tested
* \return A TestResult containing the results of the specification testing. If the
* \p key%'s value has the wrong type, it will be added to the TestResult's
* offense list with the reason TestResult::Offense::Reason::WrongType; if the
* value is in the list, it will be added with the reason
* TestResult::Offense::Verification instead.
*/
TestResult operator()(const ghoul::Dictionary& dictionary,
const std::string& key) const override;
@@ -687,12 +704,12 @@ struct NotInListVerifier : public T {
//----------------------------------------------------------------------------------------
/**
* This Verifier checks whether the incoming value is of the correct type, using the
* Verifier passed as a template parameter \c T and then checks whether it is greater or
* equal to a lower limit and less or equal to a higher limit. To the missing comparison
* operators, \c T cannot be a subclass of (or the same as) BoolVerifier, StringVerifier,
* TableVerifier, or VectorVerifier. Both the lower and the higher limit are inclusive).
*/
* This Verifier checks whether the incoming value is of the correct type, using the
* Verifier passed as a template parameter \c T and then checks whether it is greater or
* equal to a lower limit and less or equal to a higher limit. To the missing comparison
* operators, \c T cannot be a subclass of (or the same as) BoolVerifier, StringVerifier,
* TableVerifier, or VectorVerifier. Both the lower and the higher limit are inclusive).
*/
template <typename T>
struct InRangeVerifier : public T {
static_assert(
@@ -713,28 +730,32 @@ struct InRangeVerifier : public T {
);
/**
* Constructs a InRangeVerifier that checks whether the incoming value is of the
* correct type and whether the value is greater or equal to \p lower and less or equal
* to \upper.
* \param lower The (inclusive) lower limit of the range
* \param upper The (inclusive) upper limit of the range
* \pre \p lower must be smaller or equal to \p upper
*/
* Constructs a InRangeVerifier that checks whether the incoming value is of the
* correct type and whether the value is greater or equal to \p lower and less or
* equal to \upper.
*
* \param lower The (inclusive) lower limit of the range
* \param upper The (inclusive) upper limit of the range
*
* \pre \p lower must be smaller or equal to \p upper
*/
InRangeVerifier(typename T::Type lower, typename T::Type upper);
/**
* Tests whether the \p key exists in the \p dictionary, whether it has the correct
* type by invoking the template parameter \c T, and then tests if the \p key's value
* is between the lower and upper limits (both inclusive) that were passed to the
* constructor.
* \param dictionary The ghoul::Dictionary that contains the \p key
* \param key The key that is contained in the \p dictionary and whose value is tested
* \return A TestResult containing the results of the specification testing. If the
* \p key%'s value has the wrong type, it will be added to the TestResult's offense
* list with the reason TestResult::Offense::Reason::WrongType; if the value is outside
* the range defined by the lower and upper limits passed to the constructor, it will
* be added with the reason TestResult::Offense::Verification instead.
*/
* Tests whether the \p key exists in the \p dictionary, whether it has the correct
* type by invoking the template parameter \c T, and then tests if the \p key's value
* is between the lower and upper limits (both inclusive) that were passed to the
* constructor.
*
* \param dictionary The ghoul::Dictionary that contains the \p key
* \param key The key that is contained in the \p dictionary and whose value is tested
* \return A TestResult containing the results of the specification testing. If the
* \p key%'s value has the wrong type, it will be added to the TestResult's
* offense list with the reason TestResult::Offense::Reason::WrongType; if the
* value is outside the range defined by the lower and upper limits passed to
* the constructor, it will be added with the reason
* TestResult::Offense::Verification instead.
*/
TestResult operator()(const ghoul::Dictionary& dictionary,
const std::string& key) const override;
@@ -745,12 +766,12 @@ struct InRangeVerifier : public T {
};
/**
* This Verifier checks whether the incoming value is of the correct type, using the
* Verifier passed as a template parameter \c T and then checks whether it is outside the
* (exclusive) range defined by a lower and upper limit. To the missing comparison
* operators, \c T cannot be a subclass of (or the same as) BoolVerifier, StringVerifier,
* TableVerifier, or VectorVerifier. Both the lower and the higher limit are exclusive).
*/
* This Verifier checks whether the incoming value is of the correct type, using the
* Verifier passed as a template parameter \c T and then checks whether it is outside the
* (exclusive) range defined by a lower and upper limit. To the missing comparison
* operators, \c T cannot be a subclass of (or the same as) BoolVerifier, StringVerifier,
* TableVerifier, or VectorVerifier. Both the lower and the higher limit are exclusive).
*/
template <typename T>
struct NotInRangeVerifier : public T {
static_assert(
@@ -771,27 +792,31 @@ struct NotInRangeVerifier : public T {
);
/**
* Constructs a InRangeVerifier that checks whether the incoming value is of the
* correct type and whether the value is less then \p lower and greater than \upper.
* \param lower The (exclusive) lower limit of the range
* \param upper The (exclusive) upper limit of the range
* \pre \p lower must be smaller or equal to \p upper
*/
* Constructs a InRangeVerifier that checks whether the incoming value is of the
* correct type and whether the value is less then \p lower and greater than \p upper.
*
* \param lower The (exclusive) lower limit of the range
* \param upper The (exclusive) upper limit of the range
*
* \pre \p lower must be smaller or equal to \p upper
*/
NotInRangeVerifier(typename T::Type lower, typename T::Type upper);
/**
* Tests whether the \p key exists in the \p dictionary, whether it has the correct
* type by invoking the template parameter \c T, and then tests if the \p key's value
* is outside the lower and upper limits (both exclusive) that were passed to the
* constructor.
* \param dictionary The ghoul::Dictionary that contains the \p key
* \param key The key that is contained in the \p dictionary and whose value is tested
* \return A TestResult containing the results of the specification testing. If the
* \p key%'s value has the wrong type, it will be added to the TestResult's offense
* list with the reason TestResult::Offense::Reason::WrongType; if the value is greater
* or equal to the lower limit and less or equal to the upper limit, it will be added
* with the reason TestResult::Offense::Verification instead.
*/
* Tests whether the \p key exists in the \p dictionary, whether it has the correct
* type by invoking the template parameter \c T, and then tests if the \p key's value
* is outside the lower and upper limits (both exclusive) that were passed to the
* constructor.
*
* \param dictionary The ghoul::Dictionary that contains the \p key
* \param key The key that is contained in the \p dictionary and whose value is tested
* \return A TestResult containing the results of the specification testing. If the
* \p key%'s value has the wrong type, it will be added to the TestResult's
* offense list with the reason TestResult::Offense::Reason::WrongType; if the
* value is greater or equal to the lower limit and less or equal to the upper
* limit, it will be added with the reason TestResult::Offense::Verification
* instead.
*/
TestResult operator()(const ghoul::Dictionary& dictionary,
const std::string& key) const override;
@@ -818,8 +843,10 @@ struct AnnotationVerifier : public T {
/**
* Constructs an AnnotationVerifier that contains the passed \p annotation which is
* passed to the user when a documentation is requested.
*
* \param annotation The annotation that is stored and returned to the user when it
* is requested.
* is requested.
*
* \pre annotation must not be empty
*/
AnnotationVerifier(std::string annotation);
@@ -834,7 +861,7 @@ struct AnnotationVerifier : public T {
* This Verifier is a marker that performs the same testing as the \c T parameter, but
* also adds a warning to the test result informing the user of the deprecation.
* Furthermore, the documentation will contain the word <code>(deprecated)</code> in
* addition to the documentation returned by \c
* addition to the documentation returned by \c T
* \tparam T The Verifier that is to be marked deprecated
*/
template <typename T>
@@ -842,6 +869,7 @@ struct DeprecatedVerifier : public T {
/**
* Tests the \p dictionary%s \p key using the Verifier \c T and adds a warning to the
* TestResult informing the caller of the deprecation.
*
* \param dictionary The ghoul::Dictionary whose \p key should be tested
* \param key The key inside the \p dictionary that is to be tested
* \return A TestResult that contains the results of the testing
@@ -868,11 +896,12 @@ struct DeprecatedVerifier : public T {
struct ReferencingVerifier : public TableVerifier {
/**
* Creates a ReferencingVerifier that references a documentation with the provided
* \p identifier. The ReferencingVerifier will use the static DocumentationEngine to
* retrieve Documentation%s and find the \p identifier among them.
* identifier \p id. The ReferencingVerifier will use the static DocumentationEngine
* to retrieve Documentation%s and find the \p identifier among them.
*
* \param identifier The identifier of the Documentation that this Verifier references
*/
ReferencingVerifier(std::string identifier);
ReferencingVerifier(std::string id);
/**
* Checks whether the \p key in the \p dictionary exists and is of type Table (similar
@@ -883,6 +912,7 @@ struct ReferencingVerifier : public TableVerifier {
* signaled. If the identifier exists and the \p key%'s value does not comply with the
* Documentation, the offending keys will be returned in the TestResult with their
* fully qualified names.
*
* \param dictionary The ghoul::Dictionary whose \p key should be tested
* \param key The key contained in the \p dictionary that should be tested
* \return A TestResult struct that contains the results of the testing
@@ -911,26 +941,29 @@ struct AndVerifier : public Verifier {
/**
* Constructs an AndVerifier with two Verifiers which must be cleared by incoming
* values in order to pass this Verifier.
* \param lhs The first Verifier that is to be tested
* \param rhs The second Verifier that is to be tested
* \pre lhs must not be nullptr
* \pre rhs must not be nullptr
*
* \param l The first Verifier that is to be tested
* \param r The second Verifier that is to be tested
*
* \pre l must not be nullptr
* \pre r must not be nullptr
*/
AndVerifier(Verifier* lhs, Verifier* rhs);
AndVerifier(Verifier* l, Verifier* r);
/**
* Checks whether the \p dictionary contains the \p key and whether this key passes
* both Verifier%'s that were passed in the constructor. If the value fails either
* of the two Verifiers, it is only added once to the TestResult::offenses list with
* a reason of TestResult::Offense::Reason::Verification.
*
* \param dictionary The ghoul::Dictionary that is to be tested
* \param key The key contained in \p dictionary that is to be tested
* \return A TestResult object that contains the test results. If the value fails
* either of the two Verifiers, TestResult::success is \c false and the
* TestResult::offenses list contains \p with a reason of
* TestResult::Offense::Reason::Verification. If \p key%'s value passes both
* Verifier%s, the result's TestResult::success is \c true and the
* TestResult::offenses is empty.
* either of the two Verifiers, TestResult::success is \c false and the
* TestResult::offenses list contains \p with a reason of
* TestResult::Offense::Reason::Verification. If \p key%'s value passes both
* Verifier%s, the result's TestResult::success is \c true and the
* TestResult::offenses is empty.
*/
TestResult operator()(const ghoul::Dictionary& dictionary,
const std::string& key) const override;
@@ -945,36 +978,40 @@ struct AndVerifier : public Verifier {
};
/**
* This Verifier takes two Verifiers and performs a boolean \c or operation on their
* results. In essence, a value only passes this Verifier if it passes either of the two
* Verifier%s that are passed in the constructor. Opposed to the <code>C++</code>
* <code>||</code> operator, the OrVerifier does not perform any short-circut evaluation.
*/
* This Verifier takes two Verifiers and performs a boolean \c or operation on their
* results. In essence, a value only passes this Verifier if it passes either of the two
* Verifier%s that are passed in the constructor. Opposed to the <code>C++</code>
* <code>||</code> operator, the OrVerifier does not perform any short-circut evaluation.
*/
struct OrVerifier : public Verifier {
/**
* Constructs an OrVerifier with two Verifiers, either of which must be cleared by
* incoming values in order to pass this Verifier.
* \param lhs The first Verifier that is to be tested
* \param rhs The second Verifier that is to be tested
* \pre lhs must not be nullptr
* \pre rhs must not be nullptr
*/
OrVerifier(Verifier* lhs, Verifier* rhs);
* Constructs an OrVerifier with two Verifiers, either of which must be cleared by
* incoming values in order to pass this Verifier.
*
* \param l The first Verifier that is to be tested
* \param r The second Verifier that is to be tested
*
* \pre l must not be nullptr
* \pre r must not be nullptr
*/
OrVerifier(Verifier* l, Verifier* r);
/**
* Checks whether the \p dictionary contains the \p key and whether this key passes
* either of the two Verifier%'s that were passed in the constructor. If the value
* fails both Verifiers, it is added to the TestResult::offenses list with a reason of
* TestResult::Offense::Reason::Verification.
* \param dictionary The ghoul::Dictionary that is to be tested
* \param key The key contained in \p dictionary that is to be tested
* \return A TestResult object that contains the test results. If the value fails
* both Verifiers, TestResult::success is \c false and the TestResult::offenses list
* contains \p with a reason of TestResult::Offense::Reason::Verification. If \p key%'s
* value passes either of the two Verifier%s, the result's TestResult::success is
* \c true and the TestResult::offenses is empty.
*/
TestResult operator()(const ghoul::Dictionary& dict,
* Checks whether the \p dictionary contains the \p key and whether this key passes
* either of the two Verifier%'s that were passed in the constructor. If the value
* fails both Verifiers, it is added to the TestResult::offenses list with a reason of
* TestResult::Offense::Reason::Verification.
*
* \param dictionary The ghoul::Dictionary that is to be tested
* \param key The key contained in \p dictionary that is to be tested
* \return A TestResult object that contains the test results. If the value fails
* both Verifiers, TestResult::success is \c false and the
* TestResult::offenses list contains \p with a reason of
* TestResult::Offense::Reason::Verification. If \p key%'s value passes either
* of the two Verifier%s, the result's TestResult::success is \c true and the
* TestResult::offenses is empty.
*/
TestResult operator()(const ghoul::Dictionary& dictionary,
const std::string& key) const override;
std::string type() const override;