19template <
typename TYPE>
21 : TypedValidator<
std::vector<
TYPE>>(), m_arraySize(size_t(0)), m_hasArraySize(false), m_arraySizeMin(size_t(0)),
22 m_hasArraySizeMin(false), m_arraySizeMax(size_t(0)), m_hasArraySizeMax(false) {}
27template <
typename TYPE>
29 : TypedValidator<
std::vector<
TYPE>>(), m_arraySize(size_t(len)), m_hasArraySize(true), m_arraySizeMin(size_t(0)),
30 m_hasArraySizeMin(false), m_arraySizeMax(size_t(0)), m_hasArraySizeMax(false) {}
36template <
typename TYPE>
38 : TypedValidator<
std::vector<
TYPE>>(), m_arraySize(size_t(0)), m_hasArraySize(false),
39 m_arraySizeMin(size_t(lenmin)), m_hasArraySizeMin(true), m_arraySizeMax(size_t(lenmax)), m_hasArraySizeMax(true) {
88 this->m_hasArraySize =
true;
89 this->m_arraySize =
value;
90 this->clearLengthMax();
91 this->clearLengthMin();
99 this->m_hasArraySizeMin =
true;
100 this->m_arraySizeMin =
value;
108 this->m_hasArraySizeMax =
true;
109 this->m_arraySizeMax =
value;
118 this->m_hasArraySize =
false;
119 this->m_arraySize = size_t(0);
127 this->m_hasArraySizeMin =
false;
128 this->m_arraySizeMin = size_t(0);
136 this->m_hasArraySizeMax =
false;
137 this->m_arraySizeMax = size_t(0);
145 return std::make_shared<ArrayLengthValidator>(*
this);
154 if (this->hasLength() &&
value.size() != this->m_arraySize) {
155 return "Incorrect size";
157 if (this->hasMinLength() &&
value.size() < this->m_arraySizeMin) {
158 return "Array size too short";
160 if (this->hasMaxLength() &&
value.size() > this->m_arraySizeMax) {
161 return "Array size too long";
171#if defined(_WIN32) || defined(__clang__) && defined(__APPLE__)
double value
The value of the point.
ArrayLenghtValidator : Validate length of an array property.
void setLength(const size_t &value)
Set length.
~ArrayLengthValidator() override
Destructor.
void setLengthMax(const size_t &value)
Set length max.
IValidator_sptr clone() const override
Clone function.
void clearLength()
Clear the length.
ArrayLengthValidator()
No arg constructor.
std::string checkValidity(const std::vector< TYPE > &value) const override
Private function to check validity.
void clearLengthMax()
Clear maximum.
bool hasLength() const
Return if it has a length.
const size_t & getLength() const
Return the length.
const size_t & getMaxLength() const
Return the maximum length.
bool hasMaxLength() const
Return if it has a length.
bool hasMinLength() const
Return if it has a length.
void clearLengthMin()
Clear minimum.
void setLengthMin(const size_t &value)
Set length min.
const size_t & getMinLength() const
Return the minimum length.
std::shared_ptr< IValidator > IValidator_sptr
A shared_ptr to an IValidator.