Nut
0.1
Main Page
Classes
Files
File List
src
wherephrase.h
1
/**************************************************************************
2
**
3
** This file is part of Nut project.
4
** https://github.com/HamedMasafi/Nut
5
**
6
** Nut is free software: you can redistribute it and/or modify
7
** it under the terms of the GNU Lesser General Public License as published by
8
** the Free Software Foundation, either version 3 of the License, or
9
** (at your option) any later version.
10
**
11
** Nut is distributed in the hope that it will be useful,
12
** but WITHOUT ANY WARRANTY; without even the implied warranty of
13
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
** GNU Lesser General Public License for more details.
15
**
16
** You should have received a copy of the GNU Lesser General Public License
17
** along with Nut. If not, see <http://www.gnu.org/licenses/>.
18
**
19
**************************************************************************/
20
21
#ifndef PHRASE_H
22
#define PHRASE_H
23
24
#include <QtCore/qglobal.h>
25
26
#include <QVariant>
27
#include <QDate>
28
#include <QDateTime>
29
#include <QTime>
30
#include <QSharedPointer>
31
32
QT_BEGIN_NAMESPACE
33
34
class
SqlGeneratorBase;
35
class
PhraseData
{
36
public
:
37
enum
Condition
38
{
39
NotAssign = 0,
40
Equal,
41
Less,
42
LessEqual,
43
Null,
44
In,
45
Like,
46
47
Not = 10,
48
NotEqual,
49
GreaterEqual,
50
Greater,
51
NotNull,
52
NotIn,
53
NotLike,
54
55
And = 20,
56
Or,
57
58
59
Append,
60
Set,
61
62
Add,
63
Minus,
64
Multiple,
65
Divide
66
};
67
68
enum
Type{
69
Field,
70
WithVariant,
71
WithOther,
72
WithoutOperand
73
};
74
Type type;
75
76
Condition operatorCond;
77
78
QString text;
79
const
PhraseData
*left;
80
const
PhraseData
*right;
81
QVariant operand;
82
83
PhraseData
(
const
char
*className,
const
char
* s);
84
PhraseData
(
PhraseData
*l, Condition o);
85
PhraseData
(
PhraseData
*l, Condition o,
const
PhraseData
*r);
86
PhraseData
(
PhraseData
*l, Condition o, QVariant r);
87
88
~
PhraseData
();
89
};
90
91
class
WherePhrase
{
92
protected
:
93
PhraseData
*_data;
94
QSharedPointer<PhraseData> _dataPointer;
95
96
public
:
97
WherePhrase
(
const
char
*className,
const
char
* s);
98
99
WherePhrase
(
const
WherePhrase
&l);
100
WherePhrase
(
WherePhrase
*l);
101
WherePhrase
(
WherePhrase
*l, PhraseData::Condition o);
102
WherePhrase
(
WherePhrase
*l, PhraseData::Condition o,
WherePhrase
*r);
103
WherePhrase
(
WherePhrase
*l, PhraseData::Condition o, QVariant r);
104
105
~
WherePhrase
();
106
107
WherePhrase
operator ==(
const
WherePhrase
&other);
108
WherePhrase
operator !=(
const
WherePhrase
&other);
109
WherePhrase
operator <(
const
WherePhrase
&other);
110
WherePhrase
operator >(
const
WherePhrase
&other);
111
WherePhrase
operator <=(
const
WherePhrase
&other);
112
WherePhrase
operator >=(
const
WherePhrase
&other);
113
114
WherePhrase
operator =(
const
WherePhrase
&other);
115
116
WherePhrase
operator +(
const
WherePhrase
&other);
117
WherePhrase
operator -(
const
WherePhrase
&other);
118
WherePhrase
operator *(
const
WherePhrase
&other);
119
WherePhrase
operator /(
const
WherePhrase
&other);
120
121
WherePhrase
operator &&(
const
WherePhrase
&other);
122
WherePhrase
operator ||(
const
WherePhrase
&other);
123
124
WherePhrase
operator &(
const
WherePhrase
&other);
125
126
127
WherePhrase
operator ==(
const
QVariant &other);
128
WherePhrase
operator !=(
const
QVariant &other);
129
WherePhrase
operator <(
const
QVariant &other);
130
WherePhrase
operator >(
const
QVariant &other);
131
WherePhrase
operator <=(
const
QVariant &other);
132
WherePhrase
operator >=(
const
QVariant &other);
133
134
135
PhraseData
*data()
const
;
136
};
137
138
class
FieldPhrase
:
public
WherePhrase
{
139
public
:
140
FieldPhrase
(
const
char
*className,
const
char
* s);
141
142
WherePhrase
operator =(
const
QVariant &other);
143
WherePhrase
operator !();
144
145
WherePhrase
isNull();
146
WherePhrase
in(QVariantList list);
147
WherePhrase
in(QStringList list);
148
WherePhrase
like(QString pattern);
149
};
150
151
152
//TODO: make FieldPhrase template class
153
//template <typename T>
154
//class FieldPhrase: public WherePhrase{
155
156
//};
157
158
QT_END_NAMESPACE
159
160
#endif // PHRASE_H
Generated on Sun Jun 5 2016 17:37:29 for Nut by
1.8.1.2