wip:msvc phrase cast fix
This commit is contained in:
parent
0857a7b165
commit
2a60f0c00e
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1d3495bed909392cdf128e8ef6f8b3986b2c09b5
|
Subproject commit b3c550c5bb7c570b1b10492fcedf287c1915af39
|
||||||
|
|
@ -15,11 +15,11 @@ public:
|
||||||
AbstractFieldPhrase(className, s)
|
AbstractFieldPhrase(className, s)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
AssignmentPhrase operator =(const T &other) {
|
AssignmentPhrase operator =(const QVariant &other) {
|
||||||
return AssignmentPhrase(this, other);
|
return AssignmentPhrase(this, other);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConditionalPhrase operator ==(const T &other) {
|
ConditionalPhrase operator ==(const QVariant &other) {
|
||||||
return ConditionalPhrase(this, PhraseData::Equal, other);
|
return ConditionalPhrase(this, PhraseData::Equal, other);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,16 @@
|
||||||
|
|
||||||
NUT_BEGIN_NAMESPACE
|
NUT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
#define SPECIALIZATION_NUMERIC_MEMBER(type, op, cond) \
|
#define SPECIALIZATION_NUMERIC_MEMBER(type, op, cond) \
|
||||||
ConditionalPhrase operator op(const QVariant &other) \
|
ConditionalPhrase operator op(const QVariant &other) \
|
||||||
{ \
|
{ \
|
||||||
return ConditionalPhrase(this, cond, other); \
|
return ConditionalPhrase(this, cond, other); \
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class FieldPhrase<T, typename std::enable_if<std::is_integral<T>::value>::type>
|
class FieldPhrase<T, typename std::enable_if<
|
||||||
|
std::is_floating_point<T>::value || std::is_integral<T>::value
|
||||||
|
>::type>
|
||||||
: public AbstractFieldPhrase
|
: public AbstractFieldPhrase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -21,17 +23,6 @@ public:
|
||||||
AbstractFieldPhrase(className, s)
|
AbstractFieldPhrase(className, s)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
SPECIALIZATION_NUMERIC_MEMBER(type, <, PhraseData::Less)
|
|
||||||
SPECIALIZATION_NUMERIC_MEMBER(type, <=, PhraseData::LessEqual)
|
|
||||||
SPECIALIZATION_NUMERIC_MEMBER(type, >, PhraseData::Greater)
|
|
||||||
SPECIALIZATION_NUMERIC_MEMBER(type, >=, PhraseData::GreaterEqual)
|
|
||||||
SPECIALIZATION_NUMERIC_MEMBER(type, %, PhraseData::Mod)
|
|
||||||
|
|
||||||
SPECIALIZATION_NUMERIC_MEMBER(type, +, PhraseData::Add)
|
|
||||||
SPECIALIZATION_NUMERIC_MEMBER(type, -, PhraseData::Minus)
|
|
||||||
SPECIALIZATION_NUMERIC_MEMBER(type, *, PhraseData::Multiple)
|
|
||||||
SPECIALIZATION_NUMERIC_MEMBER(type, /, PhraseData::Divide)
|
|
||||||
|
|
||||||
AssignmentPhrase operator =(const QVariant &other) {
|
AssignmentPhrase operator =(const QVariant &other) {
|
||||||
return AssignmentPhrase(this, other);
|
return AssignmentPhrase(this, other);
|
||||||
}
|
}
|
||||||
|
|
@ -59,6 +50,17 @@ public:
|
||||||
{
|
{
|
||||||
return ConditionalPhrase(this, PhraseData::Minus, 1);
|
return ConditionalPhrase(this, PhraseData::Minus, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SPECIALIZATION_NUMERIC_MEMBER(type, <, PhraseData::Less)
|
||||||
|
SPECIALIZATION_NUMERIC_MEMBER(type, <=, PhraseData::LessEqual)
|
||||||
|
SPECIALIZATION_NUMERIC_MEMBER(type, >, PhraseData::Greater)
|
||||||
|
SPECIALIZATION_NUMERIC_MEMBER(type, >=, PhraseData::GreaterEqual)
|
||||||
|
SPECIALIZATION_NUMERIC_MEMBER(type, %, PhraseData::Mod)
|
||||||
|
|
||||||
|
SPECIALIZATION_NUMERIC_MEMBER(type, +, PhraseData::Add)
|
||||||
|
SPECIALIZATION_NUMERIC_MEMBER(type, -, PhraseData::Minus)
|
||||||
|
SPECIALIZATION_NUMERIC_MEMBER(type, *, PhraseData::Multiple)
|
||||||
|
SPECIALIZATION_NUMERIC_MEMBER(type, /, PhraseData::Divide)
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SPECIALIZATION_NUMERIC_TYPE(type) \
|
#define SPECIALIZATION_NUMERIC_TYPE(type) \
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
QT += testlib sql
|
QT += testlib sql
|
||||||
QT -= gui
|
|
||||||
|
|
||||||
TARGET = tst_datatypes
|
TARGET = tst_datatypes
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ void MainTest::no1()
|
||||||
void MainTest::numeric()
|
void MainTest::numeric()
|
||||||
{
|
{
|
||||||
FieldPhrase<int> n("main", "int");
|
FieldPhrase<int> n("main", "int");
|
||||||
|
FieldPhrase<float> f("main", "float");
|
||||||
|
|
||||||
auto p1 = n == 1;
|
auto p1 = n == 1;
|
||||||
auto p2 = n <= 1;
|
auto p2 = n <= 1;
|
||||||
|
|
@ -43,6 +44,12 @@ void MainTest::numeric()
|
||||||
auto p13 = ++n;
|
auto p13 = ++n;
|
||||||
auto p14 = n++;
|
auto p14 = n++;
|
||||||
auto p15 = n.between(1, 2);
|
auto p15 = n.between(1, 2);
|
||||||
|
auto p16 = n + 1 < n + 2;
|
||||||
|
|
||||||
|
auto p21 = p1 && p2;
|
||||||
|
auto p22 = p3 == p4;
|
||||||
|
auto p23 = f == n + 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainTest::string()
|
void MainTest::string()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue