Nut/src/nut/phrases/fieldphrase_bool.h

43 lines
893 B
C
Raw Normal View History

2020-08-12 20:32:06 +08:00
#ifndef NUT_FIELDPHRASE_BOOL_H
#define NUT_FIELDPHRASE_BOOL_H
#include <QtNut/nut_global.h>
2020-08-12 20:32:06 +08:00
#include <QtNut/fieldphrase.h>
#include <QtNut/fieldphrase.h>
QT_BEGIN_NAMESPACE
2020-08-12 20:32:06 +08:00
NUT_BEGIN_NAMESPACE
template<>
class FieldPhrase<bool> : public AbstractFieldPhrase
{
public:
FieldPhrase(const char *className, const char *s) :
AbstractFieldPhrase(className, s)
{}
AssignmentPhrase operator =(const bool &other) {
return AssignmentPhrase(this, other);
}
FieldPhrase<bool> operator !()
{
FieldPhrase<bool> f(data->className, data->fieldName);
// f.data = new PhraseData(data);
f.data->isNot = !data->isNot;
return f;
}
operator ConditionalPhrase()
{
return ConditionalPhrase(this, PhraseData::Equal, !data->isNot);
}
};
NUT_END_NAMESPACE
QT_END_NAMESPACE
2020-08-12 20:32:06 +08:00
#endif // NUT_FIELDPHRASE_BOOL_H