From 6820886a2b5f00a61da094372007fb73282c63e5 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 26 Feb 2018 10:17:05 +0330 Subject: [PATCH] disabled cppcheck --- .travis.yml | 2 +- src/phrase.h | 17 +++++++++++++++++ test/basic/maintest.cpp | 8 ++++++++ test/basic/maintest.h | 1 + test/common/post.h | 1 + 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7fe3b3d..ab6919a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,7 +65,7 @@ install: - qmake -v before_script: - - cppcheck --error-exitcode=1 --quiet + #- cppcheck --error-exitcode=1 --quiet . - '[[ "$TRAVIS_OS_NAME" != linux || "$CXX" != clang++ ]] || export QMAKESPEC=linux-clang' - '[[ "$TRAVIS_OS_NAME" != linux || "$CXX" != g++ ]] || export QMAKESPEC=linux-g++' diff --git a/src/phrase.h b/src/phrase.h index 53b5326..8b22dfb 100644 --- a/src/phrase.h +++ b/src/phrase.h @@ -319,6 +319,23 @@ SPECIALIZATION_NUMERIC(qreal) return ConditionalPhrase(this, cond, val); \ } +template<> +class FieldPhrase : public AbstractFieldPhrase +{ +public: + FieldPhrase(const char *className, const char *s) : + AbstractFieldPhrase(className, s) + {} + + AssignmentPhrase operator =(const bool &other) { + return AssignmentPhrase(this, other); + } + operator ConditionalPhrase() + { + return ConditionalPhrase(this, PhraseData::Equal, !data->isNot); + } +}; + template<> class FieldPhrase : public AbstractFieldPhrase { diff --git a/test/basic/maintest.cpp b/test/basic/maintest.cpp index 5bc22f3..f7e491a 100644 --- a/test/basic/maintest.cpp +++ b/test/basic/maintest.cpp @@ -119,6 +119,14 @@ void MainTest::createPost2() qDebug() << "New post2 inserted with id:" << newPost->id(); } +void MainTest::selectPublicts() +{ + auto q = db.postTable()->query() + ->where(Post::isPublicField()) + ->toList(); + +} + void MainTest::selectPosts() { auto q = db.postTable()->query() diff --git a/test/basic/maintest.h b/test/basic/maintest.h index 5a56759..f03b91f 100644 --- a/test/basic/maintest.h +++ b/test/basic/maintest.h @@ -27,6 +27,7 @@ private slots: void createUser(); void createPost(); void createPost2(); + void selectPublicts(); void join(); void selectPosts(); void selectScoreAverage(); diff --git a/test/common/post.h b/test/common/post.h index ddf7936..7759b8c 100644 --- a/test/common/post.h +++ b/test/common/post.h @@ -27,6 +27,7 @@ class Post : public Table NUT_DECLARE_FIELD(QDateTime, saveDate, saveDate, setSaveDate) NUT_DECLARE_FIELD(QString, body, body, setBody) + NUT_DECLARE_FIELD(bool, isPublic, isPublic, setPublic) NUT_DECLARE_CHILD_TABLE(Comment, comments) NUT_DECLARE_CHILD_TABLE(Score, scores)