8#include <boost/optional.hpp>
13template<
typename ValueType>
21 virtual bool isValid(ValueType
const& value) = 0;
29template<
typename ValueType>
32 RangeArgumentValidator(boost::optional<ValueType>
const& lower, boost::optional<ValueType>
const& upper,
bool lowerIncluded,
bool upperIncluded);
34 virtual bool isValid(ValueType
const& value)
override;
35 virtual std::string
toString()
const override;
38 boost::optional<ValueType> lower;
39 boost::optional<ValueType> upper;
50 virtual bool isValid(std::string
const& value)
override;
51 virtual std::string
toString()
const override;
61 virtual bool isValid(std::string
const& value)
override;
62 virtual std::string
toString()
const override;
65 std::vector<std::string> legalValues;
91 template<
typename ValueType>
92 static std::shared_ptr<ArgumentValidator<ValueType>> createRangeValidatorExcluding(ValueType lowerBound, ValueType upperBound);
94 template<
typename ValueType>
95 static std::shared_ptr<ArgumentValidator<ValueType>> createRangeValidatorIncluding(ValueType lowerBound, ValueType upperBound);
97 template<
typename ValueType>
98 static std::shared_ptr<ArgumentValidator<ValueType>> createGreaterValidator(ValueType lowerBound,
bool equalAllowed);
static std::shared_ptr< ArgumentValidator< uint64_t > > createUnsignedRangeValidatorIncluding(uint64_t lowerBound, uint64_t upperBound)
static std::shared_ptr< ArgumentValidator< uint64_t > > createUnsignedRangeValidatorExcluding(uint64_t lowerBound, uint64_t upperBound)
static std::shared_ptr< ArgumentValidator< double > > createDoubleRangeValidatorExcluding(double lowerBound, double upperBound)
static std::shared_ptr< ArgumentValidator< double > > createDoubleGreaterValidator(double lowerBound)
static std::shared_ptr< ArgumentValidator< uint64_t > > createUnsignedGreaterValidator(uint64_t lowerBound)
static std::shared_ptr< ArgumentValidator< int64_t > > createIntegerGreaterEqualValidator(int_fast64_t lowerBound)
static std::shared_ptr< ArgumentValidator< int64_t > > createIntegerGreaterValidator(int_fast64_t lowerBound)
static std::shared_ptr< ArgumentValidator< double > > createDoubleGreaterEqualValidator(double lowerBound)
static std::shared_ptr< ArgumentValidator< uint64_t > > createUnsignedGreaterEqualValidator(uint64_t lowerBound)
static std::shared_ptr< ArgumentValidator< std::string > > createMultipleChoiceValidator(std::vector< std::string > const &choices)
static std::shared_ptr< ArgumentValidator< std::string > > createExistingFileValidator()
static std::shared_ptr< ArgumentValidator< int64_t > > createIntegerRangeValidatorExcluding(int_fast64_t lowerBound, int_fast64_t upperBound)
static std::shared_ptr< ArgumentValidator< double > > createDoubleRangeValidatorIncluding(double lowerBound, double upperBound)
static std::shared_ptr< ArgumentValidator< std::string > > createWritableFileValidator()
virtual std::string toString() const =0
Retrieves a string representation of the valid values.
virtual bool isValid(ValueType const &value)=0
Checks whether the argument passes the validation.
virtual ~ArgumentValidator()=default
virtual std::string toString() const override
Retrieves a string representation of the valid values.
virtual bool isValid(std::string const &value) override
Checks whether the argument passes the validation.
MultipleChoiceValidator(std::vector< std::string > const &legalValues)
virtual bool isValid(std::string const &value) override
Checks whether the argument passes the validation.
virtual std::string toString() const override
Retrieves a string representation of the valid values.
RangeArgumentValidator(boost::optional< ValueType > const &lower, boost::optional< ValueType > const &upper, bool lowerIncluded, bool upperIncluded)
virtual bool isValid(ValueType const &value) override
Checks whether the argument passes the validation.
virtual std::string toString() const override
Retrieves a string representation of the valid values.