From 653ba9395a36cc20ec1d68c9a9cae78973fa334c Mon Sep 17 00:00:00 2001 From: Renaud G Date: Thu, 30 Jan 2020 01:27:15 +0100 Subject: add unicity and repeat function part2 --- validator.h | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'validator.h') diff --git a/validator.h b/validator.h index a1e7d65..c9f0b4c 100644 --- a/validator.h +++ b/validator.h @@ -31,6 +31,7 @@ * @brief The Validator class is an abstract class for checking the validity of dice for some * operator. */ +// template class Validator { public: @@ -66,11 +67,38 @@ public: * @return return a copy of this validator */ virtual Validator* getCopy() const= 0; - + /** + * @brief getPossibleValues + * @param range + * @return + */ virtual const std::set& getPossibleValues(const std::pair& range); + /** + * @brief validResult + * @param b + * @param recursive + * @param unlight + * @return + */ + template + qint64 validResult(const std::vector& b, bool recursive, bool unlight, Functor functor) const; + + Dice::ConditionType getConditionType() const; + void setConditionType(const Dice::ConditionType& conditionType); + +protected: + template + qint64 onEach(const std::vector& b, bool recursive, bool unlight, Functor functor) const; + template + qint64 oneOfThem(const std::vector& b, bool recursive, bool unlight, Functor functor) const; + template + qint64 allOfThem(const std::vector& b, bool recursive, bool unlight, Functor functor) const; + template + qint64 onScalar(const std::vector& b, bool recursive, bool unlight, Functor functor) const; protected: std::set m_values; + Dice::ConditionType m_conditionType= Dice::OnEach; }; #endif // VALIDATOR_H -- cgit v1.2.3-70-g09d2