All Classes Functions Typedefs Enumerations Enumerator Properties Groups Pages
QDjangoWhere.h
/*
* Copyright (C) 2010-2012 Jeremy Lainé
* Contact: http://code.google.com/p/qdjango/
*
* This file is part of the QDjango Library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
#ifndef QDJANGO_WHERE_H
#define QDJANGO_WHERE_H
#include <QSharedDataPointer>
#include <QVariant>
#include "QDjango_p.h"
class QDjangoMetaModel;
class QDjangoQuery;
class QDjangoWherePrivate;
class QDJANGO_EXPORT QDjangoWhere
{
public:
enum Operation
{
None,
Equals,
NotEquals,
GreaterThan,
LessThan,
GreaterOrEquals,
LessOrEquals,
StartsWith,
EndsWith,
Contains,
IsIn,
IsNull
};
QDjangoWhere();
QDjangoWhere(const QDjangoWhere &other);
QDjangoWhere(const QString &key, QDjangoWhere::Operation operation, QVariant value);
~QDjangoWhere();
QDjangoWhere& operator=(const QDjangoWhere &other);
QDjangoWhere operator!() const;
QDjangoWhere operator&&(const QDjangoWhere &other) const;
QDjangoWhere operator||(const QDjangoWhere &other) const;
void bindValues(QDjangoQuery &query) const;
bool isAll() const;
bool isNone() const;
QString sql(const QSqlDatabase &db) const;
private:
QSharedDataPointer<QDjangoWherePrivate> d;
friend class QDjangoCompiler;
};
#endif