creativity  v1.3.0
Agent-based model of creativity and piracy
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
creativity::cmdargs::Validation< T > Class Template Reference

Validation wrapper base class. More...

#include <creativity/cmdargs/Validation.hpp>

Public Types

using value_type = T
 The type T that this object validates.
 

Public Member Functions

 Validation (T v)
 Constructs with an initial value.
 
 operator const T & () const
 Implicit conversion to the stored value.
 
virtual ~Validation ()=default
 Virtual destructor.
 

Static Public Member Functions

static std::string validationString ()
 Returns a string representation of this validation object.
 

Protected Attributes

val_
 The stored value.
 

Detailed Description

template<typename T>
class creativity::cmdargs::Validation< T >

Validation wrapper base class.

This base class does no actual value validation (except one, see below).

This should be inherited from virtually so that subclasses can inherit from multiple Validation subclasses to enforce multiple validations at once.

Note that there is one validation that occurs when using this: if T is an unsigned type, validation of a Validation (or derived class) makes sure the given value is not negative; without this, boost will cast negative input values to unsigned types, thus ending up with -1 becoming (for an unsigned int) 4294967295.

Inheritance diagram for creativity::cmdargs::Validation< T >:
[legend]
Collaboration diagram for creativity::cmdargs::Validation< T >:
[legend]

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