Nuria Framework - Core
Core module of the NuriaProject Framework
 All Classes Functions Typedefs Enumerations Enumerator Groups
conditionevaluator.hpp
1 /* Copyright (c) 2014, The Nuria Project
2  * This software is provided 'as-is', without any express or implied
3  * warranty. In no event will the authors be held liable for any damages
4  * arising from the use of this software.
5  * Permission is granted to anyone to use this software for any purpose,
6  * including commercial applications, and to alter it and redistribute it
7  * freely, subject to the following restrictions:
8  * 1. The origin of this software must not be misrepresented; you must not
9  * claim that you wrote the original software. If you use this software
10  * in a product, an acknowledgment in the product documentation would be
11  * appreciated but is not required.
12  * 2. Altered source versions must be plainly marked as such, and must not be
13  * misrepresented as being the original software.
14  * 3. This notice may not be removed or altered from any source
15  * distribution.
16  */
17 
18 #ifndef NURIA_CONDITIONEVALUATOR_HPP
19 #define NURIA_CONDITIONEVALUATOR_HPP
20 
21 #include "lazyevaluation.hpp"
22 #include "essentials.hpp"
23 #include "callback.hpp"
24 
25 namespace Nuria {
26 class ConditionEvaluatorPrivate;
27 
31 class NURIA_CORE_EXPORT AbstractConditionEvaluator {
32 public:
33 
35  virtual ~AbstractConditionEvaluator ();
36 
37  virtual bool compile (const LazyCondition &condition) = 0;
38  virtual bool evaluate (const QVariantList &arguments, bool &error) = 0;
39 
40 };
41 
42 
48 class NURIA_CORE_EXPORT ConditionEvaluator : public AbstractConditionEvaluator {
49 public:
52 
53  bool compile (const LazyCondition &condition) override;
54  bool evaluate (const QVariantList &arguments, bool &error) override;
55 
56  void registerMethod (const QString &name, const Callback &method);
57 
58 private:
59  ConditionEvaluatorPrivate *d_ptr;
60 };
61 
62 }
63 
64 #endif // NURIA_CONDITIONEVALUATOR_HPP
A modern style callback mechanism which can be bound to various method types including slots...
Definition: callback.hpp:141
LazyCondition offers lazily evaluated conditions for C++.
Definition: lazyevaluation.hpp:63
The ConditionEvaluator class implements a simple evaluator for LazyCondition.
Definition: conditionevaluator.hpp:48
The AbstractConditionEvaluator class.
Definition: conditionevaluator.hpp:31