Nuria Framework - Core
Core module of the NuriaProject Framework
 All Classes Functions Typedefs Enumerations Enumerator Groups
lazyconditionwalker.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_LAZYCONDITIONWALKER_HPP
19 #define NURIA_LAZYCONDITIONWALKER_HPP
20 
21 #include <QSharedData>
22 
23 #include "lazyevaluation.hpp"
24 #include "essentials.hpp"
25 #include "callback.hpp"
26 
27 namespace Nuria {
28 
29 class LazyConditionWalkerPrivate;
30 
46 class NURIA_CORE_EXPORT LazyConditionWalker {
47 public:
48 
51 
54 
57 
59  LazyConditionWalker &operator= (const LazyConditionWalker &other);
60 
66  void onCondition (LazyCondition::Type type, const Callback &method);
67 
74  void onField (int fieldType, const Callback &method);
75 
84  void onVariant (int userType, const Callback &method);
85 
94  LazyCondition walk (const LazyCondition &condition, bool walkArguments = false);
95 
96 private:
97  bool walkVariant (QVariant &variant, QVariantList &stack, bool walkArguments);
98  bool walkCondition (QVariant &conditionVariant, QVariantList &stack, bool walkArguments);
99  bool walkField (QVariant &fieldVariant, QVariantList &stack, bool walkArguments);
100  bool walkTestCall (QVariant &callVariant, QVariantList &stack, bool walkArguments);
101 
102  QSharedDataPointer< LazyConditionWalkerPrivate > d;
103 
104 };
105 
106 }
107 
108 #endif // NURIA_LAZYCONDITIONWALKER_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 LazyConditionWalker class lets you walk over a LazyCondition tree to make modifications to it...
Definition: lazyconditionwalker.hpp:46
Type
Definition: lazyevaluation.hpp:69