qdjango-0.4.0/0000755000175000007640000000000012163016767013067 5ustar sharkyjerrywebqdjango-0.4.0/qdjango.pro0000644000175000007640000000140312163016632015221 0ustar sharkyjerrywebinclude(qdjango.pri) TEMPLATE = subdirs SUBDIRS = src android { } else { SUBDIRS += tests examples INSTALLS += htmldocs } CONFIG += ordered # Documentation generation docs.commands = cd doc/ && doxygen # Source distribution QDJANGO_ARCHIVE = qdjango-$$QDJANGO_VERSION dist.commands = \ $(DEL_FILE) -r $$QDJANGO_ARCHIVE && \ $(MKDIR) $$QDJANGO_ARCHIVE && \ git archive master | tar -x -C $$QDJANGO_ARCHIVE && \ $(COPY_DIR) doc/html $$QDJANGO_ARCHIVE/doc && \ tar czf $${QDJANGO_ARCHIVE}.tar.gz $$QDJANGO_ARCHIVE && \ $(DEL_FILE) -r $$QDJANGO_ARCHIVE dist.depends = docs # Install rules htmldocs.files = doc/html htmldocs.path = $$PREFIX/share/doc/qdjango htmldocs.CONFIG += no_check_exist directory QMAKE_EXTRA_TARGETS += dist docs qdjango-0.4.0/examples/0000755000175000007640000000000012163016632014674 5ustar sharkyjerrywebqdjango-0.4.0/examples/script-console/0000755000175000007640000000000012163016632017640 5ustar sharkyjerrywebqdjango-0.4.0/examples/script-console/script-console.pro0000644000175000007640000000050612163016632023327 0ustar sharkyjerrywebinclude(../../qdjango.pri) QT += script sql TARGET = qdjango-script-console INCLUDEPATH += ../../tests/db $$QDJANGO_INCLUDEPATH LIBS += \ -L../../src/db $$QDJANGO_DB_LIBS \ -L../../src/script $$QDJANGO_SCRIPT_LIBS HEADERS += ../../tests/db/auth-models.h SOURCES += script-console.cpp ../../tests/db/auth-models.cpp qdjango-0.4.0/examples/script-console/script-console.cpp0000644000175000007640000001337312163016632023317 0ustar sharkyjerryweb/* * 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. */ #include #include #include #include #include #include #include #include #include #include #include #include "QDjango.h" #include "QDjangoScript.h" #include "auth-models.h" static bool wantsToQuit; Q_DECLARE_METATYPE(QDjangoQuerySet) Q_DECLARE_METATYPE(QDjangoQuerySet) Q_DECLARE_METATYPE(QDjangoQuerySet) static QScriptValue qtscript_dir(QScriptContext *ctx, QScriptEngine *eng) { QObject *obj = ctx->argument(0).toQObject(); if (obj) { const QMetaObject* meta = obj->metaObject(); for(int i = meta->propertyOffset(); i < meta->propertyCount(); ++i) qDebug() << meta->property(i).name(); } return eng->undefinedValue(); } static QScriptValue qtscript_load(QScriptContext *ctx, QScriptEngine *eng) { QString name = ctx->argument(0).toString(); eng->importExtension(name); return eng->undefinedValue(); } static QScriptValue qtscript_quit(QScriptContext *ctx, QScriptEngine *eng) { Q_UNUSED(ctx); wantsToQuit = true; return eng->undefinedValue(); } static QScriptValue qtscript_syncdb(QScriptContext *ctx, QScriptEngine *eng) { Q_UNUSED(ctx); QDjango::createTables(); return eng->undefinedValue(); } static void interactive(QScriptEngine *eng) { QScriptValue global = eng->globalObject(); if (!global.property(QLatin1String("dir")).isValid()) global.setProperty(QLatin1String("dir"), eng->newFunction(qtscript_dir)); if (!global.property(QLatin1String("load")).isValid()) global.setProperty(QLatin1String("load"), eng->newFunction(qtscript_load)); if (!global.property(QLatin1String("quit")).isValid()) global.setProperty(QLatin1String("quit"), eng->newFunction(qtscript_quit)); if (!global.property(QLatin1String("syncdb")).isValid()) global.setProperty(QLatin1String("syncdb"), eng->newFunction(qtscript_syncdb)); wantsToQuit = false; QTextStream qin(stdin, QIODevice::ReadOnly); const char *qscript_prompt = "qdjango> "; const char *dot_prompt = ".... "; const char *prompt = qscript_prompt; QString code; printf("Commands:\n" "\tdir(obj) : print the object's properties\n" "\tload() : loads a QtScript extension\n" "\tquit() : exits console\n" "\tsyncdb() : creates database tables\n"); forever { QString line; printf("%s", prompt); fflush(stdout); line = qin.readLine(); if (line.isNull()) break; code += line; code += QLatin1Char('\n'); if (line.trimmed().isEmpty()) { continue; } else if (! eng->canEvaluate(code)) { prompt = dot_prompt; } else { QScriptValue result = eng->evaluate(code, QLatin1String("typein")); code.clear(); prompt = qscript_prompt; if (! result.isUndefined()) fprintf(stderr, "%s\n", qPrintable(result.toString())); if (wantsToQuit) break; } } } void usage() { fprintf(stderr, "Usage: qdjango-console [options]\n\n"); fprintf(stderr, "Options:\n"); fprintf(stderr, "-d use \n"); fprintf(stderr, "-p add to plugins search path\n"); } int main(int argc, char *argv[]) { QString databaseName(":memory:"); /* Create application */ QCoreApplication app(argc, argv); /* Parse command line arguments */ for (int i = 1; i < argc; i++) { if (!strcmp(argv[i], "-h")) { usage(); return EXIT_SUCCESS; } else if (!strcmp(argv[i], "-d")) { if (i == argc - 1 || !strlen(argv[i+1]) || argv[i+1][0] == '-') { fprintf(stderr, "Option -d requires an argument\n"); usage(); return EXIT_FAILURE; } databaseName = QString::fromLocal8Bit(argv[++i]); } else if (!strcmp(argv[i], "-p")) { if (i == argc - 1 || !strlen(argv[i+1]) || argv[i+1][0] == '-') { fprintf(stderr, "Option -p requires an argument\n"); usage(); return EXIT_FAILURE; } app.setLibraryPaths(app.libraryPaths() << QString::fromLocal8Bit(argv[++i])); } } /* Open database */ QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName(databaseName); if (!db.open()) { fprintf(stderr, "Could not access database '%s'\n", databaseName.toLocal8Bit().constData()); return EXIT_FAILURE; } QDjango::setDatabase(db); /* Run interactive shell */ QScriptEngine *engine = new QScriptEngine(); QDjangoScript::registerWhere(engine); QDjangoScript::registerModel(engine); QDjangoScript::registerModel(engine); QDjangoScript::registerModel(engine); qDebug() << "Available extensions: " << engine->availableExtensions(); interactive(engine); return EXIT_SUCCESS; } qdjango-0.4.0/examples/examples.pro0000644000175000007640000000007012163016632017231 0ustar sharkyjerrywebTEMPLATE = subdirs SUBDIRS = http-server script-console qdjango-0.4.0/examples/http-server/0000755000175000007640000000000012163016632017157 5ustar sharkyjerrywebqdjango-0.4.0/examples/http-server/http-server.pro0000644000175000007640000000055012163016632022164 0ustar sharkyjerrywebinclude(../../qdjango.pri) QT += network sql TARGET = qdjango-http-server INCLUDEPATH += ../../tests/db $$QDJANGO_INCLUDEPATH LIBS += \ -L../../src/db $$QDJANGO_DB_LIBS \ -L../../src/http $$QDJANGO_HTTP_LIBS RESOURCES += http-server.qrc HEADERS += http-server.h ../../tests/db/auth-models.h SOURCES += http-server.cpp ../../tests/db/auth-models.cpp qdjango-0.4.0/examples/http-server/base.css0000644000175000007640000000330112163016632020600 0ustar sharkyjerrywebbody { font-family: "Lucida Grande","DejaVu Sans","Bitstream Vera Sans",Verdana,Arial,sans-serif; font-size 12px; margin: 0; padding: 0; } a:link, a:visited { color: #5B80B2; text-decoration: none; } h1 { color: #666666; font-size: 18px; margin: 0 0 0.2em; padding: 0 6px 0 0; } input[type="text"], input[type="password"], textarea, select { border: 1px solid #CCCCCC; } table { border-collapse: collapse; } td, th { font-size: 11px; line-height: 13px; border-bottom: 1px solid #eee; vertical-align: top; padding: 5px; text-align: left; } th { color: #666; padding: 2px 5px; font-weight: bold; background: #e1e1e1; background-image: linear-gradient(bottom, rgb(255,255,255) 10%, rgb(245,245,245) 100%); background-image: -moz-linear-gradient(top, rgb(255,255,255) 10%, rgb(245,245,245) 100%); background-image: -webkit-linear-gradient(top, rgb(255,255,255) 10%, rgb(245,245,245) 100%); border-left: 1px solid #ddd; border-bottom: 1px solid #ddd; } #header { background: none repeat scroll 0 0 #417690; color: #FFFFCC; overflow: hidden; } #header h1 { color: #F4F379; font-size: 18px; font-weight: normal; margin: 8px 0; padding: 0 10px; } #content { margin: 10px 15px; } .breadcrumbs { background: white; border-bottom: 1px solid #CCCCCC; border-top: 1px solid white; color: #999999; font-size: 11px; padding: 2px 8px 3px; text-align: left; } .module { background: none repeat scroll 0 0 white; border: 1px solid #CCCCCC; margin-bottom: 5px; } .aligned label { display: inline-block; padding: 3px 10px 0 0; width: 8em; } qdjango-0.4.0/examples/http-server/http-server.h0000644000175000007640000000370412163016632021617 0ustar sharkyjerryweb/* * 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. */ #include class QDjangoHttpRequest; class QDjangoHttpResponse; class QDjangoUrlResolver; class AdminControllerPrivate; class ModelAdminFetcher; class ModelAdminPrivate; class AdminController : public QObject { Q_OBJECT public: AdminController(QObject* parent = 0); void setupUrls(QDjangoUrlResolver *urls); public slots: QDjangoHttpResponse* index(const QDjangoHttpRequest &request); QDjangoHttpResponse* staticFiles(const QDjangoHttpRequest &request, const QString &path); private: AdminControllerPrivate *d; }; class ModelAdmin : public QObject { Q_OBJECT public: ModelAdmin(ModelAdminFetcher *fetcher, QObject *parent = 0); ~ModelAdmin(); QList changeFields() const; void setChangeFields(const QList fields); QList listFields() const; void setListFields(const QList fields); QDjangoUrlResolver *urls() const; public slots: QDjangoHttpResponse* addForm(const QDjangoHttpRequest &request); QDjangoHttpResponse* changeForm(const QDjangoHttpRequest &request, const QString &objectId); QDjangoHttpResponse* changeList(const QDjangoHttpRequest &request); QDjangoHttpResponse* deleteForm(const QDjangoHttpRequest &request, const QString &objectId); private: ModelAdminPrivate *d; }; qdjango-0.4.0/examples/http-server/templates/0000755000175000007640000000000012163016632021155 5ustar sharkyjerrywebqdjango-0.4.0/examples/http-server/templates/header.html0000644000175000007640000000137712163016632023303 0ustar sharkyjerryweb {{ title }} | Test application {% comment %} test {% endcomment %}

{{ title }}

qdjango-0.4.0/examples/http-server/templates/delete_confirmation.html0000644000175000007640000000034312163016632026055 0ustar sharkyjerryweb{% include "header.html" %}

Are you sure you want to delete the {{ model_name }} "{{ original.username }}"?

{% include "footer.html" %} qdjango-0.4.0/examples/http-server/templates/change_form.html0000644000175000007640000000075612163016632024323 0ustar sharkyjerryweb{% include "header.html" %}
{% for field in field_list %}
{% endfor %}
{% include "footer.html" %} qdjango-0.4.0/examples/http-server/templates/footer.html0000644000175000007640000000002712163016632023340 0ustar sharkyjerryweb
qdjango-0.4.0/examples/http-server/templates/change_list.html0000644000175000007640000000137712163016632024333 0ustar sharkyjerryweb{% include "header.html" %}
{% for field in field_list %} {% endfor %} {% for object in object_list %} {% if model_name == "user" %} {% endif %} {% if model_name == "group" %} {% endif %} {% endfor %}
{{ field.name }}
{{ object.username }} {{ object.email }} {{ object.first_name }} {{ object.last_name }}{{ object.name }}
{% include "footer.html" %} qdjango-0.4.0/examples/http-server/templates/base.html0000644000175000007640000000007012163016632022752 0ustar sharkyjerryweb{% include "header.html" %} {% include "footer.html" %} qdjango-0.4.0/examples/http-server/templates/index.html0000644000175000007640000000063512163016632023156 0ustar sharkyjerryweb{% include "header.html" %}
{% for model in model_list %} {% endfor %}
{{ model }} Add Change
{% include "footer.html" %} qdjango-0.4.0/examples/http-server/http-server.qrc0000644000175000007640000000053512163016632022154 0ustar sharkyjerryweb base.css templates/change_form.html templates/change_list.html templates/delete_confirmation.html templates/footer.html templates/header.html templates/index.html qdjango-0.4.0/examples/http-server/http-server.cpp0000644000175000007640000004062712163016632022157 0ustar sharkyjerryweb/* * 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. */ #include #include #include #include #include #include #include "QDjango.h" #include "QDjangoQuerySet.h" #include "QDjangoFastCgiServer.h" #include "QDjangoHttpController.h" #include "QDjangoHttpRequest.h" #include "QDjangoHttpResponse.h" #include "QDjangoHttpServer.h" #include "QDjangoUrlResolver.h" #include "auth-models.h" #include "http-server.h" class ModelAdminFetcher { public: virtual QDjangoModel *createObject() const = 0; virtual QVariantMap dumpObject(const QObject *object) const = 0; virtual QDjangoModel *getObject(const QString& objectId) const = 0; virtual QVariantList listObjects() const = 0; virtual QString modelName() const = 0; }; template class ModelAdminFetcherImpl : public ModelAdminFetcher { public: QDjangoModel *createObject() const { return new T; } QVariantMap dumpObject(const QObject *object) const { const QMetaObject *metaObject = object->metaObject(); QVariantMap props; props.insert("pk", object->property("pk")); for (int i = metaObject->propertyOffset(); i < metaObject->propertyCount(); ++i) { const char *key = metaObject->property(i).name(); props.insert(key, object->property(key)); } return props; } QDjangoModel *getObject(const QString& objectId) const { return QDjangoQuerySet().get(QDjangoWhere("pk", QDjangoWhere::Equals, objectId)); } QVariantList listObjects() const { QVariantList objectList; QDjangoQuerySet objects; foreach (const T &obj, objects) objectList << dumpObject(&obj); return objectList; } QString modelName() const { return QString::fromLatin1(T::staticMetaObject.className()).toLower(); } }; static QVariant evaluate(const QString &input, const QVariantMap &context) { const QStringList bits = input.split("."); QVariant value = context; foreach (const QString &bit, bits) { value = value.toMap().value(bit); } //qDebug("evaluate(%s): %s", qPrintable(input), qPrintable(value.toString())); return value; } static QString substitute(const QString &input, const QVariantMap &context) { QRegExp valRx("\\{\\{ +([a-z_\\.]+) +\\}\\}"); QString output; int pos = 0; int lastPos = 0; while ((pos = valRx.indexIn(input, lastPos)) != -1) { output += input.mid(lastPos, pos - lastPos); lastPos = pos + valRx.matchedLength(); output += evaluate(valRx.cap(1), context).toString(); } output += input.mid(lastPos); return output; } typedef QPair Node; static QList tokenize(const QString &input) { QList output; QRegExp tagRx("\\{% +([^%]+) +%\\}"); int pos = 0; int lastPos = 0; while ((pos = tagRx.indexIn(input, lastPos)) != -1) { if (pos > lastPos) output << qMakePair(false, input.mid(lastPos, pos - lastPos)); lastPos = pos + tagRx.matchedLength(); output << qMakePair(true, tagRx.cap(1)); } output << qMakePair(false, input.mid(lastPos)); return output; } static int findBalancing(const QList nodes, const QString &closeTag, int pos, int *elsePos = 0) { const QString openTag = nodes[pos].second.split(" ").first(); int level = 0; if (elsePos) *elsePos = -1; for (pos = pos + 1; pos < nodes.size(); ++pos) { if (nodes[pos].first && nodes[pos].second.startsWith(openTag)) { level++; } else if (nodes[pos].first && nodes[pos].second == closeTag) { if (!level) return pos; level--; } else if (!level && nodes[pos].second == "else") { if (elsePos) *elsePos = pos; } } qWarning("Could not find %s tag", qPrintable(closeTag)); return -1; } QString renderTemplate(const QString &name, const QVariantMap &context); static QString render(const QList &nodes, const QVariantMap &context) { QRegExp forRx("for ([a-z_]+) in ([a-z_\\.]+)"); QRegExp includeRx("include \"([^\"]+)\""); QString output; for (int i = 0; i < nodes.size(); ++i) { const Node &node = nodes[i]; if (node.first) { //qDebug("Processing tag %s", qPrintable(node.second)); QStringList tagArgs = node.second.split(" "); const QString tagName = tagArgs.takeFirst(); if (node.second == "comment") { const int endPos = findBalancing(nodes, "endcomment", i++); if (endPos < 0) return output; i = endPos; } else if (forRx.exactMatch(node.second)) { const int endPos = findBalancing(nodes, "endfor", i++); if (endPos < 0) return output; const QVariantList list = evaluate(forRx.cap(2), context).toList(); QVariantMap forLoop; int counter0 = 0; foreach (const QVariant &val, list) { forLoop.insert("counter", counter0 + 1); forLoop.insert("counter0", counter0); if (!counter0) forLoop.insert("first", true); QVariantMap subContext = context; subContext.insert(forRx.cap(1), val); subContext.insert("forloop", forLoop); output += render(nodes.mid(i, endPos - i), subContext); counter0++; } i = endPos; } else if (tagName == "if") { int elsePos = -1; const int endPos = findBalancing(nodes, "endif", i++, &elsePos); if (endPos < 0) return output; bool isTrue = false; QRegExp ifRx("if ([a-z_\\.]+) (!=|==) \"([^\"]*)\""); if (ifRx.exactMatch(node.second)) { const QVariant value = evaluate(ifRx.cap(1), context); const QString op = ifRx.cap(2); const QString opValue = ifRx.cap(3); if ((op == "==" && value.toString() == opValue) || (op == "!=" && value.toString() != opValue)) { isTrue = true; } } else if (tagArgs.size() == 1) { const QVariant value = evaluate(tagArgs[0], context); if (value.toList().size() || value.toMap().size() || value.toString().size()) isTrue = true; } if (isTrue) { output += render(nodes.mid(i, (elsePos > 0 ? elsePos : endPos) - i), context); } else if (elsePos > 0) { output += render(nodes.mid(elsePos, endPos - elsePos), context); } i = endPos; } else if (includeRx.exactMatch(node.second)) { output += renderTemplate(":/templates/" + includeRx.cap(1), context); } } else { output += substitute(node.second, context); } } return output; } QString renderTemplate(const QString &name, const QVariantMap &context) { QFile templ(name); if (templ.open(QIODevice::ReadOnly)) { const QString data = QString::fromUtf8(templ.readAll()); return render(tokenize(data), context); } return QString(); } static QDjangoHttpResponse *renderToResponse(const QDjangoHttpRequest &request, const QString &name, const QVariantMap &context) { Q_UNUSED(request); QDjangoHttpResponse *response = new QDjangoHttpResponse; response->setHeader("Content-Type", "text/html; charset=utf-8"); response->setBody(renderTemplate(name, context).toUtf8()); return response; } class ModelAdminPrivate { public: QDjangoHttpResponse* redirectHome(const QDjangoHttpRequest &request) { return QDjangoHttpController::serveRedirect(request, QUrl("/" + modelFetcher->modelName() + "/")); } QList changeFields; QList listFields; ModelAdminFetcher *modelFetcher; QDjangoUrlResolver *urlResolver; }; ModelAdmin::ModelAdmin(ModelAdminFetcher *fetcher, QObject *parent) : QObject(parent) { d = new ModelAdminPrivate; d->modelFetcher = fetcher; d->urlResolver = new QDjangoUrlResolver(this); d->urlResolver->set(QRegExp("^$"), this, "changeList"); d->urlResolver->set(QRegExp("^add/$"), this, "addForm"); d->urlResolver->set(QRegExp("^([0-9]+)/"), this, "changeForm"); d->urlResolver->set(QRegExp("^([0-9]+)/delete/"), this, "deleteForm"); } ModelAdmin::~ModelAdmin() { delete d; } QList ModelAdmin::changeFields() const { return d->changeFields; } void ModelAdmin::setChangeFields(const QList fields) { d->changeFields = fields; } QList ModelAdmin::listFields() const { return d->listFields; } void ModelAdmin::setListFields(const QList fields) { d->listFields = fields; } QDjangoHttpResponse* ModelAdmin::addForm(const QDjangoHttpRequest &request) { const QString modelName = d->modelFetcher->modelName(); // collect fields QVariantList fieldList; foreach (const QByteArray &key, d->changeFields) { QVariantMap props; props.insert("key", key); props.insert("name", QByteArray(key).replace("_", " ")); fieldList << props; } if (request.method() == "POST") { QDjangoModel *obj = d->modelFetcher->createObject(); foreach (const QByteArray &key, d->changeFields) obj->setProperty(key, request.post(key)); obj->save(); delete obj; return d->redirectHome(request); } else { QVariantMap context; context.insert("model_name", modelName); context.insert("field_list", fieldList); context.insert("title", QString("Add %1").arg(modelName)); return renderToResponse(request, ":/templates/change_form.html", context); } } QDjangoHttpResponse* ModelAdmin::changeForm(const QDjangoHttpRequest &request, const QString &objectId) { QDjangoModel *original = d->modelFetcher->getObject(objectId); if (!original) return QDjangoHttpController::serveNotFound(request); // collect fields QVariantList fieldList; foreach (const QByteArray &key, d->changeFields) { QVariantMap props; props.insert("key", key); props.insert("name", QByteArray(key).replace("_", " ")); props.insert("value", original->property(key)); fieldList << props; } if (request.method() == "POST") { foreach (const QByteArray &key, d->changeFields) original->setProperty(key, request.post(key)); original->save(); return d->redirectHome(request); } else { const QString modelName = d->modelFetcher->modelName(); QVariantMap context; context.insert("model_name", modelName); context.insert("field_list", fieldList); context.insert("original", d->modelFetcher->dumpObject(original)); context.insert("title", QString("Change %1").arg(modelName)); return renderToResponse(request, ":/templates/change_form.html", context); } } QDjangoHttpResponse* ModelAdmin::changeList(const QDjangoHttpRequest &request) { QVariantList objectList = d->modelFetcher->listObjects(); QVariantList fieldList; foreach (const QByteArray &key, d->listFields) { QVariantMap props; props.insert("key", key); props.insert("name", QByteArray(key).replace("_", " ")); fieldList << props; } const QString modelName = d->modelFetcher->modelName(); QVariantMap context; context.insert("title", QString("Select %1 to change").arg(modelName)); context.insert("add_link", QString("Add %1").arg(modelName)); context.insert("model_name", modelName); context.insert("field_list", fieldList); context.insert("object_list", objectList); return renderToResponse(request, ":/templates/change_list.html", context); } QDjangoHttpResponse* ModelAdmin::deleteForm(const QDjangoHttpRequest &request, const QString &objectId) { QDjangoModel *original = d->modelFetcher->getObject(objectId); if (!original) return QDjangoHttpController::serveNotFound(request); if (request.method() == "POST") { original->remove(); return d->redirectHome(request); } else { const QString modelName = d->modelFetcher->modelName(); QVariantMap context; context.insert("model_name", modelName); context.insert("original", d->modelFetcher->dumpObject(original)); context.insert("title", "Are you sure?"); return renderToResponse(request, ":/templates/delete_confirmation.html", context); } } QDjangoUrlResolver *ModelAdmin::urls() const { return d->urlResolver; } class AdminControllerPrivate { public: }; AdminController::AdminController(QObject *parent) : QObject(parent) , d(new AdminControllerPrivate) { const QString databaseName("test.db"); /* Open database */ QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName(databaseName); if (!db.open()) { qWarning("Could not access database '%s'\n", qPrintable(databaseName)); return; } QDjango::setDatabase(db); QDjango::registerModel(); QDjango::registerModel(); QDjango::createTables(); } QDjangoHttpResponse* AdminController::index(const QDjangoHttpRequest &request) { QVariantMap context; context.insert("model_list", QStringList() << "group" << "user"); context.insert("title", "Administration"); return renderToResponse(request, ":/templates/index.html", context); } QDjangoHttpResponse* AdminController::staticFiles(const QDjangoHttpRequest &request, const QString &path) { Q_UNUSED(path); return QDjangoHttpController::serveStatic(request, ":/base.css"); } void usage() { fprintf(stderr, "Usage: command [options]\n\n"); fprintf(stderr, "Available commands:\n"); fprintf(stderr, "runfcgi\n"); fprintf(stderr, "runserver\n"); } void AdminController::setupUrls(QDjangoUrlResolver *urls) { urls->set(QRegExp("^$"), this, "index"); urls->set(QRegExp("^static/admin/(.+)$"), this, "staticFiles"); ModelAdmin *groupAdmin = new ModelAdmin(new ModelAdminFetcherImpl); groupAdmin->setChangeFields(QList() << "name"); groupAdmin->setListFields(QList() << "name"); urls->include(QRegExp("^group/"), groupAdmin->urls()); ModelAdmin *userAdmin = new ModelAdmin(new ModelAdminFetcherImpl); userAdmin->setChangeFields(QList() << "username" << "email" << "first_name" << "last_name"); userAdmin->setListFields(QList() << "username" << "email" << "first_name" << "last_name"); urls->include(QRegExp("^user/"), userAdmin->urls()); } int main(int argc, char* argv[]) { QCoreApplication app(argc, argv); AdminController controller; const quint16 port = 8000; if (argc < 2) { usage(); return EXIT_FAILURE; } QDjangoUrlResolver urls; if (!strcmp(argv[1], "runfcgi")) { QDjangoFastCgiServer *server = new QDjangoFastCgiServer; controller.setupUrls(server->urls()); if (!server->listen(QHostAddress::Any, port)) { qWarning("Could not start listening on port %i", port); return EXIT_FAILURE; } } else if (!strcmp(argv[1], "runserver")) { QDjangoHttpServer *server = new QDjangoHttpServer; controller.setupUrls(server->urls()); if (!server->listen(QHostAddress::Any, port)) { qWarning("Could not start listening on port %i", port); return EXIT_FAILURE; } } else { usage(); return EXIT_FAILURE; } return app.exec(); } qdjango-0.4.0/ChangeLog0000644000175000007640000000204612163016632014632 0ustar sharkyjerrywebQDjango 0.4.0 (2013-06-27) * Enable foreign key constraints on SQLite (issue #9). * Fix table creation with foreign key constraints on PostgreSQL (issue #10). * Expose QDjangoMetaField's properties (issue #13). * Fix http module build with Qt5. QDjango 0.3.0 (2013-01-11) * Fix and test "unique" field option. * Add a "unique_together" model option. * Don't crash if QDjango::database() is called before QDjango::setDatabase(). * Make index names coincide with those used by django. * Register models without instantiating them. * Improve foreign keys: - Do not take object ownership in QDjangoMetaModel::setForeignKey(). - Fix QDjangoQuerySet::selectRelated() with NULL foreign keys. QDjango 0.2.6 (2012-09-07) * Store 0 integer foreign keys as NULL if field has null option. * Make it possible to build with Qt5: - Stop using deprecated QHttpRequestHeader and QHttpResponseHeader classes. - Use QMetaMethod::name() instead of QMetaMethod::signature() when using Qt5. QDjango 0.2.5 (2012-05-16) * Build a shared library by default. qdjango-0.4.0/AUTHORS0000644000175000007640000000023612163016632014127 0ustar sharkyjerrywebJeremy Lainé * Principal developer of QDjango. Mathias Hasselmann * Support for QDjangoQuerySet iterators. qdjango-0.4.0/src/0000755000175000007640000000000012163016632013645 5ustar sharkyjerrywebqdjango-0.4.0/src/src.pri0000644000175000007640000000103412163016632015146 0ustar sharkyjerrywebTEMPLATE = lib CONFIG += $$QDJANGO_LIBRARY_TYPE DEFINES += QDJANGO_BUILD VERSION = $$QDJANGO_VERSION # Installation headers.files = $$HEADERS target.path = $$PREFIX/$$LIBDIR INSTALLS += headers target # pkg-config support CONFIG += create_pc create_prl no_install_prl QMAKE_PKGCONFIG_DESTDIR = pkgconfig QMAKE_PKGCONFIG_LIBDIR = $$target.path equals(QDJANGO_LIBRARY_TYPE,staticlib) { QMAKE_PKGCONFIG_CFLAGS = -DQDJANGO_STATIC } else { QMAKE_PKGCONFIG_CFLAGS = -DQDJANGO_SHARED } unix:QMAKE_CLEAN += -r pkgconfig lib$${TARGET}.prl qdjango-0.4.0/src/http/0000755000175000007640000000000012163016632014624 5ustar sharkyjerrywebqdjango-0.4.0/src/http/QDjangoUrlResolver.h0000644000175000007640000000311612163016632020526 0ustar sharkyjerryweb/* * 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_URL_RESOLVER_H #define QDJANGO_URL_RESOLVER_H #include #include #include "QDjangoHttp_p.h" class QDjangoHttpRequest; class QDjangoHttpResponse; class QDjangoUrlResolverPrivate; class QRegExp; /** \brief The QDjangoUrlResolver class maps incoming HTTP requests to handlers. * * \ingroup Http */ class QDJANGO_EXPORT QDjangoUrlResolver : public QObject { Q_OBJECT public: QDjangoUrlResolver(QObject *parent = 0); ~QDjangoUrlResolver(); bool include(const QRegExp &path, QDjangoUrlResolver *urls); bool set(const QRegExp &path, QObject *receiver, const char *member); QString reverse(QObject *receiver, const char *member, const QVariantList &args = QVariantList()) const; public slots: QDjangoHttpResponse* respond(const QDjangoHttpRequest &request, const QString &path) const; private: QDjangoUrlResolverPrivate *d; friend class QDjangoUrlResolverPrivate; }; #endif qdjango-0.4.0/src/http/QDjangoFastCgiServer.cpp0000644000175000007640000003140712163016632021310 0ustar sharkyjerryweb/* * 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. */ #include #include #include #include #include "QDjangoFastCgiServer.h" #include "QDjangoFastCgiServer_p.h" #include "QDjangoHttpController.h" #include "QDjangoHttpRequest.h" #include "QDjangoHttpRequest_p.h" #include "QDjangoHttpResponse.h" #include "QDjangoHttpResponse_p.h" #include "QDjangoHttpServer.h" #include "QDjangoUrlResolver.h" //#define QDJANGO_DEBUG_FCGI #define FCGI_HEADER_LEN 8 #define FCGI_BEGIN_REQUEST 1 #define FCGI_ABORT_REQUEST 2 #define FCGI_END_REQUEST 3 #define FCGI_PARAMS 4 #define FCGI_STDIN 5 #define FCGI_STDOUT 6 typedef struct { unsigned char version; unsigned char type; unsigned char requestIdB1; unsigned char requestIdB0; unsigned char contentLengthB1; unsigned char contentLengthB0; unsigned char paddingLength; unsigned char reserved; } FCGI_Header; #ifdef QDJANGO_DEBUG_FCGI static void qDebug(FCGI_Header *header, const char *dir) { const quint16 requestId = (header->requestIdB1 << 8) | header->requestIdB0; const quint16 contentLength = (header->contentLengthB1 << 8) | header->contentLengthB0; qDebug("--- FCGI Record %s ---", dir); qDebug("version: %i", header->version); qDebug("type: %i", header->type); qDebug("requestId: %i", requestId); qDebug("contentLength: %i", contentLength); qDebug("paddingLength: %i", header->paddingLength); } #endif /// \cond QDjangoFastCgiConnection::QDjangoFastCgiConnection(QIODevice *device, QDjangoFastCgiServer *server) : QObject(server), m_device(device), m_inputPos(0), m_pendingRequest(0), m_pendingRequestId(0), m_server(server) { bool check; Q_UNUSED(check); m_device->setParent(this); check = connect(m_device, SIGNAL(disconnected()), this, SIGNAL(closed())); Q_ASSERT(check); check = connect(m_device, SIGNAL(bytesWritten(qint64)), this, SLOT(_q_bytesWritten(qint64))); Q_ASSERT(check); check = connect(m_device, SIGNAL(readyRead()), this, SLOT(_q_readyRead())); Q_ASSERT(check); } QDjangoFastCgiConnection::~QDjangoFastCgiConnection() { if (m_pendingRequest) delete m_pendingRequest; } void QDjangoFastCgiConnection::writeResponse(quint16 requestId, QDjangoHttpResponse *response) { // serialise HTTP response QString httpHeader = QString::fromLatin1("Status: %1 %2\r\n").arg(response->d->statusCode).arg(response->d->reasonPhrase); QList >::ConstIterator it = response->d->headers.constBegin(); while (it != response->d->headers.constEnd()) { httpHeader += (*it).first + QLatin1String(": ") + (*it).second + QLatin1String("\r\n"); ++it; } const QByteArray data = httpHeader.toUtf8() + "\r\n" + response->d->body; const char *ptr = data.constData(); FCGI_Header *header = (FCGI_Header*)m_outputBuffer; memset(header, 0, FCGI_HEADER_LEN); header->version = 1; header->requestIdB1 = (requestId >> 8) & 0xff; header->requestIdB0 = (requestId & 0xff); for (qint64 bytesRemaining = data.size(); ; ) { const quint16 contentLength = qMin(bytesRemaining, qint64(32768)); header->type = FCGI_STDOUT; header->contentLengthB1 = (contentLength >> 8) & 0xff; header->contentLengthB0 = (contentLength & 0xff); memcpy(m_outputBuffer + FCGI_HEADER_LEN, ptr, contentLength); m_device->write(m_outputBuffer, FCGI_HEADER_LEN + contentLength); #ifdef QDJANGO_DEBUG_FCGI qDebug(header, "sent"); qDebug("[STDOUT]"); #endif if (contentLength > 0) { ptr += contentLength; bytesRemaining -= contentLength; } else { break; } } quint16 contentLength = 8; header->type = FCGI_END_REQUEST; header->contentLengthB1 = (contentLength >> 8) & 0xff; header->contentLengthB0 = (contentLength & 0xff); memset(m_outputBuffer + FCGI_HEADER_LEN, 0, contentLength); m_device->write(m_outputBuffer, FCGI_HEADER_LEN + contentLength); #ifdef QDJANGO_DEBUG_FCGI qDebug(header, "sent"); qDebug("[END REQUEST]"); #endif } /** When bytes have been written, check whether we need to close * the connection. * * @param bytes */ void QDjangoFastCgiConnection::_q_bytesWritten(qint64 bytes) { Q_UNUSED(bytes); if (!m_device->bytesToWrite()) { m_device->close(); emit closed(); } } void QDjangoFastCgiConnection::_q_readyRead() { while (m_device->bytesAvailable()) { // read record header if (m_inputPos < FCGI_HEADER_LEN) { const qint64 length = m_device->read(m_inputBuffer + m_inputPos, FCGI_HEADER_LEN - m_inputPos); if (length < 0) { qWarning("Failed to read header from socket"); m_device->close(); emit closed(); return; } m_inputPos += length; if (m_inputPos < FCGI_HEADER_LEN) return; } // read record body FCGI_Header *header = (FCGI_Header*)m_inputBuffer; const quint16 contentLength = (header->contentLengthB1 << 8) | header->contentLengthB0; const quint16 bodyLength = contentLength + header->paddingLength; const qint64 length = m_device->read(m_inputBuffer + m_inputPos, bodyLength + FCGI_HEADER_LEN - m_inputPos); if (length < 0) { qWarning("Failed to read body from socket"); m_device->close(); emit closed(); return; } m_inputPos += length; if (m_inputPos < FCGI_HEADER_LEN + bodyLength) return; m_inputPos = 0; // process record #ifdef QDJANGO_DEBUG_FCGI qDebug(header, "received"); #endif const quint16 requestId = (header->requestIdB1 << 8) | header->requestIdB0; char *p = m_inputBuffer + FCGI_HEADER_LEN; switch (header->type) { case FCGI_BEGIN_REQUEST: { #ifdef QDJANGO_DEBUG_FCGI const quint16 role = (p[0] << 8) | p[1]; qDebug("[BEGIN REQUEST]"); qDebug("role: %i", role); qDebug("flags: %i", p[2]); #endif if (m_pendingRequest) { qWarning("Received FCGI_BEGIN_REQUEST inside a request"); m_device->close(); emit closed(); break; } m_pendingRequest = new QDjangoHttpRequest; m_pendingRequestId = requestId; break; } case FCGI_ABORT_REQUEST: m_device->close(); emit closed(); break; case FCGI_PARAMS: #ifdef QDJANGO_DEBUG_FCGI qDebug("[PARAMS]"); #endif if (!m_pendingRequest || requestId != m_pendingRequestId) { qWarning("Received FCGI_PARAMS outside a request"); m_device->close(); emit closed(); break; } while (p < m_inputBuffer + FCGI_HEADER_LEN + contentLength) { quint32 nameLength; quint32 valueLength; if (p[0] >> 7) { nameLength = ((p[0] & 0x7f) << 24) | (p[1] << 16) | (p[2] << 8) | p[3]; p += 4; } else { nameLength = p[0]; p++; } if (p[0] >> 7) { valueLength = ((p[0] & 0x7f) << 24) | (p[1] << 16) | (p[2] << 8) | p[3]; p += 4; } else { valueLength = p[0]; p++; } const QByteArray name(p, nameLength); p += nameLength; const QByteArray value(p, valueLength); p += valueLength; if (name == "PATH_INFO") { m_pendingRequest->d->path = QString::fromUtf8(value); } else if (name == "REQUEST_METHOD") { m_pendingRequest->d->method = QString::fromUtf8(value); } m_pendingRequest->d->meta.insert(QString::fromLatin1(name), QString::fromUtf8(value)); } break; case FCGI_STDIN: #ifdef QDJANGO_DEBUG_FCGI qDebug("[STDIN]"); #endif if (!m_pendingRequest || requestId != m_pendingRequestId) { qWarning("Received FCGI_STDIN outside a request"); m_device->close(); emit closed(); break; } if (contentLength) { m_pendingRequest->d->buffer.append(p, contentLength); } else { QDjangoHttpRequest *request = m_pendingRequest; const quint16 requestId = m_pendingRequestId; m_pendingRequest = 0; m_pendingRequestId = 0; QDjangoHttpResponse *response = m_server->urls()->respond(*request, request->path()); writeResponse(requestId, response); } break; default: qWarning("Unhandled request type %i", header->type); break; } } } /// \endcond class QDjangoFastCgiServerPrivate { public: QDjangoFastCgiServerPrivate(QDjangoFastCgiServer *qq); QLocalServer *localServer; QTcpServer *tcpServer; QDjangoUrlResolver *urlResolver; private: QDjangoFastCgiServer *q; }; QDjangoFastCgiServerPrivate::QDjangoFastCgiServerPrivate(QDjangoFastCgiServer *qq) : localServer(0), tcpServer(0), q(qq) { urlResolver = new QDjangoUrlResolver(q); } /** Constructs a new FastCGI server. */ QDjangoFastCgiServer::QDjangoFastCgiServer(QObject *parent) : QObject(parent) { d = new QDjangoFastCgiServerPrivate(this); } /** Destroys the FastCGI server. */ QDjangoFastCgiServer::~QDjangoFastCgiServer() { delete d; } /** Closes the server. The server will no longer listen for * incoming connections. */ void QDjangoFastCgiServer::close() { if (d->localServer) d->localServer->close(); if (d->tcpServer) d->tcpServer->close(); } /** Tells the server to listen for incoming connections on the given * local socket. */ bool QDjangoFastCgiServer::listen(const QString &name) { if (!d->localServer) { bool check; Q_UNUSED(check); d->localServer = new QLocalServer(this); check = connect(d->localServer, SIGNAL(newConnection()), this, SLOT(_q_newLocalConnection())); Q_ASSERT(check); } return d->localServer->listen(name); } /** Tells the server to listen for incoming TCP connections on the given * \a address and \a port. */ bool QDjangoFastCgiServer::listen(const QHostAddress &address, quint16 port) { if (!d->tcpServer) { bool check; Q_UNUSED(check); d->tcpServer = new QTcpServer(this); check = connect(d->tcpServer, SIGNAL(newConnection()), this, SLOT(_q_newTcpConnection())); Q_ASSERT(check); } return d->tcpServer->listen(address, port); } /** Returns the root URL resolver for the server, which dispatches * requests to handlers. */ QDjangoUrlResolver* QDjangoFastCgiServer::urls() const { return d->urlResolver; } void QDjangoFastCgiServer::_q_newLocalConnection() { bool check; Q_UNUSED(check); QLocalSocket *socket; while ((socket = d->localServer->nextPendingConnection()) != 0) { #ifdef QDJANGO_DEBUG_FCGI qDebug("New local connection"); #endif QDjangoFastCgiConnection *connection = new QDjangoFastCgiConnection(socket, this); check = connect(connection, SIGNAL(closed()), connection, SLOT(deleteLater())); Q_ASSERT(check); } } void QDjangoFastCgiServer::_q_newTcpConnection() { bool check; Q_UNUSED(check); QTcpSocket *socket; while ((socket = d->tcpServer->nextPendingConnection()) != 0) { #ifdef QDJANGO_DEBUG_FCGI qDebug("New TCP connection"); #endif QDjangoFastCgiConnection *connection = new QDjangoFastCgiConnection(socket, this); check = connect(connection, SIGNAL(closed()), connection, SLOT(deleteLater())); Q_ASSERT(check); } } qdjango-0.4.0/src/http/QDjangoFastCgiServer.h0000644000175000007640000000322512163016632020752 0ustar sharkyjerryweb/* * 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_FASTCGI_SERVER_H #define QDJANGO_FASTCGI_SERVER_H #include #include #include "QDjangoHttp_p.h" class QDjangoFastCgiServerPrivate; class QDjangoHttpController; class QDjangoUrlResolver; /** \brief The QDjangoFastCgiServer class represents a FastCGI server. * * It allows you to create a FastCGI server which your reverse proxy * (e.g. apache, nginx) will query to serve your web application. * * To register views, see urls(). * * \ingroup Http * \sa QDjangoHttpServer */ class QDJANGO_EXPORT QDjangoFastCgiServer : public QObject { Q_OBJECT public: QDjangoFastCgiServer(QObject *parent = 0); ~QDjangoFastCgiServer(); void close(); bool listen(const QString &name); bool listen(const QHostAddress &address, quint16 port); QDjangoUrlResolver *urls() const; private slots: void _q_newLocalConnection(); void _q_newTcpConnection(); private: Q_DISABLE_COPY(QDjangoFastCgiServer) QDjangoFastCgiServerPrivate *d; }; #endif qdjango-0.4.0/src/http/http.pro0000644000175000007640000000125012163016632016323 0ustar sharkyjerrywebinclude(../../qdjango.pri) QT -= gui QT += network TARGET = qdjango-http win32 { DESTDIR = $$OUT_PWD } HEADERS += \ QDjangoFastCgiServer.h \ QDjangoFastCgiServer_p.h \ QDjangoHttp_p.h \ QDjangoHttpController.h \ QDjangoHttpRequest.h \ QDjangoHttpResponse.h \ QDjangoHttpServer.h \ QDjangoHttpServer_p.h \ QDjangoUrlResolver.h SOURCES += \ QDjangoFastCgiServer.cpp \ QDjangoHttpController.cpp \ QDjangoHttpRequest.cpp \ QDjangoHttpResponse.cpp \ QDjangoHttpServer.cpp \ QDjangoUrlResolver.cpp # Installation include(../src.pri) headers.path = $$PREFIX/include/qdjango/http QMAKE_PKGCONFIG_INCDIR = $$headers.path qdjango-0.4.0/src/http/QDjangoHttpController.cpp0000644000175000007640000001620512163016632021563 0ustar sharkyjerryweb/* * 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. */ #include #include #include #include #include #include #include #include "QDjangoHttpController.h" #include "QDjangoHttpRequest.h" #include "QDjangoHttpResponse.h" /** Extract basic credentials from an HTTP \a request. * * Returns \b true if credentials were provider, \b false otherwise. */ bool QDjangoHttpController::getBasicAuth(const QDjangoHttpRequest &request, QString &username, QString &password) { QRegExp authRx(QLatin1String("^Basic (.+)$")); const QString authHeader = request.meta(QLatin1String("HTTP_AUTHORIZATION")); if (authRx.exactMatch(authHeader)) { const QString authValue = QString::fromUtf8(QByteArray::fromBase64(authRx.cap(1).toLatin1())); const QStringList bits = authValue.split(QLatin1Char(':')); if (bits.size() == 2 && !bits[0].isEmpty() && !bits[1].isEmpty()) { username = bits[0]; password = bits[1]; return true; } } return false; } /** Converts a QDateTime to an HTTP datetime string. */ QString QDjangoHttpController::httpDateTime(const QDateTime &dt) { if (dt.isValid()) return dt.toUTC().toString(QLatin1String("ddd, dd MMM yyyy HH:mm:ss")) + QLatin1String(" GMT"); return QString(); } /** Converts an HTTP datetime string to a QDateTime. */ QDateTime QDjangoHttpController::httpDateTime(const QString &str) { QDateTime dt = QDateTime::fromString(str.left(25), QLatin1String("ddd, dd MMM yyyy HH:mm:ss")); dt.setTimeSpec(Qt::UTC); return dt; } QDjangoHttpResponse *QDjangoHttpController::serveError(const QDjangoHttpRequest &request, int code, const QString &text) { Q_UNUSED(request); QDjangoHttpResponse *response = new QDjangoHttpResponse; response->setHeader(QLatin1String("Content-Type"), QLatin1String("text/html; charset=utf-8")); response->setStatusCode(code); response->setBody(QString::fromLatin1("" "Error" "

%1

" "").arg(text).toUtf8()); return response; } /** Respond to an HTTP \a request with an authorization error. * * \param request * \param realm */ QDjangoHttpResponse *QDjangoHttpController::serveAuthorizationRequired(const QDjangoHttpRequest &request, const QString &realm) { Q_UNUSED(request); QDjangoHttpResponse *response = new QDjangoHttpResponse; response->setStatusCode(QDjangoHttpResponse::AuthorizationRequired); response->setHeader(QLatin1String("WWW-Authenticate"), QString::fromLatin1("Basic realm=\"%1\"").arg(realm)); return response; } /** Respond to a malformed HTTP request. * * \param request */ QDjangoHttpResponse *QDjangoHttpController::serveBadRequest(const QDjangoHttpRequest &request) { return serveError(request, QDjangoHttpResponse::BadRequest, QLatin1String("Your browser sent a malformed request.")); } /** Respond to an HTTP \a request with an internal server error. * * \param request */ QDjangoHttpResponse *QDjangoHttpController::serveInternalServerError(const QDjangoHttpRequest &request) { return serveError(request, QDjangoHttpResponse::InternalServerError, QLatin1String("An internal server error was encountered.")); } /** Respond to an HTTP \a request with a not found error. * * \param request */ QDjangoHttpResponse *QDjangoHttpController::serveNotFound(const QDjangoHttpRequest &request) { return serveError(request, QDjangoHttpResponse::NotFound, QLatin1String("The document you requested was not found.")); } /** Respond to an HTTP \a request with a redirect. * * \param request * \param url The URL to which the user is redirected. * \param permanent Whether the redirect is permanent. */ QDjangoHttpResponse *QDjangoHttpController::serveRedirect(const QDjangoHttpRequest &request, const QUrl &url, bool permanent) { const QString urlString = url.toString(); QDjangoHttpResponse *response = serveError(request, permanent ? QDjangoHttpResponse::MovedPermanently : QDjangoHttpResponse::Found, QString::fromLatin1("You are being redirect to %2").arg(urlString, urlString)); response->setHeader(QLatin1String("Location"), urlString); return response; } /** Respond to an HTTP \a request for a static file. * * \param request * \param docPath The path to the document, such that it can be opened using a QFile. * \param expires An optional expiry date. */ QDjangoHttpResponse *QDjangoHttpController::serveStatic(const QDjangoHttpRequest &request, const QString &docPath, const QDateTime &expires) { QFileInfo info(docPath); if (!info.isFile()) return serveNotFound(request); const QString fileName = info.fileName(); QDjangoHttpResponse *response = new QDjangoHttpResponse; response->setStatusCode(QDjangoHttpResponse::OK); // determine last modified date QDateTime lastModified = info.lastModified(); if (docPath.startsWith(QLatin1String(":/"))) lastModified = QFileInfo(qApp->applicationFilePath()).lastModified(); if (lastModified.isValid()) response->setHeader(QLatin1String("Last-Modified"), httpDateTime(lastModified)); // cache expiry if (expires.isValid()) response->setHeader(QLatin1String("Expires"), httpDateTime(expires)); // handle if-modified-since const QDateTime ifModifiedSince = httpDateTime(request.meta(QLatin1String("HTTP_IF_MODIFIED_SINCE"))); if (lastModified.isValid() && ifModifiedSince.isValid() && lastModified <= ifModifiedSince) { response->setStatusCode(304); return response; } // determine content type QString mimeType; if (fileName.endsWith(QLatin1String(".css"))) mimeType = QLatin1String("text/css"); else if (fileName.endsWith(QLatin1String(".html"))) mimeType = QLatin1String("text/html"); else if (fileName.endsWith(QLatin1String(".js"))) mimeType = QLatin1String("application/javascript"); else if (fileName.endsWith(QLatin1String(".png"))) mimeType = QLatin1String("image/png"); else mimeType = QLatin1String("application/octet-stream"); response->setHeader(QLatin1String("Content-Type"), mimeType); // read contents QFile file(docPath); if (!file.open(QIODevice::ReadOnly)) { delete response; return serveInternalServerError(request); } if (request.method() == QLatin1String("HEAD")) response->setHeader(QLatin1String("Content-Length"), QString::number(file.size())); else response->setBody(file.readAll()); return response; } qdjango-0.4.0/src/http/QDjangoHttpRequest_p.h0000644000175000007640000000175312163016632021056 0ustar sharkyjerryweb/* * 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_HTTP_REQUEST_P_H #define QDJANGO_HTTP_REQUEST_P_H // // W A R N I N G // ------------- // // This file is not part of the QDjango API. // #include /** \internal */ class QDjangoHttpRequestPrivate { public: QByteArray buffer; QMap meta; QString method; QString path; }; #endif qdjango-0.4.0/src/http/QDjangoHttpRequest.h0000644000175000007640000000344712163016632020541 0ustar sharkyjerryweb/* * 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_HTTP_REQUEST_H #define QDJANGO_HTTP_REQUEST_H #include #include "QDjangoHttp_p.h" class QDjangoHttpRequestPrivate; /** \defgroup Http * * QDjango's HTTP request and response framework enables you to write web * web applications and serve them over HTTP. */ /** \brief The QDjangoHttpRequest class represents an HTTP request. * * \ingroup Http */ class QDJANGO_EXPORT QDjangoHttpRequest { public: QDjangoHttpRequest(); ~QDjangoHttpRequest(); QByteArray body() const; QString get(const QString &key) const; QString meta(const QString &key) const; QString method() const; QString path() const; QString post(const QString &key) const; private: Q_DISABLE_COPY(QDjangoHttpRequest) QDjangoHttpRequestPrivate* const d; friend class QDjangoFastCgiConnection; friend class QDjangoHttpConnection; friend class QDjangoHttpTestRequest; }; /** \cond */ class QDJANGO_EXPORT QDjangoHttpTestRequest : public QDjangoHttpRequest { public: QDjangoHttpTestRequest(const QString &method, const QString &path); private: Q_DISABLE_COPY(QDjangoHttpTestRequest) }; /** \endcond */ #endif qdjango-0.4.0/src/http/QDjangoHttpResponse_p.h0000644000175000007640000000203012163016632021211 0ustar sharkyjerryweb/* * 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_HTTP_RESPONSE_P_H #define QDJANGO_HTTP_RESPONSE_P_H // // W A R N I N G // ------------- // // This file is not part of the QDjango API. // #include #include /** \internal */ class QDjangoHttpResponsePrivate { public: int statusCode; QString reasonPhrase; QList > headers; QByteArray body; }; #endif qdjango-0.4.0/src/http/QDjangoHttpResponse.cpp0000644000175000007640000001012712163016632021233 0ustar sharkyjerryweb/* * 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. */ #include "QDjangoHttpResponse.h" #include "QDjangoHttpResponse_p.h" /** Constructs a new HTTP response. */ QDjangoHttpResponse::QDjangoHttpResponse() : d(new QDjangoHttpResponsePrivate) { setHeader(QLatin1String("Content-Length"), QLatin1String("0")); setStatusCode(QDjangoHttpResponse::OK); } /** Destroys the HTTP response. */ QDjangoHttpResponse::~QDjangoHttpResponse() { delete d; } /** Returns the raw body of the HTTP response. */ QByteArray QDjangoHttpResponse::body() const { return d->body; } /** Sets the raw body of the HTTP response. * * The Content-Length header will be updated to reflect the body size. * * \param body */ void QDjangoHttpResponse::setBody(const QByteArray &body) { d->body = body; setHeader(QLatin1String("Content-Length"), QString::number(d->body.size())); } /** Returns the specified HTTP response header. * * \param key */ QString QDjangoHttpResponse::header(const QString &key) const { QString lowercaseKey = key.toLower(); QList >::ConstIterator it = d->headers.constBegin(); while (it != d->headers.constEnd()) { if ((*it).first.toLower() == lowercaseKey) return (*it).second; ++it; } return QString(); } /** Sets the specified HTTP response header. * * \param key * \param value */ void QDjangoHttpResponse::setHeader(const QString &key, const QString &value) { QString lowercaseKey = key.toLower(); QList >::Iterator it = d->headers.begin(); while (it != d->headers.end()) { if ((*it).first.toLower() == lowercaseKey) { (*it).second = value; return; } ++it; } // not found so add d->headers.append(qMakePair(key, value)); } /** Returns true if the response is ready to be sent. * * The default implementation always returns true. If you subclass * QDjangoHttpResponse to support responses which should only be sent * to the client at a later point, you need to reimplement this method * and emit the ready() signal once the response is ready. */ bool QDjangoHttpResponse::isReady() const { return true; } /** Returns the code for the HTTP response status line. */ int QDjangoHttpResponse::statusCode() const { return d->statusCode; } /** Sets the code for the HTTP response status line. * * \param code */ void QDjangoHttpResponse::setStatusCode(int code) { d->statusCode = code; switch(code) { case OK: d->reasonPhrase = QLatin1String("OK"); break; case MovedPermanently: d->reasonPhrase = QLatin1String("Moved Permanently"); break; case Found: d->reasonPhrase = QLatin1String("Found"); break; case NotModified: d->reasonPhrase = QLatin1String("Not Modified"); break; case BadRequest: d->reasonPhrase = QLatin1String("Bad Request"); break; case AuthorizationRequired: d->reasonPhrase = QLatin1String("Authorization Required"); break; case Forbidden: d->reasonPhrase = QLatin1String("Forbidden"); break; case NotFound: d->reasonPhrase = QLatin1String("Not Found"); break; case MethodNotAllowed: d->reasonPhrase = QLatin1String("Method Not Allowed"); break; case InternalServerError: d->reasonPhrase = QLatin1String("Internal Server Error"); break; default: d->reasonPhrase = QLatin1String(""); break; } } qdjango-0.4.0/src/http/QDjangoHttpResponse.h0000644000175000007640000000421412163016632020700 0ustar sharkyjerryweb/* * 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_HTTP_RESPONSE_H #define QDJANGO_HTTP_RESPONSE_H #include #include "QDjangoHttp_p.h" class QDjangoHttpResponsePrivate; /** \brief The QDjangoHttpResponse class represents an HTTP response. * * \ingroup Http */ class QDJANGO_EXPORT QDjangoHttpResponse : public QObject { Q_OBJECT public: /** \brief Enum representing well-known HTTP status codes. */ enum HttpStatus { OK = 200, MovedPermanently = 301, Found = 302, NotModified = 304, BadRequest = 400, AuthorizationRequired = 401, Forbidden = 403, NotFound = 404, MethodNotAllowed = 405, InternalServerError = 500, }; QDjangoHttpResponse(); ~QDjangoHttpResponse(); QByteArray body() const; void setBody(const QByteArray &body); QString header(const QString &key) const; void setHeader(const QString &key, const QString &value); virtual bool isReady() const; int statusCode() const; void setStatusCode(int code); signals: /** Emit this signal from your QDjangoHttpResponse subclasses once * the response is ready to be sent to the client. * * \sa isReady() */ void ready(); private: Q_DISABLE_COPY(QDjangoHttpResponse) QDjangoHttpResponsePrivate* const d; friend class QDjangoFastCgiConnection; friend class QDjangoHttpConnection; }; #endif qdjango-0.4.0/src/http/QDjangoHttpRequest.cpp0000644000175000007640000000467012163016632021073 0ustar sharkyjerryweb/* * 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. */ #include #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #include #else #include #endif #include "QDjangoHttpRequest.h" #include "QDjangoHttpRequest_p.h" /** Constructs a new HTTP request. */ QDjangoHttpRequest::QDjangoHttpRequest() : d(new QDjangoHttpRequestPrivate) { } /** Destroys the HTTP request. */ QDjangoHttpRequest::~QDjangoHttpRequest() { delete d; } /** Returns the raw body of the HTTP request. */ QByteArray QDjangoHttpRequest::body() const { return d->buffer; } /** Returns the GET data for the given \a key. */ QString QDjangoHttpRequest::get(const QString &key) const { #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) QUrlQuery query(d->meta.value(QLatin1String("QUERY_STRING"))); return query.queryItemValue(key); #else QUrl url; url.setEncodedQuery(d->meta.value(QLatin1String("QUERY_STRING")).toLatin1()); return url.queryItemValue(key); #endif } /** Returns the specified HTTP request header. * * \param key */ QString QDjangoHttpRequest::meta(const QString &key) const { return d->meta.value(key); } /** Returns the HTTP request's method (e.g. GET, POST). */ QString QDjangoHttpRequest::method() const { return d->method; } /** Returns the HTTP request's path. */ QString QDjangoHttpRequest::path() const { return d->path; } /** Returns the POST data for the given \a key. */ QString QDjangoHttpRequest::post(const QString &key) const { #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) QUrlQuery query(QString::fromUtf8(d->buffer)); return query.queryItemValue(key); #else QUrl url; url.setEncodedQuery(d->buffer); return url.queryItemValue(key); #endif } QDjangoHttpTestRequest::QDjangoHttpTestRequest(const QString &method, const QString &path) { d->method = method; d->path = path; } qdjango-0.4.0/src/http/QDjangoHttpController.h0000644000175000007640000000415512163016632021231 0ustar sharkyjerryweb/* * 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_HTTP_CONTROLLER_H #define QDJANGO_HTTP_CONTROLLER_H #include #include #include "QDjangoHttp_p.h" class QDjangoHttpRequest; class QDjangoHttpResponse; class QUrl; /** \brief The QDjangoHttpController class provides static methods for replying to HTTP requests. * * \ingroup Http */ class QDJANGO_EXPORT QDjangoHttpController { public: // get basic authorization credentials static bool getBasicAuth(const QDjangoHttpRequest &request, QString &username, QString &password); // date / time handling static QString httpDateTime(const QDateTime &dt); static QDateTime httpDateTime(const QString &str); // common responses static QDjangoHttpResponse *serveAuthorizationRequired(const QDjangoHttpRequest &request, const QString &realm = QLatin1String("Secure Area")); static QDjangoHttpResponse *serveBadRequest(const QDjangoHttpRequest &request); static QDjangoHttpResponse *serveInternalServerError(const QDjangoHttpRequest &request); static QDjangoHttpResponse *serveNotFound(const QDjangoHttpRequest &request); static QDjangoHttpResponse *serveRedirect(const QDjangoHttpRequest &request, const QUrl &url, bool permanent = false); static QDjangoHttpResponse *serveStatic(const QDjangoHttpRequest &request, const QString &filePath, const QDateTime &expires = QDateTime()); private: static QDjangoHttpResponse *serveError(const QDjangoHttpRequest &request, int code, const QString &text); }; #endif qdjango-0.4.0/src/http/QDjangoHttpServer.cpp0000644000175000007640000002613112163016632020705 0ustar sharkyjerryweb/* * 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. */ #include #include #include #include #include #include #include "QDjangoHttpController.h" #include "QDjangoHttpRequest.h" #include "QDjangoHttpRequest_p.h" #include "QDjangoHttpResponse.h" #include "QDjangoHttpResponse_p.h" #include "QDjangoHttpServer.h" #include "QDjangoHttpServer_p.h" #include "QDjangoUrlResolver.h" //#define QDJANGO_DEBUG_HTTP // maximum request body size is 10 MB #define MAX_BODY_SIZE (10 * 1024 * 1024) /// \cond /** Constructs a new HTTP connection. */ QDjangoHttpConnection::QDjangoHttpConnection(QTcpSocket *device, QDjangoHttpServer *server) : QObject(server), m_closeAfterResponse(false), m_pendingRequest(0), m_requestCount(0), m_server(server), m_socket(device) { bool check; Q_UNUSED(check); m_socket->setParent(this); check = connect(m_socket, SIGNAL(bytesWritten(qint64)), this, SLOT(_q_bytesWritten(qint64))); Q_ASSERT(check); check = connect(m_socket, SIGNAL(disconnected()), this, SIGNAL(closed())); Q_ASSERT(check); check = connect(m_socket, SIGNAL(readyRead()), this, SLOT(_q_readyRead())); Q_ASSERT(check); } /** Destroys the HTTP connection. */ QDjangoHttpConnection::~QDjangoHttpConnection() { if (m_pendingRequest) delete m_pendingRequest; foreach (const QDjangoHttpJob &job, m_pendingJobs) { delete job.first; delete job.second; } } /** When bytes have been written, check whether we need to close * the connection. * * @param bytes */ void QDjangoHttpConnection::_q_bytesWritten(qint64 bytes) { Q_UNUSED(bytes); if (!m_socket->bytesToWrite()) { if (!m_pendingJobs.isEmpty()) { _q_writeResponse(); } else if (m_closeAfterResponse) { #ifdef QDJANGO_DEBUG_HTTP qDebug("Closing connection"); #endif m_socket->close(); emit closed(); } } } /** Handle incoming data on the socket. */ void QDjangoHttpConnection::_q_readyRead() { QDjangoHttpRequest *request = m_pendingRequest; if (!request) { request = new QDjangoHttpRequest; m_requestBytesRemaining = 0; m_requestHeaderLine = 0; m_requestHeaderReceived = false; m_requestHeaders.clear(); m_requestMajorVersion = 0; m_requestMinorVersion = 0; m_requestPath.clear(); } // Read request header while (!m_requestHeaderReceived && m_socket->canReadLine()) { const QString line = QString::fromUtf8(m_socket->readLine()); if (!m_requestHeaderLine++) { bool ok = false; QStringList lst = line.simplified().split(QLatin1String(" ")); if (lst.count() > 0) { request->d->method = lst[0]; if (lst.count() > 1) { m_requestPath = lst[1]; request->d->path = QUrl(m_requestPath).path(); if (lst.count() > 2) { QString v = lst[2]; if (v.length() >= 8 && v.left(5) == QLatin1String("HTTP/") && v[5].isDigit() && v[6] == QLatin1Char('.') && v[7].isDigit()) { m_requestMajorVersion = v[5].toLatin1() - '0'; m_requestMinorVersion = v[7].toLatin1() - '0'; ok = true; } } } } if (!ok) { qWarning("Invalid HTTP request"); m_socket->close(); return; } } else if (line != QLatin1String("\r\n")) { int i = line.indexOf(QLatin1Char(':')); if (i == -1) { qWarning("Invalid HTTP request header"); m_socket->close(); return; } const QString key = line.left(i).trimmed(); const QString value = line.mid(i + 1).trimmed(); m_requestHeaders.append(qMakePair(key, value)); if (key.toLower() == QLatin1String("content-length")) { m_requestBytesRemaining = value.toInt(); } } else { if (m_requestBytesRemaining < 0 || m_requestBytesRemaining > MAX_BODY_SIZE) { qWarning("Invalid Content-Length"); m_socket->close(); return; } m_requestHeaderReceived = true; } } if (!m_requestHeaderReceived) { m_pendingRequest = request; return; } // Read request body if (m_requestBytesRemaining > 0) { const QByteArray chunk = m_socket->read(m_requestBytesRemaining); request->d->buffer += chunk; m_requestBytesRemaining -= chunk.size(); } if (m_requestBytesRemaining) { m_pendingRequest = request; return; } m_pendingRequest = 0; #ifdef QDJANGO_DEBUG_HTTP qDebug("Handling request %i", d->requestCount++); #endif /* Map meta-information */ QString metaKey; QList >::ConstIterator it = m_requestHeaders.constBegin(); while (it != m_requestHeaders.constEnd()) { if (it->first == QLatin1String("Content-Length")) metaKey = QLatin1String("CONTENT_LENGTH"); else if (it->first == QLatin1String("Content-Type")) metaKey = QLatin1String("CONTENT_TYPE"); else { metaKey = QLatin1String("HTTP_") + it->first.toUpper(); metaKey.replace(QLatin1Char('-'), QLatin1Char('_')); } request->d->meta.insert(metaKey, it->second); ++it; } #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) request->d->meta.insert(QLatin1String("QUERY_STRING"), QUrl(m_requestPath).query()); #else request->d->meta.insert(QLatin1String("QUERY_STRING"), QString::fromLatin1(QUrl(m_requestPath).encodedQuery())); #endif request->d->meta.insert(QLatin1String("REMOTE_ADDR"), m_socket->peerAddress().toString()); request->d->meta.insert(QLatin1String("REQUEST_METHOD"), request->method()); request->d->meta.insert(QLatin1String("SERVER_NAME"), m_socket->localAddress().toString()); request->d->meta.insert(QLatin1String("SERVER_PORT"), QString::number(m_socket->localPort())); /* Process request */ bool keepAlive = m_requestMajorVersion >= 1 && m_requestMinorVersion >= 1; if (request->d->meta.value(QLatin1String("HTTP_CONNECTION")).toLower() == QLatin1String("keep-alive")) keepAlive = true; else if (request->d->meta.value(QLatin1String("HTTP_CONNECTION")).toLower() == QLatin1String("close")) keepAlive = false; QDjangoHttpResponse *response = m_server->urls()->respond(*request, request->path()); m_pendingJobs << qMakePair(request, response); /* Store keep-alive flag */ if (!keepAlive) m_closeAfterResponse = true; connect(response, SIGNAL(ready()), this, SLOT(_q_writeResponse())); _q_writeResponse(); } void QDjangoHttpConnection::_q_writeResponse() { while (!m_pendingJobs.isEmpty() && m_pendingJobs.first().second->isReady()) { const QDjangoHttpJob job = m_pendingJobs.takeFirst(); QDjangoHttpRequest *request = job.first; QDjangoHttpResponse *response = job.second; if (!response->isReady()) return; /* Finalise response */ response->setHeader(QLatin1String("Date"), QDjangoHttpController::httpDateTime(QDateTime::currentDateTime())); response->setHeader(QLatin1String("Server"), QString::fromLatin1("%1/%2").arg(qApp->applicationName(), qApp->applicationVersion())); response->setHeader(QLatin1String("Connection"), QLatin1String(m_closeAfterResponse ? "close" : "keep-alive")); /* Send response */ QString httpHeader = QString::fromLatin1("HTTP/1.1 %1 %2\r\n").arg(response->d->statusCode).arg(response->d->reasonPhrase); QList >::ConstIterator it = response->d->headers.constBegin(); while (it != response->d->headers.constEnd()) { httpHeader += (*it).first + QLatin1String(": ") + (*it).second + QLatin1String("\r\n"); ++it; } m_socket->write(httpHeader.toUtf8() + "\r\n" + response->d->body); /* Emit signal */ emit requestFinished(request, response); /* Destroy response */ delete request; response->deleteLater(); } } /// \endcond class QDjangoHttpServerPrivate { public: int connectionCount; QTcpServer *tcpServer; QDjangoUrlResolver *urlResolver; }; /** Constructs a new HTTP server. */ QDjangoHttpServer::QDjangoHttpServer(QObject *parent) : QObject(parent), d(new QDjangoHttpServerPrivate) { d->connectionCount = 0; d->tcpServer = 0; d->urlResolver = new QDjangoUrlResolver(this); } /** Destroys the HTTP server. */ QDjangoHttpServer::~QDjangoHttpServer() { delete d; } /** Closes the server. The server will no longer listen for * incoming connections. */ void QDjangoHttpServer::close() { if (d->tcpServer) d->tcpServer->close(); } /** Tells the server to listen for incoming TCP connections on the given * \a address and \a port. */ bool QDjangoHttpServer::listen(const QHostAddress &address, quint16 port) { if (!d->tcpServer) { bool check; Q_UNUSED(check); d->tcpServer = new QTcpServer(this); check = connect(d->tcpServer, SIGNAL(newConnection()), this, SLOT(_q_newTcpConnection())); Q_ASSERT(check); } return d->tcpServer->listen(address, port); } /** Returns the root URL resolver for the server, which dispatches * requests to handlers. */ QDjangoUrlResolver* QDjangoHttpServer::urls() const { return d->urlResolver; } /** Handles the creation of new HTTP connections. */ void QDjangoHttpServer::_q_newTcpConnection() { bool check; Q_UNUSED(check); QTcpSocket *socket; while ((socket = d->tcpServer->nextPendingConnection()) != 0) { QDjangoHttpConnection *connection = new QDjangoHttpConnection(socket, this); #ifdef QDJANGO_DEBUG_HTTP qDebug("Handling connection %i", d->connectionCount++); #endif check = connect(connection, SIGNAL(closed()), connection, SLOT(deleteLater())); Q_ASSERT(check); check = connect(connection, SIGNAL(requestFinished(QDjangoHttpRequest*,QDjangoHttpResponse*)), this, SIGNAL(requestFinished(QDjangoHttpRequest*,QDjangoHttpResponse*))); Q_ASSERT(check); } } qdjango-0.4.0/src/http/QDjangoHttp_p.h0000644000175000007640000000162412163016632017502 0ustar sharkyjerryweb/* * 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_HTTP_P_H #define QDJANGO_HTTP_P_H #if defined(QDJANGO_SHARED) # if defined(QDJANGO_BUILD) # define QDJANGO_EXPORT Q_DECL_EXPORT # else # define QDJANGO_EXPORT Q_DECL_IMPORT # endif #else # define QDJANGO_EXPORT #endif #endif qdjango-0.4.0/src/http/QDjangoFastCgiServer_p.h0000644000175000007640000000312412163016632021267 0ustar sharkyjerryweb/* * 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_FASTCGI_SERVER_P_H #define QDJANGO_FASTCGI_SERVER_P_H // // W A R N I N G // ------------- // // This file is not part of the QDjango API. // #include #define FCGI_RECORD_SIZE (255*255 + 255 + 8) class QDjangoFastCgiServer; class QDjangoHttpRequest; class QDjangoHttpResponse; class QIODevice; class QDjangoFastCgiConnection : public QObject { Q_OBJECT public: QDjangoFastCgiConnection(QIODevice *device, QDjangoFastCgiServer *server); ~QDjangoFastCgiConnection(); signals: void closed(); private slots: void _q_bytesWritten(qint64 bytes); void _q_readyRead(); private: void writeResponse(quint16 requestId, QDjangoHttpResponse *response); QIODevice *m_device; char m_inputBuffer[FCGI_RECORD_SIZE]; int m_inputPos; char m_outputBuffer[FCGI_RECORD_SIZE]; QDjangoHttpRequest *m_pendingRequest; quint16 m_pendingRequestId; QDjangoFastCgiServer *m_server; }; #endif qdjango-0.4.0/src/http/QDjangoUrlResolver.cpp0000644000175000007640000001647012163016632021070 0ustar sharkyjerryweb/* * 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. */ #include #include #include #include #include "QDjangoHttpController.h" #include "QDjangoHttpRequest.h" #include "QDjangoHttpResponse.h" #include "QDjangoUrlResolver.h" class QDjangoUrlResolverRoute { public: QDjangoUrlResolverRoute() : receiver(0) , urls(0) { } QRegExp path; QObject *receiver; QByteArray member; QDjangoUrlResolver *urls; }; class QDjangoUrlResolverPrivate { public: QDjangoHttpResponse* respond(const QDjangoHttpRequest &request, const QString &path) const; QString reverse(QObject *receiver, const char *member, const QVariantList &args = QVariantList()) const; QList routes; }; QDjangoHttpResponse* QDjangoUrlResolverPrivate::respond(const QDjangoHttpRequest &request, const QString &path) const { QList::const_iterator it; for (it = routes.constBegin(); it != routes.constEnd(); ++it) { if (it->urls && it->path.indexIn(path) == 0) { // try recursing QString subPath = path.mid(it->path.capturedTexts().first().size()); QDjangoHttpResponse *response = it->urls->d->respond(request, subPath); if (response) return response; } else if (it->receiver && it->path.exactMatch(path)) { // collect arguments QStringList caps = it->path.capturedTexts(); caps.takeFirst(); QList args; args << Q_ARG(QDjangoHttpRequest, request); for (int i = 0; i < caps.size(); ++i) { args << Q_ARG(QString, caps[i]); } while (args.size() < 10) { args << QGenericArgument(); } QDjangoHttpResponse *response = 0; if (!QMetaObject::invokeMethod(it->receiver, it->member.constData(), Qt::DirectConnection, Q_RETURN_ARG(QDjangoHttpResponse*, response), args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]) || !response) { return QDjangoHttpController::serveInternalServerError(request); } return response; } } return 0; } QString QDjangoUrlResolverPrivate::reverse(QObject *receiver, const char *member, const QVariantList &args) const { QList::const_iterator it; for (it = routes.constBegin(); it != routes.constEnd(); ++it) { // recurse if (it->urls) { QString path = it->urls->d->reverse(receiver, member, args); if (!path.isNull()) { QString prefix = it->path.pattern(); if (prefix.startsWith(QLatin1Char('^'))) prefix.remove(0, 1); if (prefix.endsWith(QLatin1Char('$'))) prefix.chop(1); return prefix + path; } } else if (it->receiver == receiver && it->member == member) { QString path = it->path.pattern(); if (path.startsWith(QLatin1Char('^'))) path.remove(0, 1); if (path.endsWith(QLatin1Char('$'))) path.chop(1); // replace parameters QVariantList arguments(args); int pos = 0; QRegExp rx(QLatin1String("\\([^)]+\\)")); while ((pos = rx.indexIn(path, pos)) != -1) { if (arguments.isEmpty()) { qWarning("Too few arguments for '%s'", member); return QString(); } const QString str = arguments.takeFirst().toString(); path.replace(pos, rx.matchedLength(), str); pos += str.size(); } if (!arguments.isEmpty()) { qWarning("Too many arguments for '%s'", member); return QString(); } if (path.isEmpty()) return QLatin1String(""); else return path; } } // not found return QString(); } /** Constructs a new URL resolver with the given \a parent. */ QDjangoUrlResolver::QDjangoUrlResolver(QObject *parent) : QObject(parent) , d(new QDjangoUrlResolverPrivate) { } QDjangoUrlResolver::~QDjangoUrlResolver() { delete d; } /** Adds a URL mapping for the given \a path. */ bool QDjangoUrlResolver::set(const QRegExp &path, QObject *receiver, const char *member) { Q_ASSERT(receiver); Q_ASSERT(member); const QMetaObject *metaObject = receiver->metaObject(); QByteArray needle(member); needle += '('; for (int i = metaObject->methodOffset(); i < metaObject->methodCount(); ++i) { #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) if (metaObject->method(i).name() == member) { #else const QByteArray signature = metaObject->method(i).signature(); if (signature.startsWith(needle)) { #endif // check parameter types const QList ptypes = metaObject->method(i).parameterTypes(); if (ptypes.isEmpty() || ptypes[0] != "QDjangoHttpRequest") { qWarning("First argument of '%s' should be a QDjangoHttpRequest", member); return false; } // register route QDjangoUrlResolverRoute route; route.path = path; route.receiver = receiver; route.member = member; d->routes << route; return true; } } qWarning("Could not find '%s' in receiver", member); return false; } /** Adds a URL mapping for the given \a path. */ bool QDjangoUrlResolver::include(const QRegExp &path, QDjangoUrlResolver *urls) { Q_ASSERT(urls); // register route QDjangoUrlResolverRoute route; route.path = path; route.urls = urls; d->routes << route; return true; } /** Responds to the given HTTP \a request for the given \a path. */ QDjangoHttpResponse* QDjangoUrlResolver::respond(const QDjangoHttpRequest &request, const QString &path) const { QString fixedPath(path); if (fixedPath.startsWith(QLatin1Char('/'))) fixedPath.remove(0, 1); QDjangoHttpResponse *response = d->respond(request, fixedPath); if (response) return response; else return QDjangoHttpController::serveNotFound(request); } /** Returns the URL for the member \a member of \a receiver with * \a args as arguments. */ QString QDjangoUrlResolver::reverse(QObject *receiver, const char *member, const QVariantList &args) const { QString path = d->reverse(receiver, member, args); if (path.isNull()) return QString(); else return QLatin1String("/") + path; } qdjango-0.4.0/src/http/QDjangoHttpServer_p.h0000644000175000007640000000413412163016632020670 0ustar sharkyjerryweb/* * 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_HTTP_SERVER_P_H #define QDJANGO_HTTP_SERVER_P_H // // W A R N I N G // ------------- // // This file is not part of the QDjango API. // #include #include #include #include class QDjangoHttpRequest; class QDjangoHttpResponse; class QDjangoHttpServer; class QTcpSocket; typedef QPair QDjangoHttpJob; /** \internal */ class QDjangoHttpConnection : public QObject { Q_OBJECT public: QDjangoHttpConnection(QTcpSocket *device, QDjangoHttpServer *server); ~QDjangoHttpConnection(); signals: /** This signal is emitted when the connection is closed. */ void closed(); /** This signal is emitted when a request completes. */ void requestFinished(QDjangoHttpRequest *request, QDjangoHttpResponse *response); private slots: void _q_bytesWritten(qint64 bytes); void _q_readyRead(); void _q_writeResponse(); private: Q_DISABLE_COPY(QDjangoHttpConnection) bool m_closeAfterResponse; QList m_pendingJobs; QDjangoHttpRequest *m_pendingRequest; int m_requestCount; QDjangoHttpServer *m_server; QTcpSocket *m_socket; // request parsing qint64 m_requestBytesRemaining; int m_requestHeaderLine; bool m_requestHeaderReceived; QList > m_requestHeaders; int m_requestMajorVersion; int m_requestMinorVersion; QString m_requestPath; }; #endif qdjango-0.4.0/src/http/QDjangoHttpServer.h0000644000175000007640000000334212163016632020351 0ustar sharkyjerryweb/* * 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_HTTP_SERVER_H #define QDJANGO_HTTP_SERVER_H #include #include #include "QDjangoHttp_p.h" class QDjangoHttpRequest; class QDjangoHttpResponse; class QDjangoHttpServer; class QDjangoHttpServerPrivate; class QDjangoUrlResolver; /** \brief The QDjangoHttpServer class represents an HTTP server. * * It allows you to create a standalone HTTP server which will * serve your web application. * * To register views, see urls(). * * \ingroup Http * \sa QDjangoFastCgiServer */ class QDJANGO_EXPORT QDjangoHttpServer : public QObject { Q_OBJECT public: QDjangoHttpServer(QObject *parent = 0); ~QDjangoHttpServer(); void close(); bool listen(const QHostAddress &address, quint16 port); QDjangoUrlResolver *urls() const; signals: /** This signal is emitted when a request completes. */ void requestFinished(QDjangoHttpRequest *request, QDjangoHttpResponse *response); private slots: void _q_newTcpConnection(); private: Q_DISABLE_COPY(QDjangoHttpServer) QDjangoHttpServerPrivate* const d; }; #endif qdjango-0.4.0/src/src.pro0000644000175000007640000000010012163016632015145 0ustar sharkyjerrywebTEMPLATE = subdirs SUBDIRS = db http script CONFIG += ordered qdjango-0.4.0/src/db/0000755000175000007640000000000012163016632014232 5ustar sharkyjerrywebqdjango-0.4.0/src/db/QDjangoQuerySet.cpp0000644000175000007640000003754612163016632020002 0ustar sharkyjerryweb/* * Copyright (C) 2010-2013 Jeremy Lainé * Copyright (C) 2011 Mathias Hasselmann * 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. */ #include #include "QDjango.h" #include "QDjangoQuerySet.h" #include "QDjangoWhere_p.h" /// \cond QDjangoCompiler::QDjangoCompiler(const char *modelName, const QSqlDatabase &db) { driver = db.driver(); baseModel = QDjango::metaModel(modelName); } QString QDjangoCompiler::referenceModel(const QString &modelPath, QDjangoMetaModel *metaModel) { if (modelPath.isEmpty()) return driver->escapeIdentifier(baseModel.table(), QSqlDriver::TableName); if (modelRefs.contains(modelPath)) return modelRefs.value(modelPath).first; const QString modelRef = QLatin1String("T") + QString::number(modelRefs.size()); modelRefs.insert(modelPath, qMakePair(modelRef, *metaModel)); return modelRef; } QString QDjangoCompiler::databaseColumn(const QString &name) { QDjangoMetaModel model = baseModel; QString modelPath; QString modelRef = referenceModel(QString(), &model); QStringList bits = name.split(QLatin1String("__")); while (bits.size() > 1) { const QByteArray fk = bits.first().toLatin1(); if (!model.foreignFields().contains(fk)) break; QDjangoMetaModel foreignModel = QDjango::metaModel(model.foreignFields()[fk]); // store reference if (!modelPath.isEmpty()) modelPath += QLatin1String("__"); modelPath += bits.first(); modelRef = referenceModel(modelPath, &foreignModel); model = foreignModel; bits.takeFirst(); } const QDjangoMetaField field = model.localField(bits.join(QLatin1String("__")).toLatin1()); return modelRef + QLatin1Char('.') + driver->escapeIdentifier(field.column(), QSqlDriver::FieldName); } QStringList QDjangoCompiler::fieldNames(bool recurse, QDjangoMetaModel *metaModel, const QString &modelPath) { QStringList columns; if (!metaModel) metaModel = &baseModel; // store reference const QString tableName = referenceModel(modelPath, metaModel); foreach (const QDjangoMetaField &field, metaModel->localFields()) columns << tableName + QLatin1Char('.') + driver->escapeIdentifier(field.column(), QSqlDriver::FieldName); if (!recurse) return columns; // recurse for foreign keys const QString pathPrefix = modelPath.isEmpty() ? QString() : (modelPath + QLatin1String("__")); foreach (const QByteArray &fkName, metaModel->foreignFields().keys()) { QDjangoMetaModel metaForeign = QDjango::metaModel(metaModel->foreignFields()[fkName]); columns += fieldNames(recurse, &metaForeign, pathPrefix + QString::fromLatin1(fkName)); } return columns; } QString QDjangoCompiler::fromSql() { QString from = driver->escapeIdentifier(baseModel.table(), QSqlDriver::TableName); foreach (const QString &name, modelRefs.keys()) { baseModel.localField(name.toLatin1() + QByteArray("_id")); from += QString::fromLatin1(" %1 %2 %3 ON %4.%5 = %6") .arg(baseModel.localField(name.toLatin1() + QByteArray("_id")).isNullable() ? "LEFT OUTER JOIN" : "INNER JOIN") .arg(driver->escapeIdentifier(modelRefs[name].second.table(), QSqlDriver::TableName)) .arg(modelRefs[name].first) .arg(modelRefs[name].first) .arg(driver->escapeIdentifier(modelRefs[name].second.localField("pk").column(), QSqlDriver::FieldName)) .arg(databaseColumn(name + QLatin1String("_id"))); } return from; } QString QDjangoCompiler::orderLimitSql(const QStringList orderBy, int lowMark, int highMark) { QString limit; // order QStringList bits; QString field; foreach (field, orderBy) { QString order = QLatin1String("ASC"); if (field.startsWith(QLatin1Char('-'))) { order = QLatin1String("DESC"); field = field.mid(1); } else if (field.startsWith(QLatin1Char('+'))) { field = field.mid(1); } bits.append(databaseColumn(field) + QLatin1Char(' ') + order); } if (!bits.isEmpty()) limit += QLatin1String(" ORDER BY ") + bits.join(QLatin1String(", ")); // limits if (highMark > 0) limit += QLatin1String(" LIMIT ") + QString::number(highMark - lowMark); if (lowMark > 0) { // no-limit is backend specific if (highMark <= 0) limit += QDjango::noLimitSql(); limit += QLatin1String(" OFFSET ") + QString::number(lowMark); } return limit; } void QDjangoCompiler::resolve(QDjangoWhere &where) { // resolve column if (where.d->operation != QDjangoWhere::None) where.d->key = databaseColumn(where.d->key); // recurse into children for (int i = 0; i < where.d->children.size(); i++) resolve(where.d->children[i]); } QDjangoQuerySetPrivate::QDjangoQuerySetPrivate(const char *modelName) : counter(1), hasResults(false), lowMark(0), highMark(0), selectRelated(false), m_modelName(modelName) { } void QDjangoQuerySetPrivate::addFilter(const QDjangoWhere &where) { // it is not possible to add filters once a limit has been set Q_ASSERT(!lowMark && !highMark); whereClause = whereClause && where; } QDjangoWhere QDjangoQuerySetPrivate::resolvedWhere(const QSqlDatabase &db) const { QDjangoCompiler compiler(m_modelName, db); QDjangoWhere resolvedWhere(whereClause); compiler.resolve(resolvedWhere); return resolvedWhere; } bool QDjangoQuerySetPrivate::sqlDelete() { // DELETE on an empty queryset doesn't need a query if (whereClause.isNone()) return true; // FIXME : it is not possible to remove entries once a limit has been set // because SQLite does not support limits on DELETE unless compiled with the // SQLITE_ENABLE_UPDATE_DELETE_LIMIT option if (lowMark || highMark) return false; // execute query QDjangoQuery query(deleteQuery()); if (!query.exec()) return false; // invalidate cache if (hasResults) { properties.clear(); hasResults = false; } return true; } bool QDjangoQuerySetPrivate::sqlFetch() { if (hasResults || whereClause.isNone()) return true; QSqlDatabase db = QDjango::database(); // build query QDjangoCompiler compiler(m_modelName, db); QDjangoWhere resolvedWhere(whereClause); compiler.resolve(resolvedWhere); const QStringList columns = compiler.fieldNames(selectRelated); const QString where = resolvedWhere.sql(db); const QString limit = compiler.orderLimitSql(orderBy, lowMark, highMark); QString sql = QLatin1String("SELECT ") + columns.join(QLatin1String(", ")) + QLatin1String(" FROM ") + compiler.fromSql(); if (!where.isEmpty()) sql += QLatin1String(" WHERE ") + where; sql += limit; QDjangoQuery query(db); query.prepare(sql); resolvedWhere.bindValues(query); // execute query if (!query.exec()) return false; // store results while (query.next()) { QVariantList props; for (int i = 0; i < columns.size(); ++i) props << query.value(i); properties.append(props); } hasResults = true; return true; } bool QDjangoQuerySetPrivate::sqlInsert(const QVariantMap &fields, QVariant *insertId) { // execute query QDjangoQuery query(insertQuery(fields)); if (!query.exec()) return false; // fetch autoincrement pk if (insertId) { QSqlDatabase db = QDjango::database(); if (db.driverName() == QLatin1String("QPSQL")) { const QDjangoMetaModel metaModel = QDjango::metaModel(m_modelName); QDjangoQuery query(db); const QDjangoMetaField primaryKey = metaModel.localField("pk"); const QString seqName = db.driver()->escapeIdentifier(metaModel.table() + QLatin1Char('_') + primaryKey.column() + QLatin1String("_seq"), QSqlDriver::FieldName); if (!query.exec(QLatin1String("SELECT CURRVAL('") + seqName + QLatin1String("')")) || !query.next()) return false; *insertId = query.value(0); } else { *insertId = query.lastInsertId(); } } // invalidate cache if (hasResults) { properties.clear(); hasResults = false; } return true; } bool QDjangoQuerySetPrivate::sqlLoad(QObject *model, int index) { if (!sqlFetch()) return false; if (index < 0 || index >= properties.size()) { qWarning("QDjangoQuerySet out of bounds"); return false; } const QDjangoMetaModel metaModel = QDjango::metaModel(m_modelName); int pos = 0; metaModel.load(model, properties.at(index), pos); return true; } /** Returns the SQL query to perform a COUNT on the current set. */ QDjangoQuery QDjangoQuerySetPrivate::countQuery() const { QSqlDatabase db = QDjango::database(); // build query QDjangoCompiler compiler(m_modelName, db); QDjangoWhere resolvedWhere(whereClause); compiler.resolve(resolvedWhere); const QString where = resolvedWhere.sql(db); const QString limit = compiler.orderLimitSql(QStringList(), lowMark, highMark); QString sql = QLatin1String("SELECT COUNT(*) FROM ") + compiler.fromSql(); if (!where.isEmpty()) sql += QLatin1String(" WHERE ") + where; sql += limit; QDjangoQuery query(db); query.prepare(sql); resolvedWhere.bindValues(query); return query; } /** Returns the SQL query to perform a DELETE on the current set. */ QDjangoQuery QDjangoQuerySetPrivate::deleteQuery() const { QSqlDatabase db = QDjango::database(); // build query QDjangoCompiler compiler(m_modelName, db); QDjangoWhere resolvedWhere(whereClause); compiler.resolve(resolvedWhere); const QString where = resolvedWhere.sql(db); const QString limit = compiler.orderLimitSql(orderBy, lowMark, highMark); QString sql = QLatin1String("DELETE FROM ") + compiler.fromSql(); if (!where.isEmpty()) sql += QLatin1String(" WHERE ") + where; sql += limit; QDjangoQuery query(db); query.prepare(sql); resolvedWhere.bindValues(query); return query; } /** Returns the SQL query to perform an INSERT for the specified \a fields. */ QDjangoQuery QDjangoQuerySetPrivate::insertQuery(const QVariantMap &fields) const { QSqlDatabase db = QDjango::database(); const QDjangoMetaModel metaModel = QDjango::metaModel(m_modelName); // perform INSERT QStringList fieldColumns; QStringList fieldHolders; foreach (const QString &name, fields.keys()) { const QDjangoMetaField field = metaModel.localField(name.toLatin1()); fieldColumns << db.driver()->escapeIdentifier(field.column(), QSqlDriver::FieldName); fieldHolders << QLatin1String("?"); } QDjangoQuery query(db); query.prepare(QString::fromLatin1("INSERT INTO %1 (%2) VALUES(%3)").arg( db.driver()->escapeIdentifier(metaModel.table(), QSqlDriver::TableName), fieldColumns.join(QLatin1String(", ")), fieldHolders.join(QLatin1String(", ")))); foreach (const QString &name, fields.keys()) query.addBindValue(fields.value(name)); return query; } /** Returns the SQL query to perform an UPDATE on the current set for the specified \a fields. */ QDjangoQuery QDjangoQuerySetPrivate::updateQuery(const QVariantMap &fields) const { QSqlDatabase db = QDjango::database(); const QDjangoMetaModel metaModel = QDjango::metaModel(m_modelName); // build query QDjangoCompiler compiler(m_modelName, db); QDjangoWhere resolvedWhere(whereClause); compiler.resolve(resolvedWhere); QString sql = QLatin1String("UPDATE ") + compiler.fromSql(); // add SET QStringList fieldAssign; foreach (const QString &name, fields.keys()) { const QDjangoMetaField field = metaModel.localField(name.toLatin1()); fieldAssign << db.driver()->escapeIdentifier(field.column(), QSqlDriver::FieldName) + QLatin1String(" = ?"); } sql += QLatin1String(" SET ") + fieldAssign.join(QLatin1String(", ")); // add WHERE const QString where = resolvedWhere.sql(db); if (!where.isEmpty()) sql += QLatin1String(" WHERE ") + where; QDjangoQuery query(db); query.prepare(sql); foreach (const QString &name, fields.keys()) query.addBindValue(fields.value(name)); resolvedWhere.bindValues(query); return query; } int QDjangoQuerySetPrivate::sqlUpdate(const QVariantMap &fields) { // UPDATE on an empty queryset doesn't need a query if (whereClause.isNone() || fields.isEmpty()) return 0; // FIXME : it is not possible to update entries once a limit has been set // because SQLite does not support limits on UPDATE unless compiled with the // SQLITE_ENABLE_UPDATE_DELETE_LIMIT option if (lowMark || highMark) return -1; // execute query QDjangoQuery query(updateQuery(fields)); if (!query.exec()) return -1; // invalidate cache if (hasResults) { properties.clear(); hasResults = false; } return query.numRowsAffected(); } QList QDjangoQuerySetPrivate::sqlValues(const QStringList &fields) { QList values; if (!sqlFetch()) return values; const QDjangoMetaModel metaModel = QDjango::metaModel(m_modelName); // build field list const QList localFields = metaModel.localFields(); QMap fieldPos; if (fields.isEmpty()) { for (int i = 0; i < localFields.size(); ++i) fieldPos.insert(localFields[i].name(), i); } else { foreach (const QString &name, fields) { int pos = 0; foreach (const QDjangoMetaField &field, localFields) { if (field.name() == name) break; pos++; } Q_ASSERT_X(pos < localFields.size(), "QDjangoQuerySet::values", "unknown field requested"); fieldPos.insert(name, pos); } } // extract values foreach (const QVariantList &props, properties) { QVariantMap map; QMap::const_iterator i; for (i = fieldPos.constBegin(); i != fieldPos.constEnd(); ++i) map[i.key()] = props[i.value()]; values.append(map); } return values; } QList QDjangoQuerySetPrivate::sqlValuesList(const QStringList &fields) { QList values; if (!sqlFetch()) return values; const QDjangoMetaModel metaModel = QDjango::metaModel(m_modelName); // build field list const QList localFields = metaModel.localFields(); QList fieldPos; if (fields.isEmpty()) { for (int i = 0; i < localFields.size(); ++i) fieldPos << i; } else { foreach (const QString &name, fields) { int pos = 0; foreach (const QDjangoMetaField &field, localFields) { if (field.name() == name) break; pos++; } Q_ASSERT_X(pos < localFields.size(), "QDjangoQuerySet::valuesList", "unknown field requested"); fieldPos << pos; } } // extract values foreach (const QVariantList &props, properties) { QVariantList list; foreach (int pos, fieldPos) list << props.at(pos); values.append(list); } return values; } /// \endcond qdjango-0.4.0/src/db/QDjangoQuerySet.h0000644000175000007640000004706612163016632017445 0ustar sharkyjerryweb/* * Copyright (C) 2010-2012 Jeremy Lainé * Copyright (C) 2011 Mathias Hasselmann * 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_QUERYSET_H #define QDJANGO_QUERYSET_H #include "QDjango.h" #include "QDjangoWhere.h" #include "QDjangoQuerySet_p.h" /** \brief The QDjangoQuerySet class is a template class for performing * database queries. * * The QDjangoQuerySet template class allows you to define and manipulate * sets of QDjangoModel objects stored in the database. * * You can chain filter expressions using the filter() and exclude() methods * or apply limits on the number of rows using the limit() method. * * You can retrieve database values using the values() and valuesList() * methods or retrieve model instances using the get() and at() methods. * * You can also delete sets of objects using the remove() method. * * Behinds the scenes, the QDjangoQuerySet class uses implicit sharing to * reduce memory usage and avoid needless copying of data. * * \ingroup Database */ template class QDjangoQuerySet { public: /** \cond declarations for STL-style container algorithms */ typedef int size_type; typedef T value_type; typedef value_type *pointer; typedef const value_type *const_pointer; typedef value_type &reference; typedef const value_type &const_reference; typedef qptrdiff difference_type; /** \endcond */ /** The QDjangoQuerySet::const_iterator class provides an STL-style const iterator * for QDjangoQuerySet. * * QDjangoQuerySet::const_iterator allows you to iterate over a QDjangoQuerySet. * As a const iterator it doesn't permit you to modify the QDjangoQuerySet. * * The default QDjangoQuerySet::const_iterator constructor creates an uninitialized iterator. You must * initialize it using a QDjangoQuerySet function like QDjangoQuerySet::constBegin(), or * QDjangoQuerySet::constEnd() before you can start iterating. Here's a typical loop that * prints all the objects stored in a set: * * \code * QDjangoQuerySet posts; * * foreach(const Weblog::Post &p, posts) { * cout << p << endl; * } * \endcode */ class const_iterator { friend class QDjangoQuerySet; public: /** A synonym for std::bidirectional_iterator_tag indicating this iterator * permits bidirectional access. */ typedef std::bidirectional_iterator_tag iterator_category; /** \cond declarations for STL-style container algorithms */ typedef qptrdiff difference_type; typedef T value_type; typedef T *pointer; typedef T &reference; /** \endcond */ /** Constructs an uninitialized iterator. * * Functions like operator*() and operator++() should not be called on an uninitialized * iterator. Use const_iterator::operator=() to assign a value to it before using it. * * \sa See also QDjangoQuerySet::constBegin() and QDjangoQuerySet::constEnd(). */ const_iterator() : m_querySet(0) , m_fetched(-1) , m_offset(0) { } /** Constructs a copy of \p other. */ const_iterator(const const_iterator &other) : m_querySet(other.m_querySet) , m_fetched(-1) , m_offset(other.m_offset) { } private: const_iterator(const QDjangoQuerySet *querySet, int offset = 0) : m_querySet(querySet) , m_fetched(-1) , m_offset(offset) { } public: /** Returns the current item. * * \sa operator->() */ const T &operator*() const { return *t(); } /** Returns a pointer to the current item. * * \sa operator*() */ const T *operator->() const { return t(); } /** Returns \c true if \p other points to the same item as this iterator; * otherwise returns \c false. * * \sa operator!=() */ bool operator==(const const_iterator &other) const { return m_querySet == other.m_querySet && m_offset == other.m_offset; } /** Returns \c true if \p other points to a different item than this iterator; * otherwise returns \c false. * * \sa operator==() */ bool operator!=(const const_iterator &other) const { return m_querySet != other.m_querySet || m_offset != other.m_offset; } /** Returns \c true if other \p points to a position behind this iterator; * otherwise returns \c false. */ bool operator<(const const_iterator& other) const { return (m_querySet == other.m_querySet && m_offset < other.m_offset) || m_querySet < other.m_querySet; } /** Returns \c true if other \p points to a position behind or equal this iterator; * otherwise returns \c false. */ bool operator<=(const const_iterator& other) const { return (m_querySet == other.m_querySet && m_offset <= other.m_offset) || m_querySet < other.m_querySet; } /** Returns \c true if other \p points to a position before this iterator; * otherwise returns \c false. */ bool operator>(const const_iterator& other) const { return (m_querySet == other.m_querySet && m_offset > other.m_offset) || m_querySet > other.m_querySet; } /** Returns \c true if other \p points to a position before or equal this iterator; * otherwise returns \c false. */ bool operator>=(const const_iterator& other) const { return (m_querySet == other.m_querySet && m_offset >= other.m_offset) || m_querySet > other.m_querySet; } /** The prefix ++ operator (\c ++it) advances the iterator to the next item in the set * and returns an iterator to the new current item. * * Calling this function on QDjangoQuerySet::end() leads to undefined results. * * \sa operator--() */ const_iterator &operator++() { ++m_offset; return *this; } /** The postfix ++ operator (\c it++) advances the iterator to the next item in the set and * returns an iterator to the previously current item. * * Calling this function on QDjangoQuerySet::end() leads to undefined results. * * \sa operator--(int) */ const_iterator operator++(int) { const_iterator n(*this); ++m_offset; return n; } /** Advances the iterator by \p i items. * (If \p i is negative, the iterator goes backward.) * * \sa operator-=() and operator+(). */ const_iterator &operator+=(int i) { m_offset += i; return *this; } /** Returns an iterator to the item at \p i positions forward from this iterator. * (If \p i is negative, the iterator goes backward.) * * \sa operator-() and operator+=() */ const_iterator operator+(int i) const { return const_iterator(m_querySet, m_offset + i); } /** Makes the iterator go back by \p i items. * (If \p i is negative, the iterator goes forward.) * * \sa operator+=() and operator-() */ const_iterator &operator-=(int i) { m_offset -= i; return *this; } /** Returns an iterator to the item at \p i positions backward from this iterator. * (If \p i is negative, the iterator goes forward.) * * \sa operator+() and operator-=() */ const_iterator operator-(int i) const { return const_iterator(m_querySet, m_offset - i); } /** The prefix -- operator (\c --it) makes the preceding item current * and returns an iterator to the new current item. * * Calling this function on QDjangoQuerySet::begin() leads to undefined results. * * \sa operator++(). */ const_iterator &operator--() { --m_offset; return *this; } /** The postfix -- operator (\c it--) makes the preceding item current * and returns an iterator to the previously current item. * * Calling this function on QDjangoQuerySet::begin() leads to undefined results. * * \sa operator++(int). */ const_iterator operator--(int) { const_iterator n(*this); --m_offset; return n; } /** Returns the number of items between the item pointed to by \p other * and the item pointed to by this iterator. */ difference_type operator-(const const_iterator &other) const { return m_offset - other.m_offset; } private: const T *t() const { if (m_fetched != m_offset && m_querySet) { if (const_cast *>(m_querySet)->at(m_offset, &m_object)) { m_fetched = m_offset; } } return m_fetched == m_offset ? &m_object : 0; } private: const QDjangoQuerySet *m_querySet; mutable int m_fetched; mutable T m_object; int m_offset; }; /** Qt-style synonym for QDjangoQuerySet::const_iterator. */ typedef const_iterator ConstIterator; QDjangoQuerySet(); QDjangoQuerySet(const QDjangoQuerySet &other); ~QDjangoQuerySet(); QDjangoQuerySet all() const; QDjangoQuerySet exclude(const QDjangoWhere &where) const; QDjangoQuerySet filter(const QDjangoWhere &where) const; QDjangoQuerySet limit(int pos, int length = -1) const; QDjangoQuerySet none() const; QDjangoQuerySet orderBy(const QStringList &keys) const; QDjangoQuerySet selectRelated() const; int count() const; QDjangoWhere where() const; bool remove(); int size(); int update(const QVariantMap &fields); QList values(const QStringList &fields = QStringList()); QList valuesList(const QStringList &fields = QStringList()); T *get(const QDjangoWhere &where, T *target = 0) const; T *at(int index, T *target = 0); const_iterator constBegin() const; const_iterator begin() const; const_iterator constEnd() const; const_iterator end() const; QDjangoQuerySet &operator=(const QDjangoQuerySet &other); private: QDjangoQuerySetPrivate *d; }; /** Constructs a new queryset. */ template QDjangoQuerySet::QDjangoQuerySet() { d = new QDjangoQuerySetPrivate(T::staticMetaObject.className()); } /** Constructs a copy of \a other. * * \param other */ template QDjangoQuerySet::QDjangoQuerySet(const QDjangoQuerySet &other) { other.d->counter.ref(); d = other.d; } /** Destroys the queryset. */ template QDjangoQuerySet::~QDjangoQuerySet() { if (!d->counter.deref()) delete d; } /** Returns the object in the QDjangoQuerySet at the given index. * * Returns 0 if the index is out of bounds. * * If target is 0, a new object instance will be allocated which * you must free yourself. * * \param index * \param target optional existing model instance. */ template T *QDjangoQuerySet::at(int index, T *target) { T *entry = target ? target : new T; if (!d->sqlLoad(entry, index)) { if (!target) delete entry; return 0; } return entry; } /** Returns a const STL-style iterator pointing to the first object in the QDjangoQuerySet. * * \sa begin() and constEnd(). */ template typename QDjangoQuerySet::const_iterator QDjangoQuerySet::constBegin() const { return const_iterator(this); } /** Returns a const STL-style iterator pointing to the first object in the QDjangoQuerySet. * * \sa constBegin() and end(). */ template typename QDjangoQuerySet::const_iterator QDjangoQuerySet::begin() const { return const_iterator(this); } /** Returns a const STL-style iterator pointing to the imaginary object after the last * object in the QDjangoQuerySet. * * \sa constBegin() and end(). */ template typename QDjangoQuerySet::const_iterator QDjangoQuerySet::constEnd() const { return const_iterator(this, QDjangoQuerySet::count()); } /** Returns a const STL-style iterator pointing to the imaginary object after the last * object in the QDjangoQuerySet. * * \sa begin() and constEnd(). */ template typename QDjangoQuerySet::const_iterator QDjangoQuerySet::end() const { return const_iterator(this, QDjangoQuerySet::count()); } /** Returns a copy of the current QDjangoQuerySet. */ template QDjangoQuerySet QDjangoQuerySet::all() const { QDjangoQuerySet other; other.d->lowMark = d->lowMark; other.d->highMark = d->highMark; other.d->orderBy = d->orderBy; other.d->selectRelated = d->selectRelated; other.d->whereClause = d->whereClause; return other; } /** Counts the number of objects in the queryset using an SQL COUNT query, * or -1 if the query failed. * * If you intend to iterate over the results, you should consider using * size() instead. * * \note If the QDjangoQuerySet is already fully fetched, this simply returns * the number of objects. */ template int QDjangoQuerySet::count() const { if (d->hasResults) return d->properties.size(); // execute COUNT query QDjangoQuery query(d->countQuery()); if (!query.exec() || !query.next()) return -1; return query.value(0).toInt(); } /** Returns a new QDjangoQuerySet containing objects for which the given key * where condition is false. * * You can chain calls to filter() and exclude() to further refine the * filtering conditions. * * \param where QDjangoWhere expressing the exclude condition * * \sa filter() */ template QDjangoQuerySet QDjangoQuerySet::exclude(const QDjangoWhere &where) const { QDjangoQuerySet other = all(); other.d->addFilter(!where); return other; } /** Returns a new QDjangoQuerySet containing objects for which the given * where condition is true. * * You can chain calls to filter() and exclude() to progressively refine * your filtering conditions. * * \param where QDjangoWhere expressing the filter condition * * \sa exclude() */ template QDjangoQuerySet QDjangoQuerySet::filter(const QDjangoWhere &where) const { QDjangoQuerySet other = all(); other.d->addFilter(where); return other; } /** Returns the object in the QDjangoQuerySet for which the given * where condition is true. * * Returns 0 if the number of matching object is not exactly one. * * If target is 0, a new object instance will be allocated which * you must free yourself. * * \param where QDjangoWhere expressing the lookup condition * \param target optional existing model instance. */ template T *QDjangoQuerySet::get(const QDjangoWhere &where, T *target) const { QDjangoQuerySet qs = filter(where); return qs.size() == 1 ? qs.at(0, target) : 0; } /** Returns a new QDjangoQuerySet containing limiting the number of * records to manipulate. * * You can chain calls to limit() to further restrict the number * of returned records. * * However, you cannot apply additional restrictions using filter(), * exclude(), get(), orderBy() or remove() on the returned QDjangoQuerySet. * * \param pos offset of the records * \param length maximum number of records */ template QDjangoQuerySet QDjangoQuerySet::limit(int pos, int length) const { Q_ASSERT(pos >= 0); Q_ASSERT(length >= -1); QDjangoQuerySet other = all(); other.d->lowMark += pos; if (length > 0) { // calculate new high mark other.d->highMark = other.d->lowMark + length; // never exceed the current high mark if (d->highMark > 0 && other.d->highMark > d->highMark) other.d->highMark = d->highMark; } return other; } /** Returns an empty QDjangoQuerySet. */ template QDjangoQuerySet QDjangoQuerySet::none() const { QDjangoQuerySet other; other.d->whereClause = !QDjangoWhere(); return other; } /** Returns a QDjangoQuerySet whose elements are ordered using the given keys. * * By default the elements will by in ascending order. You can prefix the key * names with a "-" (minus sign) to use descending order. * * \param keys */ template QDjangoQuerySet QDjangoQuerySet::orderBy(const QStringList &keys) const { // it is not possible to change ordering once a limit has been set Q_ASSERT(!d->lowMark && !d->highMark); QDjangoQuerySet other = all(); other.d->orderBy << keys; return other; } /** Deletes all objects in the QDjangoQuerySet. * * \return true if deletion succeeded, false otherwise */ template bool QDjangoQuerySet::remove() { return d->sqlDelete(); } /** Returns a QDjangoQuerySet that will automatically "follow" foreign-key * relationships, selecting that additional related-object data when it * executes its query. */ template QDjangoQuerySet QDjangoQuerySet::selectRelated() const { QDjangoQuerySet other = all(); other.d->selectRelated = true; return other; } /** Returns the number of objects in the QDjangoQuerySet, or -1 * if the query failed. * * If you do not plan to access the objects, you should consider using * count() instead. */ template int QDjangoQuerySet::size() { if (!d->sqlFetch()) return -1; return d->properties.size(); } /** Performs an SQL update query for the specified \a fields and returns the * number of rows affected, or -1 if the update failed. */ template int QDjangoQuerySet::update(const QVariantMap &fields) { return d->sqlUpdate(fields); } /** Returns a list of property hashes for the current QDjangoQuerySet. * If no \a fields are specified, all the model's declared fields are returned. * * \param fields */ template QList QDjangoQuerySet::values(const QStringList &fields) { return d->sqlValues(fields); } /** Returns a list of property lists for the current QDjangoQuerySet. * If no \a fields are specified, all the model's fields are returned in the * order they where declared. * * \param fields */ template QList QDjangoQuerySet::valuesList(const QStringList &fields) { return d->sqlValuesList(fields); } /** Returns the QDjangoWhere expressing the WHERE clause of the * QDjangoQuerySet. */ template QDjangoWhere QDjangoQuerySet::where() const { return d->resolvedWhere(QDjango::database()); } /** Assigns the specified queryset to this object. * * \param other */ template QDjangoQuerySet &QDjangoQuerySet::operator=(const QDjangoQuerySet &other) { other.d->counter.ref(); if (!d->counter.deref()) delete d; d = other.d; return *this; } #endif qdjango-0.4.0/src/db/QDjangoModel.cpp0000644000175000007640000000564012163016632017247 0ustar sharkyjerryweb/* * 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. */ #include #include #include "QDjango.h" #include "QDjangoModel.h" #include "QDjangoQuerySet.h" /** Construct a new QDjangoModel. * * \param parent */ QDjangoModel::QDjangoModel(QObject *parent) : QObject(parent) { } /** Returns the primary key for this QDjangoModel. */ QVariant QDjangoModel::pk() const { const QDjangoMetaModel metaModel = QDjango::metaModel(metaObject()->className()); return property(metaModel.primaryKey()); } /** Sets the primary key for this QDjangoModel. * * \param pk */ void QDjangoModel::setPk(const QVariant &pk) { const QDjangoMetaModel metaModel = QDjango::metaModel(metaObject()->className()); setProperty(metaModel.primaryKey(), pk); } /** Retrieves the QDjangoModel pointed to by the given foreign-key. * * \param name */ QObject *QDjangoModel::foreignKey(const char *name) const { const QDjangoMetaModel metaModel = QDjango::metaModel(metaObject()->className()); return metaModel.foreignKey(this, name); } /** Sets the QDjangoModel pointed to by the given foreign-key. * * \param name * \param value * * \note The current QDjangoModel will take ownership of the given \c value. */ void QDjangoModel::setForeignKey(const char *name, QObject *value) { const QDjangoMetaModel metaModel = QDjango::metaModel(metaObject()->className()); metaModel.setForeignKey(this, name, value); } /** Deletes the QDjangoModel from the database. * * \return true if deletion succeeded, false otherwise */ bool QDjangoModel::remove() { const QDjangoMetaModel metaModel = QDjango::metaModel(metaObject()->className()); return metaModel.remove(this); } /** Saves the QDjangoModel to the database. * * \return true if saving succeeded, false otherwise */ bool QDjangoModel::save() { const QDjangoMetaModel metaModel = QDjango::metaModel(metaObject()->className()); return metaModel.save(this); } /** Returns a string representation of the model instance. */ QString QDjangoModel::toString() const { const QDjangoMetaModel metaModel = QDjango::metaModel(metaObject()->className()); const QByteArray pkName = metaModel.primaryKey(); return QString::fromLatin1("%1(%2=%3)").arg(QString::fromLatin1(metaObject()->className()), QString::fromLatin1(pkName), property(pkName).toString()); } qdjango-0.4.0/src/db/QDjango.h0000644000175000007640000000375012163016632015733 0ustar sharkyjerryweb/* * 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_H #define QDJANGO_H #include "QDjangoMetaModel.h" class QObject; class QSqlDatabase; class QSqlQuery; class QString; /** \defgroup Database * * QDjango's Object Relation Mapper (ORM) strives to be both powerful * and simple to use. Where possible it tries to follow django's * ORM API, with a similar lazy queryset mechanism. */ /** \brief The QDjango class provides a set of static functions. * * It is used to access registered QDjangoModel classes. * * \ingroup Database */ class QDJANGO_EXPORT QDjango { public: static bool createTables(); static bool dropTables(); static QSqlDatabase database(); static void setDatabase(QSqlDatabase database); static bool isDebugEnabled(); static void setDebugEnabled(bool enabled); template static QDjangoMetaModel registerModel(); private: // backend specific static QString noLimitSql(); static QDjangoMetaModel registerModel(const QMetaObject *meta); static QDjangoMetaModel metaModel(const char *name); friend class QDjangoCompiler; friend class QDjangoModel; friend class QDjangoMetaModel; friend class QDjangoQuerySetPrivate; }; /** Register a QDjangoModel class with QDjango. */ template QDjangoMetaModel QDjango::registerModel() { return registerModel(&T::staticMetaObject); } #endif qdjango-0.4.0/src/db/QDjangoMetaModel.h0000644000175000007640000000525312163016632017523 0ustar sharkyjerryweb/* * Copyright (C) 2010-2013 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 QDJANGOMETAMODEL_H #define QDJANGOMETAMODEL_H #include #include #include #include "QDjango_p.h" class QDjangoMetaFieldPrivate; class QDjangoMetaModelPrivate; /** \brief The QDjangoMetaField class holds the database schema for a field. * * \internal */ class QDJANGO_EXPORT QDjangoMetaField { public: QDjangoMetaField(); QDjangoMetaField(const QDjangoMetaField &other); ~QDjangoMetaField(); QDjangoMetaField& operator=(const QDjangoMetaField &other); QString column() const; bool isAutoIncrement() const; bool isBlank() const; bool isNullable() const; bool isUnique() const; bool isValid() const; QString name() const; int maxLength() const; QVariant toDatabase(const QVariant &value) const; private: QSharedDataPointer d; friend class QDjangoMetaModel; }; /** \brief The QDjangoMetaModel class holds the database schema for a model. * * It manages table creation and deletion operations as well as row * serialisation, deserialisation and deletion operations. * * \internal */ class QDJANGO_EXPORT QDjangoMetaModel { public: QDjangoMetaModel(const QMetaObject *model = 0); QDjangoMetaModel(const QDjangoMetaModel &other); ~QDjangoMetaModel(); QDjangoMetaModel& operator=(const QDjangoMetaModel &other); bool createTable() const; QStringList createTableSql() const; bool dropTable() const; void load(QObject *model, const QVariantList &props, int &pos) const; bool remove(QObject *model) const; bool save(QObject *model) const; QObject *foreignKey(const QObject *model, const char *name) const; void setForeignKey(QObject *model, const char *name, QObject *value) const; QDjangoMetaField localField(const char *name) const; QList localFields() const; QMap foreignFields() const; QByteArray primaryKey() const; QString table() const; private: QSharedDataPointer d; }; #endif qdjango-0.4.0/src/db/QDjangoMetaModel.cpp0000644000175000007640000005636212163016632020065 0ustar sharkyjerryweb/* * Copyright (C) 2010-2013 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. */ #include #include #include #include #include "QDjango.h" #include "QDjangoMetaModel.h" #include "QDjangoQuerySet_p.h" // python-compatible hash static long string_hash(const QString &s) { if (s.isEmpty()) return 0; const QByteArray a = s.toLatin1(); unsigned char *p = (unsigned char *) a.constData(); long x = *p << 7; for (int i = 0; i < a.size(); ++i) x = (1000003*x) ^ *p++; x ^= a.size(); return (x == -1) ? -2 : x; } static long stringlist_hash(const QStringList &l) { long x = 0x345678L; long mult = 1000003L; int len = l.size(); foreach (const QString &s, l) { --len; x = (x ^ string_hash(s)) * mult; mult += (long)(82520L + len + len); } x += 97531L; return (x == -1) ? -2 : x; } // django-compatible digest static QString stringlist_digest(const QStringList &l) { return QString::number(labs(stringlist_hash(l)) % 4294967296L, 16); } enum ForeignKeyConstraint { NoAction, Restrict, Cascade, SetNull }; class QDjangoMetaFieldPrivate : public QSharedData { public: QDjangoMetaFieldPrivate(); bool autoIncrement; QString db_column; QByteArray foreignModel; bool index; int maxLength; QByteArray name; bool null; QVariant::Type type; bool unique; bool blank; ForeignKeyConstraint deleteConstraint; }; QDjangoMetaFieldPrivate::QDjangoMetaFieldPrivate() : autoIncrement(false) , index(false) , maxLength(0) , null(false) , unique(false) , blank(false) , deleteConstraint(NoAction) { } /*! Constructs a new QDjangoMetaField. */ QDjangoMetaField::QDjangoMetaField() { d = new QDjangoMetaFieldPrivate; } /*! Constructs a copy of \a other. */ QDjangoMetaField::QDjangoMetaField(const QDjangoMetaField &other) : d(other.d) { } /*! Destroys the meta field. */ QDjangoMetaField::~QDjangoMetaField() { } /*! Assigns \a other to this meta field. */ QDjangoMetaField& QDjangoMetaField::operator=(const QDjangoMetaField& other) { d = other.d; return *this; } /*! Returns the database column for this meta field. */ QString QDjangoMetaField::column() const { return d->db_column; } /*! Returns true if this field is nullable. */ bool QDjangoMetaField::isNullable() const { return d->null; } /*! Returns true if this is a valid field. */ bool QDjangoMetaField::isValid() const { return !d->name.isEmpty(); } /*! Returns true if this field is auto incremented. */ bool QDjangoMetaField::isAutoIncrement() const { return d->autoIncrement; } /*! Returns true if this field is unique. */ bool QDjangoMetaField::isUnique() const { return d->unique; } /*! Returns true if this field can be empty. */ bool QDjangoMetaField::isBlank() const { return d->blank; } /*! Returns name of this meta field. */ QString QDjangoMetaField::name() const { return QString::fromLatin1(d->name); } /*! Returns the max length of this field */ int QDjangoMetaField::maxLength() const { return d->maxLength; } /*! Transforms the given field value for database storage. */ QVariant QDjangoMetaField::toDatabase(const QVariant &value) const { if (d->type == QVariant::String && !d->null && value.isNull()) return QLatin1String(""); else if (!d->foreignModel.isEmpty() && d->type == QVariant::Int && d->null && !value.toInt()) { // store 0 foreign key as NULL if the field is NULL return QVariant(); } else return value; } static QMap parseOptions(const char *value) { QMap options; QStringList items = QString::fromLatin1(value).split(QLatin1Char(' ')); foreach (const QString &item, items) { QStringList assign = item.split(QLatin1Char('=')); if (assign.size() == 2) { options[assign[0].toLower()] = assign[1]; } else { qWarning() << "Could not parse option" << item; } } return options; } static bool stringToBool(const QString &value) { return value.toLower() == QLatin1String("true") || value == QLatin1String("1"); } class QDjangoMetaModelPrivate : public QSharedData { public: QList localFields; QMap foreignFields; QByteArray primaryKey; QString table; QList uniqueTogether; }; /*! Constructs a new QDjangoMetaModel by inspecting the given \a meta model. */ QDjangoMetaModel::QDjangoMetaModel(const QMetaObject *meta) : d(new QDjangoMetaModelPrivate) { if (!meta) return; d->table = QString::fromLatin1(meta->className()).toLower(); // parse table options const int optionsIndex = meta->indexOfClassInfo("__meta__"); if (optionsIndex >= 0) { QMap options = parseOptions(meta->classInfo(optionsIndex).value()); QMapIterator option(options); while (option.hasNext()) { option.next(); if (option.key() == QLatin1String("db_table")) d->table = option.value(); else if (option.key() == QLatin1String("unique_together")) d->uniqueTogether = option.value().toLatin1().split(','); } } const int count = meta->propertyCount(); for(int i = QObject::staticMetaObject.propertyCount(); i < count; ++i) { const QString typeName = QString::fromLatin1(meta->property(i).typeName()); if (!qstrcmp(meta->property(i).name(), "pk")) continue; // parse field options bool autoIncrementOption = false; QString dbColumnOption; bool dbIndexOption = false; bool ignoreFieldOption = false; int maxLengthOption = 0; bool primaryKeyOption = false; bool nullOption = false; bool uniqueOption = false; bool blankOption = false; ForeignKeyConstraint deleteConstraint = NoAction; const int infoIndex = meta->indexOfClassInfo(meta->property(i).name()); if (infoIndex >= 0) { QMap options = parseOptions(meta->classInfo(infoIndex).value()); QMapIterator option(options); while (option.hasNext()) { option.next(); const QString key = option.key(); const QString value = option.value(); if (key == QLatin1String("auto_increment")) autoIncrementOption = stringToBool(value); else if (key == QLatin1String("db_column")) dbColumnOption = value; else if (key == QLatin1String("db_index")) dbIndexOption = stringToBool(value); else if (key == QLatin1String("ignore_field")) ignoreFieldOption = stringToBool(value); else if (key == QLatin1String("max_length")) maxLengthOption = value.toInt(); else if (key == QLatin1String("null")) nullOption = stringToBool(value); else if (key == QLatin1String("primary_key")) primaryKeyOption = stringToBool(value); else if (key == QLatin1String("unique")) uniqueOption = stringToBool(value); else if (key == QLatin1String("blank")) blankOption = stringToBool(value); else if (option.key() == "on_delete") { if (value.toLower() == "cascade") deleteConstraint = Cascade; else if (value.toLower() == "set_null") deleteConstraint = SetNull; else if (value.toLower() == "restrict") deleteConstraint = Restrict; } } } // ignore field if (ignoreFieldOption) continue; // foreign field if (typeName.endsWith(QLatin1Char('*'))) { const QByteArray fkName = meta->property(i).name(); const QByteArray fkModel = typeName.left(typeName.size() - 1).toLatin1(); d->foreignFields.insert(fkName, fkModel); QDjangoMetaField field; field.d->name = fkName + "_id"; // FIXME : the key is not necessarily an INTEGER field, we should // probably perform a lookup on the foreign model, but are we sure // it is already registered? field.d->type = QVariant::Int; field.d->foreignModel = fkModel; field.d->db_column = dbColumnOption.isEmpty() ? QString::fromLatin1(field.d->name) : dbColumnOption; field.d->index = true; field.d->null = nullOption; field.d->deleteConstraint = deleteConstraint; d->localFields << field; continue; } // local field QDjangoMetaField field; field.d->name = meta->property(i).name(); field.d->type = meta->property(i).type(); field.d->db_column = dbColumnOption.isEmpty() ? QString::fromLatin1(field.d->name) : dbColumnOption; field.d->maxLength = maxLengthOption; field.d->null = nullOption; if (primaryKeyOption) { field.d->autoIncrement = autoIncrementOption; d->primaryKey = field.d->name; } else if (uniqueOption) { field.d->unique = true; } else if (blankOption) { field.d->blank = true; } else if (dbIndexOption) { field.d->index = true; } d->localFields << field; } // automatic primary key if (d->primaryKey.isEmpty()) { QDjangoMetaField field; field.d->name = "id"; field.d->type = QVariant::Int; field.d->db_column = QLatin1String("id"); field.d->autoIncrement = true; d->localFields.prepend(field); d->primaryKey = field.d->name; } } /*! Constructs a copy of \a other. */ QDjangoMetaModel::QDjangoMetaModel(const QDjangoMetaModel &other) : d(other.d) { } /*! Destroys the meta model. */ QDjangoMetaModel::~QDjangoMetaModel() { } /*! Assigns \a other to this meta model. */ QDjangoMetaModel& QDjangoMetaModel::operator=(const QDjangoMetaModel& other) { d = other.d; return *this; } /*! Creates the database table for this QDjangoMetaModel. */ bool QDjangoMetaModel::createTable() const { QDjangoQuery createQuery(QDjango::database()); foreach (const QString &sql, createTableSql()) { if (!createQuery.exec(sql)) return false; } return true; } /*! Returns the SQL queries to create the database table for this QDjangoMetaModel. */ QStringList QDjangoMetaModel::createTableSql() const { QSqlDatabase db = QDjango::database(); QSqlDriver *driver = db.driver(); const QString driverName = db.driverName(); QStringList queries; QStringList propSql; const QString quotedTable = db.driver()->escapeIdentifier(d->table, QSqlDriver::TableName); foreach (const QDjangoMetaField &field, d->localFields) { QString fieldSql = driver->escapeIdentifier(field.column(), QSqlDriver::FieldName); switch (field.d->type) { case QVariant::Bool: if (driverName == QLatin1String("QPSQL")) fieldSql += QLatin1String(" boolean"); else fieldSql += QLatin1String(" bool"); break; case QVariant::ByteArray: if (driverName == QLatin1String("QPSQL")) fieldSql += QLatin1String(" bytea"); else { fieldSql += QLatin1String(" blob"); if (field.d->maxLength > 0) fieldSql += QLatin1Char('(') + QString::number(field.d->maxLength) + QLatin1Char(')'); } break; case QVariant::Date: fieldSql += QLatin1String(" date"); break; case QVariant::DateTime: if (driverName == QLatin1String("QPSQL")) fieldSql += QLatin1String(" timestamp"); else fieldSql += QLatin1String(" datetime"); break; case QVariant::Double: fieldSql += QLatin1String(" real"); break; case QVariant::Int: fieldSql += QLatin1String(" integer"); break; case QVariant::LongLong: fieldSql += QLatin1String(" bigint"); break; case QVariant::String: if (field.d->maxLength > 0) fieldSql += QLatin1String(" varchar(") + QString::number(field.d->maxLength) + QLatin1Char(')'); else fieldSql += QLatin1String(" text"); break; case QVariant::Time: fieldSql += QLatin1String(" time"); break; default: qWarning() << "Unhandled type" << field.d->type << "for property" << field.d->name; continue; } if (!field.d->null) fieldSql += QLatin1String(" NOT NULL"); if (field.d->unique) fieldSql += QLatin1String(" UNIQUE"); // primary key if (field.d->name == d->primaryKey) fieldSql += QLatin1String(" PRIMARY KEY"); // auto-increment is backend specific if (field.d->autoIncrement) { if (driverName == QLatin1String("QSQLITE") || driverName == QLatin1String("QSQLITE2")) // NOTE: django does not add this option for sqlite, but there // is a ticket asking for it to do so: // https://code.djangoproject.com/ticket/10164 fieldSql += QLatin1String(" AUTOINCREMENT"); else if (driverName == QLatin1String("QMYSQL")) fieldSql += QLatin1String(" AUTO_INCREMENT"); else if (driverName == QLatin1String("QPSQL")) fieldSql = driver->escapeIdentifier(field.column(), QSqlDriver::FieldName) + QLatin1String(" serial PRIMARY KEY"); } // foreign key if (!field.d->foreignModel.isEmpty()) { const QDjangoMetaModel foreignMeta = QDjango::metaModel(field.d->foreignModel); const QDjangoMetaField foreignField = foreignMeta.localField("pk"); fieldSql += QString::fromLatin1(" REFERENCES %1 (%2)").arg( driver->escapeIdentifier(foreignMeta.d->table, QSqlDriver::TableName), driver->escapeIdentifier(foreignField.column(), QSqlDriver::FieldName)); if (field.d->deleteConstraint != NoAction) { fieldSql += " ON DELETE"; switch (field.d->deleteConstraint) { case Cascade: fieldSql += " CASCADE"; break; case SetNull: fieldSql += " SET NULL"; break; case Restrict: fieldSql += " RESTRICT"; break; default: break; } } if (driverName == QLatin1String("QPSQL")) fieldSql += " DEFERRABLE INITIALLY DEFERRED"; } propSql << fieldSql; } // unique contraints if (!d->uniqueTogether.isEmpty()) { QStringList columns; foreach (const QByteArray &name, d->uniqueTogether) { columns << driver->escapeIdentifier(localField(name).column(), QSqlDriver::FieldName); } propSql << QString::fromLatin1("UNIQUE (%2)").arg(columns.join(QLatin1String(", "))); } // create table queries << QString::fromLatin1("CREATE TABLE %1 (%2)").arg( quotedTable, propSql.join(QLatin1String(", "))); // create indices foreach (const QDjangoMetaField &field, d->localFields) { if (field.d->index) { const QString indexName = d->table + QLatin1Char('_') + stringlist_digest(QStringList() << field.column()); queries << QString::fromLatin1("CREATE INDEX %1 ON %2 (%3)").arg( // FIXME : how should we escape an index name? driver->escapeIdentifier(indexName, QSqlDriver::FieldName), quotedTable, driver->escapeIdentifier(field.column(), QSqlDriver::FieldName)); } } return queries; } /*! Drops the database table for this QDjangoMetaModel. */ bool QDjangoMetaModel::dropTable() const { QSqlDatabase db = QDjango::database(); QDjangoQuery query(db); return query.exec(QLatin1String("DROP TABLE ") + db.driver()->escapeIdentifier(d->table, QSqlDriver::TableName)); } /*! Retrieves the QDjangoModel pointed to by the given foreign-key. \param model \param name */ QObject *QDjangoMetaModel::foreignKey(const QObject *model, const char *name) const { // check the name is valid const QByteArray prop(name); if (!d->foreignFields.contains(prop)) { qWarning("QDjangoMetaModel cannot get foreign model for invalid key '%s'", name); return 0; } QObject *foreign = model->property(prop + "_ptr").value(); if (!foreign) return 0; // if the foreign object was not loaded yet, do it now const QByteArray foreignClass = d->foreignFields[prop]; const QDjangoMetaModel foreignMeta = QDjango::metaModel(foreignClass); const QVariant foreignPk = model->property(prop + "_id"); if (foreign->property(foreignMeta.primaryKey()) != foreignPk) { QDjangoQuerySetPrivate qs(foreignClass); qs.addFilter(QDjangoWhere(QLatin1String("pk"), QDjangoWhere::Equals, foreignPk)); qs.sqlFetch(); if (qs.properties.size() != 1 || !qs.sqlLoad(foreign, 0)) return 0; } return foreign; } /*! Sets the QDjangoModel pointed to by the given foreign-key. \param model \param name \param value */ void QDjangoMetaModel::setForeignKey(QObject *model, const char *name, QObject *value) const { // check the name is valid const QByteArray prop(name); if (!d->foreignFields.contains(prop)) { qWarning("QDjangoMetaModel cannot set foreign model for invalid key '%s'", name); return; } QObject *old = model->property(prop + "_ptr").value(); if (old == value) return; // store the new pointer and update the foreign key model->setProperty(prop + "_ptr", qVariantFromValue(value)); if (value) { const QDjangoMetaModel foreignMeta = QDjango::metaModel(d->foreignFields[prop]); model->setProperty(prop + "_id", value->property(foreignMeta.primaryKey())); } else { model->setProperty(prop + "_id", QVariant()); } } /*! Loads the given properties into a \a model instance. */ void QDjangoMetaModel::load(QObject *model, const QVariantList &properties, int &pos) const { // process local fields foreach (const QDjangoMetaField &field, d->localFields) model->setProperty(field.d->name, properties.at(pos++)); // process foreign fields if (pos >= properties.size()) return; foreach (const QByteArray &fkName, d->foreignFields.keys()) { QObject *object = model->property(fkName + "_ptr").value(); if (object) { const QDjangoMetaModel foreignMeta = QDjango::metaModel(d->foreignFields[fkName]); foreignMeta.load(object, properties, pos); } } } /*! Returns the foreign field mapping. */ QMap QDjangoMetaModel::foreignFields() const { return d->foreignFields; } /*! Return the local field with the specified \a name. */ QDjangoMetaField QDjangoMetaModel::localField(const char *name) const { const QByteArray fieldName = strcmp(name, "pk") ? QByteArray(name) : d->primaryKey; foreach (const QDjangoMetaField &field, d->localFields) { if (field.d->name == fieldName) return field; } return QDjangoMetaField(); } /*! Returns the list of local fields. */ QList QDjangoMetaModel::localFields() const { return d->localFields; } /*! Returns the name of the primary key for the current QDjangoMetaModel. */ QByteArray QDjangoMetaModel::primaryKey() const { return d->primaryKey; } /*! Returns the name of the database table. */ QString QDjangoMetaModel::table() const { return d->table; } /*! Removes the given \a model instance from the database. */ bool QDjangoMetaModel::remove(QObject *model) const { const QVariant pk = model->property(d->primaryKey); QDjangoQuerySetPrivate qs(model->metaObject()->className()); qs.addFilter(QDjangoWhere(QLatin1String("pk"), QDjangoWhere::Equals, pk)); return qs.sqlDelete(); } /*! Saves the given \a model instance to the database. \return true if saving succeeded, false otherwise */ bool QDjangoMetaModel::save(QObject *model) const { // find primary key const QDjangoMetaField primaryKey = localField("pk"); const QVariant pk = model->property(d->primaryKey); if (!pk.isNull() && !(primaryKey.d->type == QVariant::Int && !pk.toInt())) { QSqlDatabase db = QDjango::database(); QDjangoQuery query(db); query.prepare(QString::fromLatin1("SELECT 1 AS a FROM %1 WHERE %2 = ?").arg( db.driver()->escapeIdentifier(d->table, QSqlDriver::FieldName), db.driver()->escapeIdentifier(primaryKey.column(), QSqlDriver::FieldName))); query.addBindValue(pk); if (query.exec() && query.next()) { // prepare data QVariantMap fields; foreach (const QDjangoMetaField &field, d->localFields) { if (field.d->name != d->primaryKey) { const QVariant value = model->property(field.d->name); fields.insert(QString::fromLatin1(field.d->name), field.toDatabase(value)); } } // perform UPDATE QDjangoQuerySetPrivate qs(model->metaObject()->className()); qs.addFilter(QDjangoWhere(QLatin1String("pk"), QDjangoWhere::Equals, pk)); return qs.sqlUpdate(fields) != -1; } } // prepare data QVariantMap fields; foreach (const QDjangoMetaField &field, d->localFields) { if (!field.d->autoIncrement) { const QVariant value = model->property(field.d->name); fields.insert(field.name(), field.toDatabase(value)); } } // perform INSERT QDjangoQuerySetPrivate qs(model->metaObject()->className()); if (primaryKey.d->autoIncrement) { // fetch autoincrement pk QVariant insertId; if (!qs.sqlInsert(fields, &insertId)) return false; model->setProperty(d->primaryKey, insertId); } else { if (!qs.sqlInsert(fields)) return false; } return true; } qdjango-0.4.0/src/db/QDjangoWhere.cpp0000644000175000007640000002047612163016632017265 0ustar sharkyjerryweb/* * 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. */ #include #include "QDjango.h" #include "QDjangoWhere.h" #include "QDjangoWhere_p.h" static QString escapeLike(const QString &data) { QString escaped = data; escaped.replace(QLatin1String("%"), QLatin1String("\\%")); escaped.replace(QLatin1String("_"), QLatin1String("\\_")); return escaped; } /// \cond QDjangoWherePrivate::QDjangoWherePrivate() : operation(QDjangoWhere::None) , combine(NoCombine) , negate(false) { } /// \endcond /** Constructs an empty QDjangoWhere, which expresses no constraint. */ QDjangoWhere::QDjangoWhere() { d = new QDjangoWherePrivate; } /** Constructs a copy of \a other. */ QDjangoWhere::QDjangoWhere(const QDjangoWhere &other) : d(other.d) { } /** Constructs a QDjangoWhere expressing a constraint on a database column. * * \param key * \param operation * \param value */ QDjangoWhere::QDjangoWhere(const QString &key, QDjangoWhere::Operation operation, QVariant value) { d = new QDjangoWherePrivate; d->key = key; d->operation = operation; d->data = value; } /** Destroys a QDjangoWhere. */ QDjangoWhere::~QDjangoWhere() { } /** Assigns \a other to this QDjangoWhere. */ QDjangoWhere& QDjangoWhere::operator=(const QDjangoWhere& other) { d = other.d; return *this; } /** Negates the current QDjangoWhere. */ QDjangoWhere QDjangoWhere::operator!() const { QDjangoWhere result; result.d = d; if (d->children.isEmpty()) { switch (d->operation) { case None: case IsIn: case StartsWith: case EndsWith: case Contains: result.d->negate = !d->negate; break; case IsNull: // simplify !(is null) to is not null result.d->data = !d->data.toBool(); break; case Equals: // simplify !(a = b) to a != b result.d->operation = NotEquals; break; case NotEquals: // simplify !(a != b) to a = b result.d->operation = Equals; break; case GreaterThan: // simplify !(a > b) to a <= b result.d->operation = LessOrEquals; break; case LessThan: // simplify !(a < b) to a >= b result.d->operation = GreaterOrEquals; break; case GreaterOrEquals: // simplify !(a >= b) to a < b result.d->operation = LessThan; break; case LessOrEquals: // simplify !(a <= b) to a > b result.d->operation = GreaterThan; break; } } else { result.d->negate = !d->negate; } return result; } /** Combines the current QDjangoWhere with the \a other QDjangoWhere using * a logical AND. * * \param other */ QDjangoWhere QDjangoWhere::operator&&(const QDjangoWhere &other) const { if (isAll() || other.isNone()) return other; else if (isNone() || other.isAll()) return *this; QDjangoWhere result; result.d->combine = QDjangoWherePrivate::AndCombine; result.d->children << *this << other; return result; } /** Combines the current QDjangoWhere with the \a other QDjangoWhere using * a logical OR. * * \param other */ QDjangoWhere QDjangoWhere::operator||(const QDjangoWhere &other) const { if (isAll() || other.isNone()) return *this; else if (isNone() || other.isAll()) return other; QDjangoWhere result; result.d->combine = QDjangoWherePrivate::OrCombine; result.d->children << *this << other; return result; } /** Bind the values associated with this QDjangoWhere to the given \a query. * * \param query */ void QDjangoWhere::bindValues(QDjangoQuery &query) const { if (d->operation == QDjangoWhere::IsIn) { const QList values = d->data.toList(); for (int i = 0; i < values.size(); i++) query.addBindValue(values[i]); } else if (d->operation == QDjangoWhere::IsNull) { // no data to bind } else if (d->operation == QDjangoWhere::StartsWith) { query.addBindValue(escapeLike(d->data.toString()) + QLatin1String("%")); } else if (d->operation == QDjangoWhere::EndsWith) { query.addBindValue(QLatin1String("%") + escapeLike(d->data.toString())); } else if (d->operation == QDjangoWhere::Contains) { query.addBindValue(QLatin1String("%") + escapeLike(d->data.toString()) + QLatin1String("%")); } else if (d->operation != QDjangoWhere::None) query.addBindValue(d->data); else foreach (const QDjangoWhere &child, d->children) child.bindValues(query); } /** Returns true if the current QDjangoWhere does not express any constraint. */ bool QDjangoWhere::isAll() const { return d->combine == QDjangoWherePrivate::NoCombine && d->operation == None && d->negate == false; } /** Returns true if the current QDjangoWhere expressed an impossible constraint. */ bool QDjangoWhere::isNone() const { return d->combine == QDjangoWherePrivate::NoCombine && d->operation == None && d->negate == true; } /** Returns the SQL code corresponding for the current QDjangoWhere. */ QString QDjangoWhere::sql(const QSqlDatabase &db) const { switch (d->operation) { case Equals: return d->key + QLatin1String(" = ?"); case NotEquals: return d->key + QLatin1String(" != ?"); case GreaterThan: return d->key + QLatin1String(" > ?"); case LessThan: return d->key + QLatin1String(" < ?"); case GreaterOrEquals: return d->key + QLatin1String(" >= ?"); case LessOrEquals: return d->key + QLatin1String(" <= ?"); case IsIn: { QStringList bits; for (int i = 0; i < d->data.toList().size(); i++) bits << QLatin1String("?"); if (d->negate) return d->key + QString::fromLatin1(" NOT IN (%1)").arg(bits.join(QLatin1String(", "))); else return d->key + QString::fromLatin1(" IN (%1)").arg(bits.join(QLatin1String(", "))); } case IsNull: return d->key + QLatin1String(d->data.toBool() ? " IS NULL" : " IS NOT NULL"); case StartsWith: case EndsWith: case Contains: { const QString op = QLatin1String(d->negate ? "NOT LIKE" : "LIKE"); if (db.driverName() == QLatin1String("QSQLITE") || db.driverName() == QLatin1String("QSQLITE2")) return d->key + QLatin1String(" ") + op + QLatin1String(" ? ESCAPE '\\'"); else return d->key + QLatin1String(" ") + op + QLatin1String(" ?"); } case None: if (d->combine == QDjangoWherePrivate::NoCombine) { return d->negate ? QLatin1String("1 != 0") : QString(); } else { QStringList bits; foreach (const QDjangoWhere &child, d->children) { QString atom = child.sql(db); if (child.d->children.isEmpty()) bits << atom; else bits << QString::fromLatin1("(%1)").arg(atom); } QString combined; if (d->combine == QDjangoWherePrivate::AndCombine) combined = bits.join(QLatin1String(" AND ")); else if (d->combine == QDjangoWherePrivate::OrCombine) combined = bits.join(QLatin1String(" OR ")); if (d->negate) combined = QString::fromLatin1("NOT (%1)").arg(combined); return combined; } } return QString(); } qdjango-0.4.0/src/db/QDjangoWhere_p.h0000644000175000007640000000224712163016632017245 0ustar sharkyjerryweb/* * 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_P_H #define QDJANGO_WHERE_P_H // // W A R N I N G // ------------- // // This file is not part of the QDjango API. // #include #include "QDjangoWhere.h" class QDjangoWherePrivate : public QSharedData { public: enum Combine { NoCombine, AndCombine, OrCombine, }; QDjangoWherePrivate(); QString key; QDjangoWhere::Operation operation; QVariant data; QList children; Combine combine; bool negate; }; #endif qdjango-0.4.0/src/db/QDjangoModel.h0000644000175000007640000000673712163016632016724 0ustar sharkyjerryweb/* * 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_MODEL_H #define QDJANGO_MODEL_H #include #include #include "QDjango_p.h" /** \brief The QDjangoModel class is the base class for all models. * * To declare your own model, create a class which inherits QDjangoModel * and declare the database fields as properties using the Q_PROPERTY * macro. You must then register the class with QDjango using * QDjango::registerModel(). * * You can provide options for the model using the Q_CLASSINFO macro as * follows: * * \code * Q_CLASSINFO("__meta__", "keyword1=value1 .. keywordN=valueN") * \endcode * * The following keywords are recognised for model options: * * \li \c db_table if provided, this is the name of the database table for * the model, otherwise the lowercased class name will be used * \li \c unique_together set of fields that, taken together, must be unique. * If provided, a UNIQUE statement is included in the CREATE TABLE statement. * Example: \c unique_together=some_field,other_field * * You can also provide additional information about a field using the * Q_CLASSINFO macro, in the form: * * \code * Q_CLASSINFO("field_name", "keyword1=value1 .. keywordN=valueN") * \endcode * * The following keywords are recognised for field options: * * \li \c auto_increment if set to 'true', and if this field is the primary * key, it will be marked as auto-increment. * \li \c blank if set to 'true', this field is allowed to be empty. * \li \c db_column if provided, this is the name of the database column for * the field, otherwise the field name will be used * \li \c db_index if set to 'true', an index will be created on this field. * \li \c ignore_field if set to 'true', this field will be ignored * \li \c max_length the maximum length of the field (used when creating * the database table) * \li \c null if set to 'true', empty values will be stored as NULL. The * default value is 'false'. * \li \c primary_key if set to 'true', this field will be used as the primary * key. If no primary key is explicitly defined, an auto-increment integer * field will be added. * \li \c unique if set to 'true', this field must be unique throughout the * table. * \li \c on_delete if provided, create a foreign key constraint on this field. * Accepted values are: 'cascade', 'restrict', and 'set_null' * * \ingroup Database */ class QDJANGO_EXPORT QDjangoModel : public QObject { Q_OBJECT Q_PROPERTY(QVariant pk READ pk WRITE setPk) Q_CLASSINFO("pk", "ignore_field=true") public: QDjangoModel(QObject *parent = 0); QVariant pk() const; void setPk(const QVariant &pk); public slots: bool remove(); bool save(); QString toString() const; protected: QObject *foreignKey(const char *name) const; void setForeignKey(const char *name, QObject *value); }; #endif qdjango-0.4.0/src/db/QDjangoWhere.h0000644000175000007640000000614512163016632016727 0ustar sharkyjerryweb/* * 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 #include #include "QDjango_p.h" class QDjangoMetaModel; class QDjangoQuery; class QDjangoWherePrivate; /** \brief The QDjangoWhere class expresses an SQL constraint. * * The QDjangoWhere class is used to build SQL WHERE statements. In its * simplest form a QDjangoWhere expresses a constraint on a column value. * * QDjangoWhere instances can be negated using the "!" unary operator * or combined using the "&&" and "||" boolean operators. * * \ingroup Database */ class QDJANGO_EXPORT QDjangoWhere { public: /** A comparison operation on a database column value. */ enum Operation { /** No comparison, always returns true. */ None, /** Returns true if the column value is equal to the given value. */ Equals, /** Returns true if the column value is not equal to the given value. */ NotEquals, /** Returns true if the column value is greater than the given value. */ GreaterThan, /** Returns true if the column value is less than the given value. */ LessThan, /** Returns true if the column value is greater or equal to the given value. */ GreaterOrEquals, /** Returns true if the column value is less or equal to the given value. */ LessOrEquals, /** Returns true if the column value starts with the given value (strings only). */ StartsWith, /** Returns true if the column value ends with the given value (strings only). */ EndsWith, /** Returns true if the column value contains the given value (strings only). */ Contains, /** Returns true if the column value is one of the given values. */ IsIn, /** Returns true if the column value is null. */ 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 d; friend class QDjangoCompiler; }; #endif qdjango-0.4.0/src/db/QDjango_p.h0000644000175000007640000000317112163016632016247 0ustar sharkyjerryweb/* * 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_P_H #define QDJANGO_P_H #include #include #include #include #include #include #include #if defined(QDJANGO_SHARED) # if defined(QDJANGO_BUILD) # define QDJANGO_EXPORT Q_DECL_EXPORT # else # define QDJANGO_EXPORT Q_DECL_IMPORT # endif #else # define QDJANGO_EXPORT #endif /** \brief The QDjangoDatabase class represents a set of connections to a * database. * * \internal */ class QDjangoDatabase : public QObject { Q_OBJECT public: QDjangoDatabase(QObject *parent = 0); QSqlDatabase reference; QMutex mutex; QMap copies; qint64 connectionId; private slots: void threadFinished(); }; class QDJANGO_EXPORT QDjangoQuery : public QSqlQuery { public: QDjangoQuery(QSqlDatabase db); void addBindValue(const QVariant &val, QSql::ParamType paramType = QSql::In); bool exec(); bool exec(const QString &query); }; #endif qdjango-0.4.0/src/db/QDjangoQuerySet_p.h0000644000175000007640000000527612163016632017761 0ustar sharkyjerryweb/* * 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_QUERYSET_P_H #define QDJANGO_QUERYSET_P_H // // W A R N I N G // ------------- // // This file is not part of the QDjango API. // #include #include "QDjango_p.h" #include "QDjangoWhere.h" class QDjangoMetaModel; /** \internal */ class QDJANGO_EXPORT QDjangoCompiler { public: QDjangoCompiler(const char *modelName, const QSqlDatabase &db); QString fromSql(); QStringList fieldNames(bool recurse, QDjangoMetaModel *metaModel = 0, const QString &modelPath = QString()); QString orderLimitSql(const QStringList orderBy, int lowMark, int highMark); void resolve(QDjangoWhere &where); private: QString databaseColumn(const QString &name); QString referenceModel(const QString &modelPath, QDjangoMetaModel *metaModel); QSqlDriver *driver; QDjangoMetaModel baseModel; QMap > modelRefs; QMap fieldColumnCache; }; /** \internal */ class QDJANGO_EXPORT QDjangoQuerySetPrivate { public: QDjangoQuerySetPrivate(const char *modelName); void addFilter(const QDjangoWhere &where); QDjangoWhere resolvedWhere(const QSqlDatabase &db) const; bool sqlDelete(); bool sqlFetch(); bool sqlInsert(const QVariantMap &fields, QVariant *insertId = 0); bool sqlLoad(QObject *model, int index); int sqlUpdate(const QVariantMap &fields); QList sqlValues(const QStringList &fields); QList sqlValuesList(const QStringList &fields); // SQL queries QDjangoQuery countQuery() const; QDjangoQuery deleteQuery() const; QDjangoQuery insertQuery(const QVariantMap &fields) const; QDjangoQuery updateQuery(const QVariantMap &fields) const; // reference counter QAtomicInt counter; bool hasResults; int lowMark; int highMark; QDjangoWhere whereClause; QStringList orderBy; QList properties; bool selectRelated; private: Q_DISABLE_COPY(QDjangoQuerySetPrivate) QByteArray m_modelName; friend class QDjangoMetaModel; }; #endif qdjango-0.4.0/src/db/QDjango.cpp0000644000175000007640000001612712163016632016270 0ustar sharkyjerryweb/* * 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. */ #include #include #include #include #include #include #include #include #include "QDjango.h" static const char *connectionPrefix = "_qdjango_"; QMap globalMetaModels = QMap(); static QDjangoDatabase *globalDatabase = 0; static bool globalDebugEnabled = false; /// \cond QDjangoDatabase::QDjangoDatabase(QObject *parent) : QObject(parent), connectionId(0) { } void QDjangoDatabase::threadFinished() { QThread *thread = qobject_cast(sender()); if (!thread) return; // cleanup database connection for the thread QMutexLocker locker(&mutex); disconnect(thread, SIGNAL(finished()), this, SLOT(threadFinished())); const QString connectionName = copies.value(thread).connectionName(); copies.remove(thread); if (connectionName.startsWith(QLatin1String(connectionPrefix))) QSqlDatabase::removeDatabase(connectionName); } static void closeDatabase() { delete globalDatabase; } static void initDatabase(QSqlDatabase db) { if (db.driverName() == QLatin1String("QSQLITE")) { // enable foreign key constraint handling QDjangoQuery query(db); query.prepare("PRAGMA foreign_keys=on"); query.exec(); } } QDjangoQuery::QDjangoQuery(QSqlDatabase db) : QSqlQuery(db) { } void QDjangoQuery::addBindValue(const QVariant &val, QSql::ParamType paramType) { // this hack is required so that we do not store a mix of local // and UTC times if (val.type() == QVariant::DateTime) QSqlQuery::addBindValue(val.toDateTime().toLocalTime(), paramType); else QSqlQuery::addBindValue(val, paramType); } bool QDjangoQuery::exec() { if (globalDebugEnabled) { qDebug() << "SQL query" << lastQuery(); QMapIterator i(boundValues()); while (i.hasNext()) { i.next(); qDebug() << "SQL " << i.key().toLatin1().data() << "=" << i.value().toString().toLatin1().data(); } } if (!QSqlQuery::exec()) { if (globalDebugEnabled) qWarning() << "SQL error" << lastError(); return false; } return true; } bool QDjangoQuery::exec(const QString &query) { if (globalDebugEnabled) qDebug() << "SQL query" << query; if (!QSqlQuery::exec(query)) { if (globalDebugEnabled) qWarning() << "SQL error" << lastError(); return false; } return true; } /// \endcond /*! \mainpage QDjango is a simple yet powerful Object Relation Mapper (ORM) built on top of the Qt library. Where possible it tries to follow django's ORM API, hence its name. \sa QDjango \sa QDjangoModel \sa QDjangoWhere \sa QDjangoQuerySet */ /*! Returns the database used by QDjango. If you call this method from any thread but the application's main thread, a new connection to the database will be created. The connection will automatically be torn down once the thread finishes. \sa setDatabase() */ QSqlDatabase QDjango::database() { if (!globalDatabase) return QSqlDatabase(); // if we are in the main thread, return reference connection QThread *thread = QThread::currentThread(); if (thread == globalDatabase->thread()) return globalDatabase->reference; // if we have a connection for this thread, return it QMutexLocker locker(&globalDatabase->mutex); if (globalDatabase->copies.contains(thread)) return globalDatabase->copies[thread]; // create a new connection for this thread QObject::connect(thread, SIGNAL(finished()), globalDatabase, SLOT(threadFinished())); QSqlDatabase db = QSqlDatabase::cloneDatabase(globalDatabase->reference, QLatin1String(connectionPrefix) + QString::number(globalDatabase->connectionId++)); db.open(); initDatabase(db); globalDatabase->copies.insert(thread, db); return db; } /*! Sets the database used by QDjango. You must call this method from your application's main thread. \sa database() */ void QDjango::setDatabase(QSqlDatabase database) { if (database.driverName() != QLatin1String("QSQLITE") && database.driverName() != QLatin1String("QSQLITE2") && database.driverName() != QLatin1String("QMYSQL") && database.driverName() != QLatin1String("QPSQL")) { qWarning() << "Unsupported database driver" << database.driverName(); } if (!globalDatabase) { globalDatabase = new QDjangoDatabase(); qAddPostRoutine(closeDatabase); } initDatabase(database); globalDatabase->reference = database; } /*! Returns whether debugging information should be printed. \sa setDebugEnabled() */ bool QDjango::isDebugEnabled() { return globalDebugEnabled; } /*! Sets whether debugging information should be printed. \sa isDebugEnabled() */ void QDjango::setDebugEnabled(bool enabled) { globalDebugEnabled = enabled; } /*! Creates the database tables for all registered models. */ bool QDjango::createTables() { bool ret = true; foreach (const QByteArray &key, globalMetaModels.keys()) if (!globalMetaModels[key].createTable()) ret = false; return ret; } /*! Drops the database tables for all registered models. */ bool QDjango::dropTables() { bool ret = true; foreach (const QByteArray &key, globalMetaModels.keys()) if (!globalMetaModels[key].dropTable()) ret = false; return ret; } /*! Returns the QDjangoMetaModel with the given \a name. */ QDjangoMetaModel QDjango::metaModel(const char *name) { return globalMetaModels.value(name); } QDjangoMetaModel QDjango::registerModel(const QMetaObject *meta) { const QByteArray name = meta->className(); if (!globalMetaModels.contains(name)) globalMetaModels.insert(name, QDjangoMetaModel(meta)); return globalMetaModels[name]; } /*! Returns the empty SQL limit clause. */ QString QDjango::noLimitSql() { const QString driverName = QDjango::database().driverName(); if (driverName == QLatin1String("QSQLITE") || driverName == QLatin1String("QSQLITE2")) return QLatin1String(" LIMIT -1"); else if (driverName == QLatin1String("QMYSQL")) // 2^64 - 1, as recommended by the MySQL documentation return QLatin1String(" LIMIT 18446744073709551615"); else return QString(); } qdjango-0.4.0/src/db/db.pro0000644000175000007640000000100112163016632015331 0ustar sharkyjerrywebinclude(../../qdjango.pri) QT -= gui QT += sql TARGET = qdjango-db win32 { DESTDIR = $$OUT_PWD } HEADERS += \ QDjango.h \ QDjango_p.h \ QDjangoMetaModel.h \ QDjangoModel.h \ QDjangoQuerySet.h \ QDjangoQuerySet_p.h \ QDjangoWhere.h SOURCES += \ QDjango.cpp \ QDjangoMetaModel.cpp \ QDjangoModel.cpp \ QDjangoQuerySet.cpp \ QDjangoWhere.cpp # Installation include(../src.pri) headers.path = $$PREFIX/include/qdjango/db QMAKE_PKGCONFIG_INCDIR = $$headers.path qdjango-0.4.0/src/script/0000755000175000007640000000000012163016632015151 5ustar sharkyjerrywebqdjango-0.4.0/src/script/QDjangoScript_p.h0000644000175000007640000001050212163016632020347 0ustar sharkyjerryweb/* * 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_SCRIPT_P_H #define QDJANGO_SCRIPT_P_H // // W A R N I N G // ------------- // // This file is not part of the QDjango API. // QDJANGO_EXPORT QDjangoWhere QDjangoWhereFromScriptValue(QScriptEngine *engine, const QScriptValue &obj); template static QScriptValue QDjangoQuerySet_all(QScriptContext *context, QScriptEngine *engine) { QDjangoQuerySet qs = engine->fromScriptValue< QDjangoQuerySet >(context->thisObject()); return engine->toScriptValue(qs.all()); } template static QScriptValue QDjangoQuerySet_at(QScriptContext *context, QScriptEngine *engine) { QDjangoQuerySet qs = engine->fromScriptValue< QDjangoQuerySet >(context->thisObject()); //QDjangoQuerySet qs = context->thisObject().toVariant().value< QDjangoQuerySet >(); int index = context->argument(0).toInteger(); return engine->newQObject(qs.at(index), QScriptEngine::ScriptOwnership); } template static QScriptValue QDjangoQuerySet_count(QScriptContext *context, QScriptEngine *engine) { QDjangoQuerySet qs = engine->fromScriptValue< QDjangoQuerySet >(context->thisObject()); return QScriptValue(engine, qs.count()); } template static QScriptValue QDjangoQuerySet_exclude(QScriptContext *context, QScriptEngine *engine) { QDjangoQuerySet qs = engine->fromScriptValue< QDjangoQuerySet >(context->thisObject()); QDjangoWhere where = QDjangoWhereFromScriptValue(engine, context->argument(0)); return engine->toScriptValue(qs.exclude(where)); } template static QScriptValue QDjangoQuerySet_filter(QScriptContext *context, QScriptEngine *engine) { QDjangoQuerySet qs = engine->fromScriptValue< QDjangoQuerySet >(context->thisObject()); QDjangoWhere where = QDjangoWhereFromScriptValue(engine, context->argument(0)); return engine->toScriptValue(qs.filter(where)); } template static QScriptValue QDjangoQuerySet_get(QScriptContext *context, QScriptEngine *engine) { QDjangoQuerySet qs = engine->fromScriptValue< QDjangoQuerySet >(context->thisObject()); QDjangoWhere where = QDjangoWhereFromScriptValue(engine, context->argument(0)); return engine->newQObject(qs.get(where), QScriptEngine::ScriptOwnership); } template static QScriptValue QDjangoQuerySet_limit(QScriptContext *context, QScriptEngine *engine) { QDjangoQuerySet qs = engine->fromScriptValue< QDjangoQuerySet >(context->thisObject()); const int pos = context->argument(0).toInteger(); const int limit = (context->argumentCount() > 1) ? context->argument(1).toInteger() : 1; return engine->toScriptValue(qs.limit(pos, limit)); } template static QScriptValue QDjangoQuerySet_remove(QScriptContext *context, QScriptEngine *engine) { QDjangoQuerySet qs = engine->fromScriptValue< QDjangoQuerySet >(context->thisObject()); return QScriptValue(engine, qs.remove()); } template static QScriptValue QDjangoQuerySet_size(QScriptContext *context, QScriptEngine *engine) { QDjangoQuerySet qs = engine->fromScriptValue< QDjangoQuerySet >(context->thisObject()); return QScriptValue(engine, qs.size()); } template static QScriptValue QDjangoQuerySet_toString(QScriptContext *context, QScriptEngine *engine) { QDjangoQuerySet qs = engine->fromScriptValue< QDjangoQuerySet >(context->thisObject()); return QScriptValue(engine, QString("QuerySet<%1>(%2)").arg(T::staticMetaObject.className(), qs.where().sql(QDjango::database()))); } template static QScriptValue QDjangoModel_new(QScriptContext *context, QScriptEngine *engine) { Q_UNUSED(context); return engine->newQObject(new T, QScriptEngine::ScriptOwnership); } #endif qdjango-0.4.0/src/script/QDjangoScript.h0000644000175000007640000000524412163016632020037 0ustar sharkyjerryweb/* * 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_SCRIPT_H #define QDJANGO_SCRIPT_H #include #include #include "QDjango.h" #include "QDjangoQuerySet.h" #include "QDjangoScript_p.h" Q_DECLARE_METATYPE(QDjangoWhere) /** \defgroup Script */ /** \brief The QDjangoScript class provides static methods for making models * scriptable. * * \ingroup Script */ class QDJANGO_EXPORT QDjangoScript { public: template static void registerModel(QScriptEngine *engine); static void registerWhere(QScriptEngine *engine); }; /** Makes a QDjangoModel class available to the given QScriptEngine. * * \param engine */ template void QDjangoScript::registerModel(QScriptEngine *engine) { QDjango::registerModel(); QScriptValue querysetProto = engine->newObject(); querysetProto.setProperty("all", engine->newFunction(QDjangoQuerySet_all)); querysetProto.setProperty("at", engine->newFunction(QDjangoQuerySet_at)); querysetProto.setProperty("count", engine->newFunction(QDjangoQuerySet_count)); querysetProto.setProperty("exclude", engine->newFunction(QDjangoQuerySet_exclude)); querysetProto.setProperty("filter", engine->newFunction(QDjangoQuerySet_filter)); querysetProto.setProperty("get", engine->newFunction(QDjangoQuerySet_get)); querysetProto.setProperty("limit", engine->newFunction(QDjangoQuerySet_limit)); querysetProto.setProperty("remove", engine->newFunction(QDjangoQuerySet_remove)); querysetProto.setProperty("size", engine->newFunction(QDjangoQuerySet_size)); querysetProto.setProperty("toString", engine->newFunction(QDjangoQuerySet_toString)); engine->setDefaultPrototype(qMetaTypeId< QDjangoQuerySet >(), querysetProto); QDjangoQuerySet qs; QScriptValue value = engine->newQMetaObject(&T::staticMetaObject, engine->newFunction(QDjangoModel_new)); value.setProperty("objects", engine->toScriptValue(qs)); engine->globalObject().setProperty(T::staticMetaObject.className(), value); } #endif qdjango-0.4.0/src/script/QDjangoScript.cpp0000644000175000007640000001030612163016632020365 0ustar sharkyjerryweb/* * 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. */ #include #include #include #include #include "QDjangoScript.h" #include "QDjangoWhere.h" QDjangoWhere QDjangoWhereFromScriptValue(QScriptEngine *engine, const QScriptValue &obj) { if (obj.prototype().equals(engine->defaultPrototype(qMetaTypeId()))) { return engine->fromScriptValue(obj); } QDjangoWhere where; QScriptValueIterator it(obj); while (it.hasNext()) { it.next(); QString key = it.name(); QDjangoWhere::Operation op = QDjangoWhere::Equals; if (key.endsWith(QLatin1String("__lt"))) { key.chop(4); op = QDjangoWhere::LessThan; } else if (key.endsWith(QLatin1String("__lte"))) { key.chop(5); op = QDjangoWhere::LessOrEquals; } else if (key.endsWith(QLatin1String("__gt"))) { key.chop(4); op = QDjangoWhere::GreaterThan; } else if (key.endsWith(QLatin1String("__gte"))) { key.chop(5); op = QDjangoWhere::GreaterOrEquals; } else if (key.endsWith(QLatin1String("__startswith"))) { key.chop(12); op = QDjangoWhere::StartsWith; } else if (key.endsWith(QLatin1String("__endswith"))) { key.chop(10); op = QDjangoWhere::EndsWith; } else if (key.endsWith(QLatin1String("__contains"))) { key.chop(10); op = QDjangoWhere::Contains; } else if (key.endsWith(QLatin1String("__in"))) { key.chop(4); op = QDjangoWhere::IsIn; } where = where && QDjangoWhere(key, op, it.value().toVariant()); } return where; } static QScriptValue newWhere(QScriptContext *context, QScriptEngine *engine) { QDjangoWhere where; if (context->argumentCount() == 1 && context->argument(0).isObject()) { where = QDjangoWhereFromScriptValue(engine, context->argument(0)); } return engine->toScriptValue(where); } static QScriptValue whereAnd(QScriptContext *context, QScriptEngine *engine) { QDjangoWhere q = engine->fromScriptValue(context->thisObject()); QDjangoWhere other = QDjangoWhereFromScriptValue(engine, context->argument(0)); return engine->toScriptValue(q && other); } static QScriptValue whereOr(QScriptContext *context, QScriptEngine *engine) { QDjangoWhere q = engine->fromScriptValue(context->thisObject()); QDjangoWhere other = QDjangoWhereFromScriptValue(engine, context->argument(0)); return engine->toScriptValue(q || other); } static QScriptValue whereToString(QScriptContext *context, QScriptEngine *engine) { QDjangoWhere q = engine->fromScriptValue(context->thisObject()); return engine->toScriptValue(QLatin1String("Q(") + q.sql(QDjango::database()) + QLatin1String(")")); } /** Makes the QDjangoWhere class available to the given QScriptEngine. * * \param engine */ void QDjangoScript::registerWhere(QScriptEngine *engine) { QScriptValue whereProto = engine->newObject(); whereProto.setProperty(QLatin1String("and"), engine->newFunction(whereAnd)); whereProto.setProperty(QLatin1String("or"), engine->newFunction(whereOr)); whereProto.setProperty(QLatin1String("toString"), engine->newFunction(whereToString)); engine->setDefaultPrototype(qMetaTypeId(), whereProto); QScriptValue ctor = engine->newFunction(newWhere); engine->globalObject().setProperty(QLatin1String("Q"), ctor, QScriptValue::ReadOnly); } qdjango-0.4.0/src/script/script.pro0000644000175000007640000000055712163016632017206 0ustar sharkyjerrywebinclude(../../qdjango.pri) QT -= gui QT += script sql TARGET = qdjango-script win32 { DESTDIR = $$OUT_PWD } INCLUDEPATH += ../db LIBS += -L../db $$QDJANGO_DB_LIBS HEADERS += QDjangoScript.h QDjangoScript_p.h SOURCES += QDjangoScript.cpp # Installation include(../src.pri) headers.path = $$PREFIX/include/qdjango/script QMAKE_PKGCONFIG_INCDIR = $$headers.path qdjango-0.4.0/doc/0000755000175000007640000000000012163016767013634 5ustar sharkyjerrywebqdjango-0.4.0/doc/database.doc0000644000175000007640000000360612163016632016063 0ustar sharkyjerryweb/* * 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. */ /*! \page database Database configuration QDjango relies on the QtSql module for database access, which supports a wide array of database drivers. \section setup Setting the database The first step is to open the database using QSqlDatabase::addDatabase(), for instance for an in-memory SQLite database: \code QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName(":memory:"); db.open(); \endcode You should now tell QDjango to use the database you just opened: \code QDjango::setDatabase(db); \endcode \section creating Creating or dropping database tables Once you have set the database and declared all your models (see \ref models), you can ask QDjango to create the database tables for all models: \code QDjango::createTables(); \endcode Conversely, you can ask QDjango to drop the database tables for all models: \code QDjango::dropTables(); \endcode \section threading Threading support Internally, QDjango calls the QDjango::database() method whenever it needs a handle to the database. This method will clone the database connection as needed if it is invoked from a different thread. */ qdjango-0.4.0/doc/models.doc0000644000175000007640000000734212163016632015603 0ustar sharkyjerryweb/* * 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. */ /*! \page models Database models Database models are usually created by subclassing the QDjangoModel class. The following example defines a \c User model suitable for storing basic account information, and illustrate different types of queries on this model. \section declaring Declaring your model To declare your model, subclass the QDjangoModel class, and define a property using the Q_PROPERTY macro for each database field. You can provide additional information about a field using the Q_CLASSINFO macro: \li \c max_length : the maximum length of the field (used when creating the database table) \li \c primary_key : if set to 'true', this field will be used as the primary key. If no primary key is explicitly defined, an auto-increment integer field will be added. \code #include "QDjangoModel.h" class User : public QDjangoModel { Q_OBJECT Q_PROPERTY(QString username READ username WRITE setUsername) Q_PROPERTY(QString password READ password WRITE setPassword) Q_CLASSINFO("username", "max_length=255") Q_CLASSINFO("password", "max_length=128") public: QString username() const; void setUsername(const QString &username); QString password() const; void setPassword(const QString &password); private: QString m_username; QString m_password; }; \endcode \section implementing Implementing your model \code QString User::username() const { return m_username; } void User::setUsername(const QString &username) { m_username = username; } QString User::password() const { return m_password; } void User::setPassword(const QString &password) { m_password = password; } \endcode \section registering Registering and using your model To make your model available for database operations, you should now register your model using: \code QDjango::registerModel(); \endcode Once you have set the database (see \ref database), you will now be able to create model instances and save them to the database: \code User *user = new User; user->setUsername("someuser"); user->setPassword("somepassword"); user->save(); \endcode .. or remove them from the database: \code user->remove(); \endcode You can also perform operations such as filtering or retrieving model instances as described in \ref queries. \section qobject Using QDjango without QDjangoModel Although it is recommended you make your models inherit QDjangoModel, it is not strictly necessary. QDjango can in fact handle any QObject-derived class, but you will lose some of the syntactic sugar. If for instance you defined a \c SomeObject class which inherits QObject, you can write: \code QDjangoMetaModel meta = QDjango::registerModel(); // prepare a SomeObject instance SomeObject *obj = new SomeObject; obj->setSomeProperty("some value"); obj->setOtherProperty("other value"); // save the object meta.save(obj); // remove the object from database meta.remove(obj); \endcode */ qdjango-0.4.0/doc/Doxyfile0000644000175000007640000017773112163016632015351 0ustar sharkyjerryweb# Doxyfile 1.6.3 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = QDjango # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = NO # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = YES # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it parses. # With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this tag. # The format is ext=language, where ext is a file extension, and language is one of # the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, # Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat # .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penality. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will rougly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = NO # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = NO # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by # doxygen. The layout file controls the global structure of the generated output files # in an output format independent way. The create the layout file that represents # doxygen's defaults, run doxygen with the -l option. You can optionally specify a # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = database.doc models.doc queries.doc scripting.doc ../src/db ../src/http ../src/script # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = */moc_* *_p.h # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = YES # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER # are set, an additional index file will be generated that can be used as input for # Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated # HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. # For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's # filter section matches. # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list. USE_INLINE_TREES = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # When the SEARCHENGINE tag is enabled doxygen will generate a search box for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be implemented using a PHP enabled web server instead of at the web client using Javascript. Doxygen will generate the search PHP script and index # file to put on the web server. The advantage of the server based approach is that it scales better to large projects and allows full text search. The disadvances is that it is more difficult to setup # and does not have live searching capabilities. SERVER_BASED_SEARCH = NO #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # By default doxygen will write a font called FreeSans.ttf to the output # directory and reference it in all dot files that doxygen generates. This # font does not include all possible unicode characters however, so when you need # these (or just want a differently looking font) you can specify the font name # using DOT_FONTNAME. You need need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES qdjango-0.4.0/doc/queries.doc0000644000175000007640000000753512163016632016001 0ustar sharkyjerryweb/* * 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. */ /*! \page queries Making queries The QDjango object relational mapper (ORM) supports the concept of querysets, borrowed from django's ORM. A queryset is a collection of database objects which match a certain number of user-specified conditions. You can learn more about querysets by reading the QDjangoQuerySet template class documentation. \section creating-queries Creating and filtering querysets Before you can start using querysets, you need to declare your database models as described in \ref models. The most basic queryset matches all the objects for a given model. \code // all users QDjangoQuerySet users; \endcode You can use the QDjangoQuerySet::filter() and QDjangoQuerySet::exclude() methods to add filtering conditions to a querset: \code // find all users whose password is "foo" and whose username is not "bar" QDjangoQuerySet someUsers; someUsers = users.filter(QDjangoWhere("password", QDjangoWhere::Equals, "foo") && QDjangoWhere("username", QDjangoWhere::NotEquals, "bar")); // find all users whose username is "foo" or "bar" someUsers = users.filter(QDjangoWhere("username", QDjangoWhere::Equals, "foo") || QDjangoWhere("username", QDjangoWhere::Equals, "bar")); // find all users whose username starts with "f": someUsers = users.filter(QDjangoWhere("username", QDjangoWhere::StartsWith, "f")); \endcode You can also use the QDjangoQuerySet::limit() method to limit the number of returned rows: \code // limit number of results someUsers = users.limit(0, 100); \endcode \section iterating-queries Iterating over results The easiest way to iterate over results is to use Qt's foreach keyword: \code // iterate over matching users foreach (const User &user, someUsers) { qDebug() << "found user" << user.username; } \endcode Another way of iterating over results is to run over model instances using the QDjangoQuerySet::size() and QDjangoQuerySet::at() methods: \code // iterate over matching users User user; for (int i = 0; i < someUsers.size(); ++i) { if (someUsers.at(i, &user)) { qDebug() << "found user" << user.username; } } \endcode It is also possible to retrieve field data without creating model instances using the QDjangoQuerySet::values() and QDjangoQuerySet::valuesList() methods: \code // retrieve usernames and passwords for matching users as maps QList propertyMaps = someUsers.values(QStringList() << "username" << "password"); foreach (const QVariantMap &propertyMap, propertyMaps) { qDebug() << "username" << propertyList["username"]; qDebug() << "password" << propertyList["password"]; } // retrieve usernames and passwords for matching users as lists QList propertyLists = someUsers.valuesList(QStringList() << "username" << "password"); foreach (const QVariantList &propertyList, propertyLists) { qDebug() << "username" << propertyList[0]; qDebug() << "password" << propertyList[1]; } \endcode \section other-queries Other operations \code // count matching users without retrieving their data int numberOfUsers = someUsers.count(); // delete all the users in the queryset someUsers.remove(); \endcode */ qdjango-0.4.0/doc/scripting.doc0000644000175000007640000000416712163016632016324 0ustar sharkyjerryweb/* * 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. */ /*! \page scripting Scripting models The QDjangoScript class makes it easy to access your models from QtScript. \section making-scriptable Making your models scriptable You can register a model with a QScriptEngine instance as follows: \code #include #include Q_DECLARE_METATYPE(QDjangoQuerySet) QScriptEngine *engine = new QScriptEngine; QDjangoScript::registerWhere(engine); QDjangoScript::registerModel(engine); \endcode \section scripting-models Using your models from a script Because QDjango makes use of Qt's property system, all model fields can automatically be accessed from QtScript. For instance if you declared a \c User model, you can run the following code: \code // create a user instance and save it to database user = new User(); user.username = "someuser"; user.password = "somepassword"; user.save(); // remove the user from database user.remove(); \endcode You can also perform database queries: \code // filter users whose username is "foouser" and password is "foopass" qs = User.objects.filter({'username': 'foouser', 'password': 'foopass'}); // iterate over the results for (var i = 0; i < qs.size(); i++) { user = qs.at(i); print("found " + user.username); } // remove all matching users from database qs.remove(); \endcode */ qdjango-0.4.0/doc/html/0000755000175000007640000000000012163016767014600 5ustar sharkyjerrywebqdjango-0.4.0/doc/html/QDjangoHttpRequest_8h_source.html0000644000175000007640000003264312163016767023211 0ustar sharkyjerryweb QDjango: QDjangoHttpRequest.h Source File
QDjangoHttpRequest.h
1 /*
2  * Copyright (C) 2010-2012 Jeremy Lainé
3  * Contact: http://code.google.com/p/qdjango/
4  *
5  * This file is part of the QDjango Library.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  */
17 
18 #ifndef QDJANGO_HTTP_REQUEST_H
19 #define QDJANGO_HTTP_REQUEST_H
20 
21 #include <QString>
22 
23 #include "QDjangoHttp_p.h"
24 
25 class QDjangoHttpRequestPrivate;
26 
37 class QDJANGO_EXPORT QDjangoHttpRequest
38 {
39 public:
42 
43  QByteArray body() const;
44  QString get(const QString &key) const;
45  QString meta(const QString &key) const;
46  QString method() const;
47  QString path() const;
48  QString post(const QString &key) const;
49 
50 private:
51  Q_DISABLE_COPY(QDjangoHttpRequest)
52  QDjangoHttpRequestPrivate* const d;
53  friend class QDjangoFastCgiConnection;
54  friend class QDjangoHttpConnection;
55  friend class QDjangoHttpTestRequest;
56 };
57 
60 class QDJANGO_EXPORT QDjangoHttpTestRequest : public QDjangoHttpRequest
61 {
62 public:
63  QDjangoHttpTestRequest(const QString &method, const QString &path);
64 
65 private:
66  Q_DISABLE_COPY(QDjangoHttpTestRequest)
67 };
68 
71 #endif
qdjango-0.4.0/doc/html/ftv2mlastnode.png0000644000175000007640000000036612163016767020103 0ustar sharkyjerrywebPNG  IHDRɪ|IDATx!NA\ Um@`5i`h W7] b&ofdY4 c 3v=]\B I=BB;k WN@vy4]Y|M}]x6a }dׇY>||5?>|B"'IENDB`qdjango-0.4.0/doc/html/nav_f.png0000644000175000007640000000023112163016767016373 0ustar sharkyjerrywebPNG  IHDR8`IDATxK Eі[BmkHprӼ.ꎤR6Z VIE5jliIJ0/u޿6sH yIENDB`qdjango-0.4.0/doc/html/ftv2plastnode.png0000644000175000007640000000034512163016767020103 0ustar sharkyjerrywebPNG  IHDRɪ|IDATx=QFDk:FPK؃=V@ճ 8SHx0bnrr{򽿾$ TP XOd6"SOB(Q)+YĈ ҪR>Vtsm9(k-@ȧ-$ b [he Kp-l|CApRG'rͭaIENDB`qdjango-0.4.0/doc/html/modules.html0000644000175000007640000001252012163016767017136 0ustar sharkyjerryweb QDjango: Modules
QDjango
Modules
Here is a list of all modules:
qdjango-0.4.0/doc/html/classQDjangoQuerySet.html0000644000175000007640000013500612163016767021546 0ustar sharkyjerryweb QDjango: QDjangoQuerySet< T > Class Template Reference
QDjangoQuerySet< T > Class Template Reference

The QDjangoQuerySet class is a template class for performing database queries. More...

#include <QDjangoQuerySet.h>

Classes

class  const_iterator
 

Public Types

typedef const_iterator ConstIterator
 

Public Member Functions

 QDjangoQuerySet ()
 
 QDjangoQuerySet (const QDjangoQuerySet< T > &other)
 
 ~QDjangoQuerySet ()
 
QDjangoQuerySet all () const
 
QDjangoQuerySet exclude (const QDjangoWhere &where) const
 
QDjangoQuerySet filter (const QDjangoWhere &where) const
 
QDjangoQuerySet limit (int pos, int length=-1) const
 
QDjangoQuerySet none () const
 
QDjangoQuerySet orderBy (const QStringList &keys) const
 
QDjangoQuerySet selectRelated () const
 
int count () const
 
QDjangoWhere where () const
 
bool remove ()
 
int size ()
 
int update (const QVariantMap &fields)
 
QList< QVariantMap > values (const QStringList &fields=QStringList())
 
QList< QVariantList > valuesList (const QStringList &fields=QStringList())
 
T * get (const QDjangoWhere &where, T *target=0) const
 
T * at (int index, T *target=0)
 
const_iterator constBegin () const
 
const_iterator begin () const
 
const_iterator constEnd () const
 
const_iterator end () const
 
QDjangoQuerySet< T > & operator= (const QDjangoQuerySet< T > &other)
 

Detailed Description

template<class T>
class QDjangoQuerySet< T >

The QDjangoQuerySet class is a template class for performing database queries.

The QDjangoQuerySet template class allows you to define and manipulate sets of QDjangoModel objects stored in the database.

You can chain filter expressions using the filter() and exclude() methods or apply limits on the number of rows using the limit() method.

You can retrieve database values using the values() and valuesList() methods or retrieve model instances using the get() and at() methods.

You can also delete sets of objects using the remove() method.

Behinds the scenes, the QDjangoQuerySet class uses implicit sharing to reduce memory usage and avoid needless copying of data.

Member Typedef Documentation

template<class T>
typedef const_iterator QDjangoQuerySet< T >::ConstIterator

Qt-style synonym for QDjangoQuerySet::const_iterator.

Constructor & Destructor Documentation

template<class T >
QDjangoQuerySet< T >::QDjangoQuerySet ( )

Constructs a new queryset.

template<class T >
QDjangoQuerySet< T >::QDjangoQuerySet ( const QDjangoQuerySet< T > &  other)

Constructs a copy of other.

Parameters
other
template<class T >
QDjangoQuerySet< T >::~QDjangoQuerySet ( )

Destroys the queryset.

Member Function Documentation

template<class T >
QDjangoQuerySet< T > QDjangoQuerySet< T >::all ( ) const

Returns a copy of the current QDjangoQuerySet.

template<class T >
T * QDjangoQuerySet< T >::at ( int  index,
T *  target = 0 
)

Returns the object in the QDjangoQuerySet at the given index.

Returns 0 if the index is out of bounds.

If target is 0, a new object instance will be allocated which you must free yourself.

Parameters
index
targetoptional existing model instance.
template<class T >
QDjangoQuerySet< T >::const_iterator QDjangoQuerySet< T >::begin ( ) const

Returns a const STL-style iterator pointing to the first object in the QDjangoQuerySet.

See Also
constBegin() and end().
template<class T >
QDjangoQuerySet< T >::const_iterator QDjangoQuerySet< T >::constBegin ( ) const

Returns a const STL-style iterator pointing to the first object in the QDjangoQuerySet.

See Also
begin() and constEnd().
template<class T >
QDjangoQuerySet< T >::const_iterator QDjangoQuerySet< T >::constEnd ( ) const

Returns a const STL-style iterator pointing to the imaginary object after the last object in the QDjangoQuerySet.

See Also
constBegin() and end().
template<class T >
int QDjangoQuerySet< T >::count ( ) const

Counts the number of objects in the queryset using an SQL COUNT query, or -1 if the query failed.

If you intend to iterate over the results, you should consider using size() instead.

Note
If the QDjangoQuerySet is already fully fetched, this simply returns the number of objects.
template<class T >
QDjangoQuerySet< T >::const_iterator QDjangoQuerySet< T >::end ( ) const

Returns a const STL-style iterator pointing to the imaginary object after the last object in the QDjangoQuerySet.

See Also
begin() and constEnd().
template<class T >
QDjangoQuerySet< T > QDjangoQuerySet< T >::exclude ( const QDjangoWhere where) const

Returns a new QDjangoQuerySet containing objects for which the given key where condition is false.

You can chain calls to filter() and exclude() to further refine the filtering conditions.

Parameters
whereQDjangoWhere expressing the exclude condition
See Also
filter()
template<class T >
QDjangoQuerySet< T > QDjangoQuerySet< T >::filter ( const QDjangoWhere where) const

Returns a new QDjangoQuerySet containing objects for which the given where condition is true.

You can chain calls to filter() and exclude() to progressively refine your filtering conditions.

Parameters
whereQDjangoWhere expressing the filter condition
See Also
exclude()
template<class T >
T * QDjangoQuerySet< T >::get ( const QDjangoWhere where,
T *  target = 0 
) const

Returns the object in the QDjangoQuerySet for which the given where condition is true.

Returns 0 if the number of matching object is not exactly one.

If target is 0, a new object instance will be allocated which you must free yourself.

Parameters
whereQDjangoWhere expressing the lookup condition
targetoptional existing model instance.
template<class T >
QDjangoQuerySet< T > QDjangoQuerySet< T >::limit ( int  pos,
int  length = -1 
) const

Returns a new QDjangoQuerySet containing limiting the number of records to manipulate.

You can chain calls to limit() to further restrict the number of returned records.

However, you cannot apply additional restrictions using filter(), exclude(), get(), orderBy() or remove() on the returned QDjangoQuerySet.

Parameters
posoffset of the records
lengthmaximum number of records
template<class T >
QDjangoQuerySet< T > QDjangoQuerySet< T >::none ( ) const

Returns an empty QDjangoQuerySet.

template<class T >
QDjangoQuerySet< T > & QDjangoQuerySet< T >::operator= ( const QDjangoQuerySet< T > &  other)

Assigns the specified queryset to this object.

Parameters
other
template<class T >
QDjangoQuerySet< T > QDjangoQuerySet< T >::orderBy ( const QStringList &  keys) const

Returns a QDjangoQuerySet whose elements are ordered using the given keys.

By default the elements will by in ascending order. You can prefix the key names with a "-" (minus sign) to use descending order.

Parameters
keys
template<class T >
bool QDjangoQuerySet< T >::remove ( )

Deletes all objects in the QDjangoQuerySet.

Returns
true if deletion succeeded, false otherwise
template<class T >
QDjangoQuerySet< T > QDjangoQuerySet< T >::selectRelated ( ) const

Returns a QDjangoQuerySet that will automatically "follow" foreign-key relationships, selecting that additional related-object data when it executes its query.

template<class T >
int QDjangoQuerySet< T >::size ( )

Returns the number of objects in the QDjangoQuerySet, or -1 if the query failed.

If you do not plan to access the objects, you should consider using count() instead.

template<class T >
int QDjangoQuerySet< T >::update ( const QVariantMap &  fields)

Performs an SQL update query for the specified fields and returns the number of rows affected, or -1 if the update failed.

template<class T >
QList< QVariantMap > QDjangoQuerySet< T >::values ( const QStringList &  fields = QStringList())

Returns a list of property hashes for the current QDjangoQuerySet. If no fields are specified, all the model's declared fields are returned.

Parameters
fields
template<class T >
QList< QVariantList > QDjangoQuerySet< T >::valuesList ( const QStringList &  fields = QStringList())

Returns a list of property lists for the current QDjangoQuerySet. If no fields are specified, all the model's fields are returned in the order they where declared.

Parameters
fields
template<class T >
QDjangoWhere QDjangoQuerySet< T >::where ( ) const

Returns the QDjangoWhere expressing the WHERE clause of the QDjangoQuerySet.


The documentation for this class was generated from the following file:
qdjango-0.4.0/doc/html/QDjangoScript_8h_source.html0000644000175000007640000003610712163016767022164 0ustar sharkyjerryweb QDjango: QDjangoScript.h Source File
QDjangoScript.h
1 /*
2  * Copyright (C) 2010-2012 Jeremy Lainé
3  * Contact: http://code.google.com/p/qdjango/
4  *
5  * This file is part of the QDjango Library.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  */
17 
18 #ifndef QDJANGO_SCRIPT_H
19 #define QDJANGO_SCRIPT_H
20 
21 #include <QtScript/QScriptValue>
22 #include <QtScript/QScriptEngine>
23 
24 #include "QDjango.h"
25 #include "QDjangoQuerySet.h"
26 #include "QDjangoScript_p.h"
27 
28 Q_DECLARE_METATYPE(QDjangoWhere)
29 
30 
37 class QDJANGO_EXPORT QDjangoScript
38 {
39 public:
40  template <class T>
41  static void registerModel(QScriptEngine *engine);
42  static void registerWhere(QScriptEngine *engine);
43 };
44 
49 template <class T>
50 void QDjangoScript::registerModel(QScriptEngine *engine)
51 {
52  QDjango::registerModel<T>();
53 
54  QScriptValue querysetProto = engine->newObject();
55  querysetProto.setProperty("all", engine->newFunction(QDjangoQuerySet_all<T>));
56  querysetProto.setProperty("at", engine->newFunction(QDjangoQuerySet_at<T>));
57  querysetProto.setProperty("count", engine->newFunction(QDjangoQuerySet_count<T>));
58  querysetProto.setProperty("exclude", engine->newFunction(QDjangoQuerySet_exclude<T>));
59  querysetProto.setProperty("filter", engine->newFunction(QDjangoQuerySet_filter<T>));
60  querysetProto.setProperty("get", engine->newFunction(QDjangoQuerySet_get<T>));
61  querysetProto.setProperty("limit", engine->newFunction(QDjangoQuerySet_limit<T>));
62  querysetProto.setProperty("remove", engine->newFunction(QDjangoQuerySet_remove<T>));
63  querysetProto.setProperty("size", engine->newFunction(QDjangoQuerySet_size<T>));
64  querysetProto.setProperty("toString", engine->newFunction(QDjangoQuerySet_toString<T>));
65  engine->setDefaultPrototype(qMetaTypeId< QDjangoQuerySet<T> >(), querysetProto);
66 
68  QScriptValue value = engine->newQMetaObject(&T::staticMetaObject, engine->newFunction(QDjangoModel_new<T>));
69  value.setProperty("objects", engine->toScriptValue(qs));
70  engine->globalObject().setProperty(T::staticMetaObject.className(), value);
71 }
72 
73 #endif
qdjango-0.4.0/doc/html/scripting.html0000644000175000007640000002022312163016767017467 0ustar sharkyjerryweb QDjango: Scripting models
Scripting models

The QDjangoScript class makes it easy to access your models from QtScript.

Making your models scriptable

You can register a model with a QScriptEngine instance as follows:

#include <QDjangoQuerySet.h>
#include <QDjangoScript.h>
Q_DECLARE_METATYPE(QDjangoQuerySet<User>)
QScriptEngine *engine = new QScriptEngine;
QDjangoScript::registerWhere(engine);
QDjangoScript::registerModel<User>(engine);

Using your models from a script

Because QDjango makes use of Qt's property system, all model fields can automatically be accessed from QtScript. For instance if you declared a User model, you can run the following code:

// create a user instance and save it to database
user = new User();
user.username = "someuser";
user.password = "somepassword";
user.save();
// remove the user from database
user.remove();

You can also perform database queries:

// filter users whose username is "foouser" and password is "foopass"
qs = User.objects.filter({'username': 'foouser', 'password': 'foopass'});
// iterate over the results
for (var i = 0; i < qs.size(); i++) {
user = qs.at(i);
print("found " + user.username);
}
// remove all matching users from database
qs.remove();
qdjango-0.4.0/doc/html/tab_b.png0000644000175000007640000000025112163016767016353 0ustar sharkyjerrywebPNG  IHDR$[pIDATxM EǻԸu`V0}:t]Ds䮂u|x>1&m8SxLU޲iEOsnxKN~jIENDB`qdjango-0.4.0/doc/html/classQDjangoHttpResponse.png0000644000175000007640000000107412163016767022240 0ustar sharkyjerrywebPNG  IHDRP>v!PLTEutRNST2IDATxђ EO^zwU0ֶL'3@i 3A$iE<"IL;Jٷ[/ī]rOs~fRǖ?I:=.[jtpyy˲2m~^ KSG/TYeMSVI:ǝ@?-Ip$`.ffc<AGf _adFr:h.p '\< Ox.p ]p pwZXK@\eY\'lӟ8p9mK~sL?sRV5ِ[qKy-%Eh17}ub%>p2D9kevKy.Ti'V zF\nnQ+-ZK[5z5jfOwљrR.yx' ofq~PTt^;IENDB`qdjango-0.4.0/doc/html/classQDjangoFastCgiServer.png0000644000175000007640000000113112163016767022303 0ustar sharkyjerrywebPNG  IHDRPp >PLTEutRNST2IDATxѲ EW^oA19 "$L$i%$EJ IЫ֕>7 PCgF~Ԣ[K5tMw2?$n[֜<5+i#$gg-`*[G%=o0$EJ I4#DE41l@O*@ RDJ H )"%@@ RD@ff3 G )"9%ŷ[~B?4 0P W`N \5cmƺ笲n\ک& oW/^ZwMFkYq3Fjp1l^ ۖas96:DhÖE@qF>*!\!%`:G5>7qVe狲q'\ݡԧ E}|| և ^\=[%@&?[W4IENDB`qdjango-0.4.0/doc/html/classQDjangoUrlResolver.html0000644000175000007640000003424312163016767022252 0ustar sharkyjerryweb QDjango: QDjangoUrlResolver Class Reference
QDjangoUrlResolver Class Reference

The QDjangoUrlResolver class maps incoming HTTP requests to handlers. More...

#include <QDjangoUrlResolver.h>

Inheritance diagram for QDjangoUrlResolver:

Public Slots

QDjangoHttpResponserespond (const QDjangoHttpRequest &request, const QString &path) const
 

Public Member Functions

 QDjangoUrlResolver (QObject *parent=0)
 
bool include (const QRegExp &path, QDjangoUrlResolver *urls)
 
bool set (const QRegExp &path, QObject *receiver, const char *member)
 
QString reverse (QObject *receiver, const char *member, const QVariantList &args=QVariantList()) const
 

Friends

class QDjangoUrlResolverPrivate
 

Detailed Description

The QDjangoUrlResolver class maps incoming HTTP requests to handlers.

Constructor & Destructor Documentation

QDjangoUrlResolver::QDjangoUrlResolver ( QObject *  parent = 0)

Constructs a new URL resolver with the given parent.

Member Function Documentation

bool QDjangoUrlResolver::include ( const QRegExp &  path,
QDjangoUrlResolver urls 
)

Adds a URL mapping for the given path.

QDjangoHttpResponse * QDjangoUrlResolver::respond ( const QDjangoHttpRequest request,
const QString &  path 
) const
slot

Responds to the given HTTP request for the given path.

QString QDjangoUrlResolver::reverse ( QObject *  receiver,
const char *  member,
const QVariantList &  args = QVariantList() 
) const

Returns the URL for the member member of receiver with args as arguments.

bool QDjangoUrlResolver::set ( const QRegExp &  path,
QObject *  receiver,
const char *  member 
)

Adds a URL mapping for the given path.


The documentation for this class was generated from the following files:
qdjango-0.4.0/doc/html/dir_2d29d7dff7c7baf1180920f6796c23ae.html0000644000175000007640000002075112163016767023003 0ustar sharkyjerryweb QDjango: http Directory Reference
http Directory Reference

Files

file  QDjangoFastCgiServer.cpp
 
file  QDjangoFastCgiServer.h [code]
 
file  QDjangoHttpController.cpp
 
file  QDjangoHttpController.h [code]
 
file  QDjangoHttpRequest.cpp
 
file  QDjangoHttpRequest.h [code]
 
file  QDjangoHttpResponse.cpp
 
file  QDjangoHttpResponse.h [code]
 
file  QDjangoHttpServer.cpp
 
file  QDjangoHttpServer.h [code]
 
file  QDjangoUrlResolver.cpp
 
file  QDjangoUrlResolver.h [code]
 
qdjango-0.4.0/doc/html/ftv2folderopen.png0000644000175000007640000000112512163016767020244 0ustar sharkyjerrywebPNG  IHDR}\IDATx]?oP9i4i;iiZ7`b٬,HU'$*T]TDP6w};C; aӝߟjAInS}9Hӎ|? =_Ɗue*;YEsYBėsٌ ɫYq !Gǿv̇خ F}qb]70)d-}PfY{4@}2ԗNIǃc%UImcƝ>xt9$ OVE*Û#׈r@l$PrHaa dZrqIoT\,tj2FAxv-Lp׌p TI/ \sf; jViTo^cpb]€<a՜y9:+,E f6NEKU}^;nZuUS4 ѬbN.kjT% iV )GJ@TxIENDB`qdjango-0.4.0/doc/html/dir_18fd539062cd3a2de3dfd78991cf728d.html0000644000175000007640000001736112163016767023016 0ustar sharkyjerryweb QDjango: db Directory Reference
db Directory Reference

Files

file  QDjango.cpp
 
file  QDjango.h [code]
 
file  QDjangoMetaModel.cpp
 
file  QDjangoMetaModel.h [code]
 
file  QDjangoModel.cpp
 
file  QDjangoModel.h [code]
 
file  QDjangoQuerySet.cpp
 
file  QDjangoQuerySet.h [code]
 
file  QDjangoWhere.cpp
 
file  QDjangoWhere.h [code]
 
qdjango-0.4.0/doc/html/classQDjangoMetaField.html0000644000175000007640000003555112163016767021623 0ustar sharkyjerryweb QDjango: QDjangoMetaField Class Reference
QDjangoMetaField Class Reference

The QDjangoMetaField class holds the database schema for a field. More...

#include <QDjangoMetaModel.h>

Public Member Functions

 QDjangoMetaField ()
 Constructs a new QDjangoMetaField.
 
 QDjangoMetaField (const QDjangoMetaField &other)
 Constructs a copy of other.
 
 ~QDjangoMetaField ()
 Destroys the meta field.
 
QDjangoMetaFieldoperator= (const QDjangoMetaField &other)
 Assigns other to this meta field.
 
QString column () const
 Returns the database column for this meta field.
 
bool isAutoIncrement () const
 Returns true if this field is auto incremented.
 
bool isBlank () const
 Returns true if this field can be empty.
 
bool isNullable () const
 Returns true if this field is nullable.
 
bool isUnique () const
 Returns true if this field is unique.
 
bool isValid () const
 Returns true if this is a valid field.
 
QString name () const
 Returns name of this meta field.
 
int maxLength () const
 Returns the max length of this field.
 
QVariant toDatabase (const QVariant &value) const
 Transforms the given field value for database storage.
 

Friends

class QDjangoMetaModel
 

Detailed Description

The QDjangoMetaField class holds the database schema for a field.


The documentation for this class was generated from the following files:
qdjango-0.4.0/doc/html/classQDjangoScript.html0000644000175000007640000002340412163016767021227 0ustar sharkyjerryweb QDjango: QDjangoScript Class Reference

The QDjangoScript class provides static methods for making models scriptable. More...

#include <QDjangoScript.h>

Public Member Functions

template<class T >
void registerModel (QScriptEngine *engine)
 

Static Public Member Functions

template<class T >
static void registerModel (QScriptEngine *engine)
 
static void registerWhere (QScriptEngine *engine)
 

Detailed Description

The QDjangoScript class provides static methods for making models scriptable.

Member Function Documentation

template<class T >
void QDjangoScript::registerModel ( QScriptEngine *  engine)

Makes a QDjangoModel class available to the given QScriptEngine.

Parameters
engine
void QDjangoScript::registerWhere ( QScriptEngine *  engine)
static

Makes the QDjangoWhere class available to the given QScriptEngine.

Parameters
engine

The documentation for this class was generated from the following files:
qdjango-0.4.0/doc/html/classQDjangoHttpResponse-members.html0000644000175000007640000002731312163016767024054 0ustar sharkyjerryweb QDjango: Member List
QDjangoHttpResponse Member List

This is the complete list of members for QDjangoHttpResponse, including all inherited members.

AuthorizationRequired enum value (defined in QDjangoHttpResponse)QDjangoHttpResponse
BadRequest enum value (defined in QDjangoHttpResponse)QDjangoHttpResponse
body() const QDjangoHttpResponse
Forbidden enum value (defined in QDjangoHttpResponse)QDjangoHttpResponse
Found enum value (defined in QDjangoHttpResponse)QDjangoHttpResponse
header(const QString &key) const QDjangoHttpResponse
HttpStatus enum nameQDjangoHttpResponse
InternalServerError enum value (defined in QDjangoHttpResponse)QDjangoHttpResponse
isReady() const QDjangoHttpResponsevirtual
MethodNotAllowed enum value (defined in QDjangoHttpResponse)QDjangoHttpResponse
MovedPermanently enum value (defined in QDjangoHttpResponse)QDjangoHttpResponse
NotFound enum value (defined in QDjangoHttpResponse)QDjangoHttpResponse
NotModified enum value (defined in QDjangoHttpResponse)QDjangoHttpResponse
OK enum value (defined in QDjangoHttpResponse)QDjangoHttpResponse
QDjangoFastCgiConnection (defined in QDjangoHttpResponse)QDjangoHttpResponsefriend
QDjangoHttpConnection (defined in QDjangoHttpResponse)QDjangoHttpResponsefriend
QDjangoHttpResponse()QDjangoHttpResponse
ready()QDjangoHttpResponsesignal
setBody(const QByteArray &body)QDjangoHttpResponse
setHeader(const QString &key, const QString &value)QDjangoHttpResponse
setStatusCode(int code)QDjangoHttpResponse
statusCode() const QDjangoHttpResponse
~QDjangoHttpResponse()QDjangoHttpResponse
qdjango-0.4.0/doc/html/classQDjangoScript-members.html0000644000175000007640000001375212163016767022664 0ustar sharkyjerryweb QDjango: Member List
QDjangoScript Member List

This is the complete list of members for QDjangoScript, including all inherited members.

registerModel(QScriptEngine *engine) (defined in QDjangoScript)QDjangoScriptstatic
registerModel(QScriptEngine *engine)QDjangoScript
registerWhere(QScriptEngine *engine)QDjangoScriptstatic
qdjango-0.4.0/doc/html/group__Http.html0000644000175000007640000002153512163016767017766 0ustar sharkyjerryweb QDjango: Http
QDjango
Http

Classes

class  QDjangoFastCgiServer
 The QDjangoFastCgiServer class represents a FastCGI server. More...
 
class  QDjangoHttpController
 The QDjangoHttpController class provides static methods for replying to HTTP requests. More...
 
class  QDjangoHttpRequest
 The QDjangoHttpRequest class represents an HTTP request. More...
 
class  QDjangoHttpResponse
 The QDjangoHttpResponse class represents an HTTP response. More...
 
class  QDjangoHttpServer
 The QDjangoHttpServer class represents an HTTP server. More...
 
class  QDjangoUrlResolver
 The QDjangoUrlResolver class maps incoming HTTP requests to handlers. More...
 

Detailed Description

QDjango's HTTP request and response framework enables you to write web web applications and serve them over HTTP.

qdjango-0.4.0/doc/html/database.html0000644000175000007640000001661312163016767017241 0ustar sharkyjerryweb QDjango: Database configuration
Database configuration

QDjango relies on the QtSql module for database access, which supports a wide array of database drivers.

Setting the database

The first step is to open the database using QSqlDatabase::addDatabase(), for instance for an in-memory SQLite database:

QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(":memory:");
db.open();

You should now tell QDjango to use the database you just opened:

Creating or dropping database tables

Once you have set the database and declared all your models (see Database models), you can ask QDjango to create the database tables for all models:

Conversely, you can ask QDjango to drop the database tables for all models:

Threading support

Internally, QDjango calls the QDjango::database() method whenever it needs a handle to the database. This method will clone the database connection as needed if it is invoked from a different thread.

qdjango-0.4.0/doc/html/dir_fe414d616bd0c4668e6515f48824338f.html0000644000175000007640000001307412163016767022510 0ustar sharkyjerryweb QDjango: script Directory Reference
script Directory Reference

Files

file  QDjangoScript.cpp
 
file  QDjangoScript.h [code]
 
qdjango-0.4.0/doc/html/tab_a.png0000644000175000007640000000021612163016767016353 0ustar sharkyjerrywebPNG  IHDR$[UIDATxK 0C'o([Ž%x#٩ We# 3t I 3+E~\D9wM}Y_A4Y}IENDB`qdjango-0.4.0/doc/html/classQDjangoWhere.html0000644000175000007640000006600112163016767021035 0ustar sharkyjerryweb QDjango: QDjangoWhere Class Reference

The QDjangoWhere class expresses an SQL constraint. More...

#include <QDjangoWhere.h>

Public Types

enum  Operation {
  None, Equals, NotEquals, GreaterThan,
  LessThan, GreaterOrEquals, LessOrEquals, StartsWith,
  EndsWith, Contains, IsIn, IsNull
}
 

Public Member Functions

 QDjangoWhere ()
 
 QDjangoWhere (const QDjangoWhere &other)
 
 QDjangoWhere (const QString &key, QDjangoWhere::Operation operation, QVariant value)
 
 ~QDjangoWhere ()
 
QDjangoWhereoperator= (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
 

Friends

class QDjangoCompiler
 

Detailed Description

The QDjangoWhere class expresses an SQL constraint.

The QDjangoWhere class is used to build SQL WHERE statements. In its simplest form a QDjangoWhere expresses a constraint on a column value.

QDjangoWhere instances can be negated using the "!" unary operator or combined using the "&&" and "||" boolean operators.

Member Enumeration Documentation

A comparison operation on a database column value.

Enumerator
None 

No comparison, always returns true.

Equals 

Returns true if the column value is equal to the given value.

NotEquals 

Returns true if the column value is not equal to the given value.

GreaterThan 

Returns true if the column value is greater than the given value.

LessThan 

Returns true if the column value is less than the given value.

GreaterOrEquals 

Returns true if the column value is greater or equal to the given value.

LessOrEquals 

Returns true if the column value is less or equal to the given value.

StartsWith 

Returns true if the column value starts with the given value (strings only).

EndsWith 

Returns true if the column value ends with the given value (strings only).

Contains 

Returns true if the column value contains the given value (strings only).

IsIn 

Returns true if the column value is one of the given values.

IsNull 

Returns true if the column value is null.

Constructor & Destructor Documentation

QDjangoWhere::QDjangoWhere ( )

Constructs an empty QDjangoWhere, which expresses no constraint.

QDjangoWhere::QDjangoWhere ( const QDjangoWhere other)

Constructs a copy of other.

QDjangoWhere::QDjangoWhere ( const QString &  key,
QDjangoWhere::Operation  operation,
QVariant  value 
)

Constructs a QDjangoWhere expressing a constraint on a database column.

Parameters
key
operation
value
QDjangoWhere::~QDjangoWhere ( )

Destroys a QDjangoWhere.

Member Function Documentation

void QDjangoWhere::bindValues ( QDjangoQuery &  query) const

Bind the values associated with this QDjangoWhere to the given query.

Parameters
query
bool QDjangoWhere::isAll ( ) const

Returns true if the current QDjangoWhere does not express any constraint.

bool QDjangoWhere::isNone ( ) const

Returns true if the current QDjangoWhere expressed an impossible constraint.

QDjangoWhere QDjangoWhere::operator! ( ) const

Negates the current QDjangoWhere.

QDjangoWhere QDjangoWhere::operator&& ( const QDjangoWhere other) const

Combines the current QDjangoWhere with the other QDjangoWhere using a logical AND.

Parameters
other
QDjangoWhere & QDjangoWhere::operator= ( const QDjangoWhere other)

Assigns other to this QDjangoWhere.

QDjangoWhere QDjangoWhere::operator|| ( const QDjangoWhere other) const

Combines the current QDjangoWhere with the other QDjangoWhere using a logical OR.

Parameters
other
QString QDjangoWhere::sql ( const QSqlDatabase &  db) const

Returns the SQL code corresponding for the current QDjangoWhere.


The documentation for this class was generated from the following files:
qdjango-0.4.0/doc/html/QDjangoHttpResponse_8h_source.html0000644000175000007640000003531112163016767023352 0ustar sharkyjerryweb QDjango: QDjangoHttpResponse.h Source File
QDjangoHttpResponse.h
1 /*
2  * Copyright (C) 2010-2012 Jeremy Lainé
3  * Contact: http://code.google.com/p/qdjango/
4  *
5  * This file is part of the QDjango Library.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  */
17 
18 #ifndef QDJANGO_HTTP_RESPONSE_H
19 #define QDJANGO_HTTP_RESPONSE_H
20 
21 #include <QObject>
22 
23 #include "QDjangoHttp_p.h"
24 
25 class QDjangoHttpResponsePrivate;
26 
31 class QDJANGO_EXPORT QDjangoHttpResponse : public QObject
32 {
33  Q_OBJECT
34 
35 public:
38  enum HttpStatus {
39  OK = 200,
40  MovedPermanently = 301,
41  Found = 302,
42  NotModified = 304,
43  BadRequest = 400,
44  AuthorizationRequired = 401,
45  Forbidden = 403,
46  NotFound = 404,
47  MethodNotAllowed = 405,
48  InternalServerError = 500,
49  };
50 
53 
54  QByteArray body() const;
55  void setBody(const QByteArray &body);
56 
57  QString header(const QString &key) const;
58  void setHeader(const QString &key, const QString &value);
59 
60  virtual bool isReady() const;
61 
62  int statusCode() const;
63  void setStatusCode(int code);
64 
65 signals:
71  void ready();
72 
73 private:
74  Q_DISABLE_COPY(QDjangoHttpResponse)
75  QDjangoHttpResponsePrivate* const d;
76  friend class QDjangoFastCgiConnection;
77  friend class QDjangoHttpConnection;
78 };
79 
80 #endif
qdjango-0.4.0/doc/html/QDjangoHttpServer_8h_source.html0000644000175000007640000003316412163016767023026 0ustar sharkyjerryweb QDjango: QDjangoHttpServer.h Source File
QDjangoHttpServer.h
1 /*
2  * Copyright (C) 2010-2012 Jeremy Lainé
3  * Contact: http://code.google.com/p/qdjango/
4  *
5  * This file is part of the QDjango Library.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  */
17 
18 #ifndef QDJANGO_HTTP_SERVER_H
19 #define QDJANGO_HTTP_SERVER_H
20 
21 #include <QHostAddress>
22 #include <QObject>
23 
24 #include "QDjangoHttp_p.h"
25 
26 class QDjangoHttpRequest;
28 class QDjangoHttpServer;
29 class QDjangoHttpServerPrivate;
30 class QDjangoUrlResolver;
31 
42 class QDJANGO_EXPORT QDjangoHttpServer : public QObject
43 {
44  Q_OBJECT
45 
46 public:
47  QDjangoHttpServer(QObject *parent = 0);
49 
50  void close();
51  bool listen(const QHostAddress &address, quint16 port);
52  QDjangoUrlResolver *urls() const;
53 
54 signals:
57  void requestFinished(QDjangoHttpRequest *request, QDjangoHttpResponse *response);
58 
59 private slots:
60  void _q_newTcpConnection();
61 
62 private:
63  Q_DISABLE_COPY(QDjangoHttpServer)
64  QDjangoHttpServerPrivate* const d;
65 };
66 
67 #endif
qdjango-0.4.0/doc/html/files.html0000644000175000007640000001772312163016767016602 0ustar sharkyjerryweb QDjango: File List
QDjango
File List
Here is a list of all documented files with brief descriptions:
o*QDjango.h
o*QDjangoFastCgiServer.h
o*QDjangoHttpController.h
o*QDjangoHttpRequest.h
o*QDjangoHttpResponse.h
o*QDjangoHttpServer.h
o*QDjangoMetaModel.h
o*QDjangoModel.h
o*QDjangoQuerySet.h
o*QDjangoScript.h
o*QDjangoUrlResolver.h
\*QDjangoWhere.h
qdjango-0.4.0/doc/html/classQDjangoHttpServer.html0000644000175000007640000003275212163016767022077 0ustar sharkyjerryweb QDjango: QDjangoHttpServer Class Reference
QDjangoHttpServer Class Reference

The QDjangoHttpServer class represents an HTTP server. More...

#include <QDjangoHttpServer.h>

Inheritance diagram for QDjangoHttpServer:

Signals

void requestFinished (QDjangoHttpRequest *request, QDjangoHttpResponse *response)
 

Public Member Functions

 QDjangoHttpServer (QObject *parent=0)
 
 ~QDjangoHttpServer ()
 
void close ()
 
bool listen (const QHostAddress &address, quint16 port)
 
QDjangoUrlResolverurls () const
 

Detailed Description

The QDjangoHttpServer class represents an HTTP server.

It allows you to create a standalone HTTP server which will serve your web application.

To register views, see urls().

See Also
QDjangoFastCgiServer

Constructor & Destructor Documentation

QDjangoHttpServer::QDjangoHttpServer ( QObject *  parent = 0)

Constructs a new HTTP server.

QDjangoHttpServer::~QDjangoHttpServer ( )

Destroys the HTTP server.

Member Function Documentation

void QDjangoHttpServer::close ( )

Closes the server. The server will no longer listen for incoming connections.

bool QDjangoHttpServer::listen ( const QHostAddress &  address,
quint16  port 
)

Tells the server to listen for incoming TCP connections on the given address and port.

void QDjangoHttpServer::requestFinished ( QDjangoHttpRequest request,
QDjangoHttpResponse response 
)
signal

This signal is emitted when a request completes.

QDjangoUrlResolver * QDjangoHttpServer::urls ( ) const

Returns the root URL resolver for the server, which dispatches requests to handlers.


The documentation for this class was generated from the following files:
qdjango-0.4.0/doc/html/doxygen.png0000644000175000007640000000730312163016767016766 0ustar sharkyjerrywebPNG  IHDRh ;IDATx]y\պ~45%TL QPE"q11]8aw*(*" z`8 m,p$%B(8k6lk[߷;?kPx'tz3_Q4g@m ci{~4:Hc'PP7^h zbcP 3}OqNkT(?d ~z<4ǡ؞vz٦Zd,6k]Fz< Zs?sU2Sw1c`[}%ѽ.Լ6BLZ!F8[ T #g]:vu?vbR?wgb$kF~;عƕX?lNʪ,HCgAzlӺg ]jM3oҳ'=$f}GS_co.ȹ:ds:1={9?zqviDp moaEqҵw}~{j{ºFNë[OqOSXO]>muľe5{Jկ(bl}`UyacCAklysA7oJ .Be. Z'-PyF.lp&.j7rez19HG%qz׈c_k_")HJn~֘5 q5#+9T Rܸrzϴ̝ =υ{áOfwg|/$;֙ƭ]W"/< DఽB}yIEc^=[VhM$l];Kr¦* t$]M;I1!M (f<5~z mՠ>کIz;u[ie^ӳNF6B\}7+,'a -yHY,^f~?Hc{Z+4\sٷnߣFơsغD?<vkx0MlذIxdEEAMg*YE7ۙ^[uv[wG=Edn׶l'pGk+C82 dz3H BS[wŘ ~xptmţiQ歉AB1fى4uI]6% 1t.NJphz̠R1"3-"&1[:N mW0_œ 6&)ꦬ}~{m]zMP~^:eQT_*798ˍ 347E¿uSɻU_ NWeNӏ|;;d"ȉ޵ᆴ"ĴMM+bY_E]PXKНIޥoE<_(EP|m,өZߺk,kM`jzeU t36˷r}w:Χ |TܵQK_pໃYd0!a –W$$/\$ 2mLH dHV,:RZJaz*>_NT(‚^SVFU8E܈nd;8\C]=m:bDd=ߞUU5O|]Pv\]2"y[yzg{Y{Ù5;w{N3nĨwKݭ29Id y)P8ũ@mPwjl,6 hWd ump.DžtwR xBδYcxg*vo y򑕓[?V0NO난~󒯷h#Hk8kӍ^q@]ӓ,56-κUn[>]@nϜp[6# 4tn:}8T9_Y$/GK(ђM`dѺ;OB &P{qhJ+閧l2M_1ӫtlya L^y.۽[ u/]iS}N>e1qjf&iT\=kϛX-.84V5u!TE .OH4zwTr. xքHHg hT$yqzp< qrwI]I鲘s":ՖbզL69VW<;3?M3AV#ޯKUr9!qtH+6V/TS^pqgLP'5E ޺ n"2|;W"֬TwtO' +W+Z̖<&nO,I06.Z.h*INڒOegBXZ9hDSʍ A/c`A"z|ş;H#|%OOD mcƤqmu&~n πZj =_n[nN$_bE)8?6l}#bW( d-p&a"9ņ$ڛA!;{~8ޣ10`#kuN Qbh 8Mawhq(bK Z%m֍(J)@> 7% {y ohf>{p.­_%glZ\B2B #Һphݚ[<#SpA7Ht4:|gtL*($Ʃ$;b`=MM5ǾHH.HeA5}rd)T};Q5i2O00;,냔}g]79_{C>h{.II?[Kswz6u;OJa˶zvd l舊yc'rTWӰL |ʽhB T'ò]K(=Kx  L,Pʵu׈ž1ݫ;pGDxZY kf676oھH~޸ 8Up6(? K+?%ݷ/19U?B)l @=ޞkIENDB`qdjango-0.4.0/doc/html/group__Database.html0000644000175000007640000001703612163016767020554 0ustar sharkyjerryweb QDjango: Database
QDjango
Database

Classes

class  QDjango
 The QDjango class provides a set of static functions. More...
 
class  QDjangoModel
 The QDjangoModel class is the base class for all models. More...
 
class  QDjangoQuerySet< T >
 The QDjangoQuerySet class is a template class for performing database queries. More...
 
class  QDjangoWhere
 The QDjangoWhere class expresses an SQL constraint. More...
 

Detailed Description

QDjango's Object Relation Mapper (ORM) strives to be both powerful and simple to use. Where possible it tries to follow django's ORM API, with a similar lazy queryset mechanism.

qdjango-0.4.0/doc/html/QDjangoModel_8h_source.html0000644000175000007640000002724512163016767021763 0ustar sharkyjerryweb QDjango: QDjangoModel.h Source File
QDjangoModel.h
1 /*
2  * Copyright (C) 2010-2012 Jeremy Lainé
3  * Contact: http://code.google.com/p/qdjango/
4  *
5  * This file is part of the QDjango Library.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  */
17 
18 #ifndef QDJANGO_MODEL_H
19 #define QDJANGO_MODEL_H
20 
21 #include <QObject>
22 #include <QVariant>
23 
24 #include "QDjango_p.h"
25 
78 class QDJANGO_EXPORT QDjangoModel : public QObject
79 {
80  Q_OBJECT
81  Q_PROPERTY(QVariant pk READ pk WRITE setPk)
82  Q_CLASSINFO("pk", "ignore_field=true")
83 
84 public:
85  QDjangoModel(QObject *parent = 0);
86 
87  QVariant pk() const;
88  void setPk(const QVariant &pk);
89 
90 public slots:
91  bool remove();
92  bool save();
93  QString toString() const;
94 
95 protected:
96  QObject *foreignKey(const char *name) const;
97  void setForeignKey(const char *name, QObject *value);
98 };
99 
100 #endif
qdjango-0.4.0/doc/html/classQDjangoQuerySet_1_1const__iterator-members.html0000644000175000007640000003177012163016767026760 0ustar sharkyjerryweb QDjango: Member List
QDjangoQuerySet< T >::const_iterator Member List

This is the complete list of members for QDjangoQuerySet< T >::const_iterator, including all inherited members.

const_iterator()QDjangoQuerySet< T >::const_iteratorinline
const_iterator(const const_iterator &other)QDjangoQuerySet< T >::const_iteratorinline
iterator_category typedefQDjangoQuerySet< T >::const_iterator
operator!=(const const_iterator &other) const QDjangoQuerySet< T >::const_iteratorinline
operator*() const QDjangoQuerySet< T >::const_iteratorinline
operator+(int i) const QDjangoQuerySet< T >::const_iteratorinline
operator++()QDjangoQuerySet< T >::const_iteratorinline
operator++(int)QDjangoQuerySet< T >::const_iteratorinline
operator+=(int i)QDjangoQuerySet< T >::const_iteratorinline
operator-(int i) const QDjangoQuerySet< T >::const_iteratorinline
operator-(const const_iterator &other) const QDjangoQuerySet< T >::const_iteratorinline
operator--()QDjangoQuerySet< T >::const_iteratorinline
operator--(int)QDjangoQuerySet< T >::const_iteratorinline
operator-=(int i)QDjangoQuerySet< T >::const_iteratorinline
operator->() const QDjangoQuerySet< T >::const_iteratorinline
operator<(const const_iterator &other) const QDjangoQuerySet< T >::const_iteratorinline
operator<=(const const_iterator &other) const QDjangoQuerySet< T >::const_iteratorinline
operator==(const const_iterator &other) const QDjangoQuerySet< T >::const_iteratorinline
operator>(const const_iterator &other) const QDjangoQuerySet< T >::const_iteratorinline
operator>=(const const_iterator &other) const QDjangoQuerySet< T >::const_iteratorinline
QDjangoQuerySet (defined in QDjangoQuerySet< T >::const_iterator)QDjangoQuerySet< T >::const_iteratorfriend
qdjango-0.4.0/doc/html/functions_func.html0000644000175000007640000006243112163016767020517 0ustar sharkyjerryweb QDjango: Class Members - Functions
QDjango
 

- a -

- b -

- c -

- d -

- e -

- f -

- g -

- h -

- i -

- l -

- m -

- n -

- o -

- p -

- q -

- r -

- s -

- t -

- u -

- v -

- w -

- ~ -

qdjango-0.4.0/doc/html/doxygen.css0000644000175000007640000005003512163016767016772 0ustar sharkyjerryweb/* The standard CSS for doxygen 1.8.4 */ body, table, div, p, dl { font: 400 14px/22px Roboto,sans-serif; } /* @group Heading Levels */ h1.groupheader { font-size: 150%; } .title { font: 400 14px/28px Roboto,sans-serif; font-size: 150%; font-weight: bold; margin: 10px 2px; } h2.groupheader { border-bottom: 1px solid #879ECB; color: #354C7B; font-size: 150%; font-weight: normal; margin-top: 1.75em; padding-top: 8px; padding-bottom: 4px; width: 100%; } h3.groupheader { font-size: 100%; } h1, h2, h3, h4, h5, h6 { -webkit-transition: text-shadow 0.5s linear; -moz-transition: text-shadow 0.5s linear; -ms-transition: text-shadow 0.5s linear; -o-transition: text-shadow 0.5s linear; transition: text-shadow 0.5s linear; margin-right: 15px; } h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow { text-shadow: 0 0 15px cyan; } dt { font-weight: bold; } div.multicol { -moz-column-gap: 1em; -webkit-column-gap: 1em; -moz-column-count: 3; -webkit-column-count: 3; } p.startli, p.startdd, p.starttd { margin-top: 2px; } p.endli { margin-bottom: 0px; } p.enddd { margin-bottom: 4px; } p.endtd { margin-bottom: 2px; } /* @end */ caption { font-weight: bold; } span.legend { font-size: 70%; text-align: center; } h3.version { font-size: 90%; text-align: center; } div.qindex, div.navtab{ background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; } div.qindex, div.navpath { width: 100%; line-height: 140%; } div.navtab { margin-right: 15px; } /* @group Link Styling */ a { color: #3D578C; font-weight: normal; text-decoration: none; } .contents a:visited { color: #4665A2; } a:hover { text-decoration: underline; } a.qindex { font-weight: bold; } a.qindexHL { font-weight: bold; background-color: #9CAFD4; color: #ffffff; border: 1px double #869DCA; } .contents a.qindexHL:visited { color: #ffffff; } a.el { font-weight: bold; } a.elRef { } a.code, a.code:visited { color: #4665A2; } a.codeRef, a.codeRef:visited { color: #4665A2; } /* @end */ dl.el { margin-left: -1cm; } pre.fragment { border: 1px solid #C4CFE5; background-color: #FBFCFD; padding: 4px 6px; margin: 4px 8px 4px 2px; overflow: auto; word-wrap: break-word; font-size: 9pt; line-height: 125%; font-family: monospace, fixed; font-size: 105%; } div.fragment { padding: 0px; margin: 0px; background-color: #FBFCFD; border: 1px solid #C4CFE5; } div.line { font-family: monospace, fixed; font-size: 13px; min-height: 13px; line-height: 1.0; text-wrap: unrestricted; white-space: -moz-pre-wrap; /* Moz */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ white-space: pre-wrap; /* CSS3 */ word-wrap: break-word; /* IE 5.5+ */ text-indent: -53px; padding-left: 53px; padding-bottom: 0px; margin: 0px; -webkit-transition-property: background-color, box-shadow; -webkit-transition-duration: 0.5s; -moz-transition-property: background-color, box-shadow; -moz-transition-duration: 0.5s; -ms-transition-property: background-color, box-shadow; -ms-transition-duration: 0.5s; -o-transition-property: background-color, box-shadow; -o-transition-duration: 0.5s; transition-property: background-color, box-shadow; transition-duration: 0.5s; } div.line.glow { background-color: cyan; box-shadow: 0 0 10px cyan; } span.lineno { padding-right: 4px; text-align: right; border-right: 2px solid #0F0; background-color: #E8E8E8; white-space: pre; } span.lineno a { background-color: #D8D8D8; } span.lineno a:hover { background-color: #C8C8C8; } div.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px; padding: 0.2em; border: solid thin #333; border-radius: 0.5em; -webkit-border-radius: .5em; -moz-border-radius: .5em; box-shadow: 2px 2px 3px #999; -webkit-box-shadow: 2px 2px 3px #999; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000); } div.groupHeader { margin-left: 16px; margin-top: 12px; font-weight: bold; } div.groupText { margin-left: 16px; font-style: italic; } body { background-color: white; color: black; margin: 0; } div.contents { margin-top: 10px; margin-left: 12px; margin-right: 8px; } td.indexkey { background-color: #EBEFF6; font-weight: bold; border: 1px solid #C4CFE5; margin: 2px 0px 2px 0; padding: 2px 10px; white-space: nowrap; vertical-align: top; } td.indexvalue { background-color: #EBEFF6; border: 1px solid #C4CFE5; padding: 2px 10px; margin: 2px 0px; } tr.memlist { background-color: #EEF1F7; } p.formulaDsp { text-align: center; } img.formulaDsp { } img.formulaInl { vertical-align: middle; } div.center { text-align: center; margin-top: 0px; margin-bottom: 0px; padding: 0px; } div.center img { border: 0px; } address.footer { text-align: right; padding-right: 12px; } img.footer { border: 0px; vertical-align: middle; } /* @group Code Colorization */ span.keyword { color: #008000 } span.keywordtype { color: #604020 } span.keywordflow { color: #e08000 } span.comment { color: #800000 } span.preprocessor { color: #806020 } span.stringliteral { color: #002080 } span.charliteral { color: #008080 } span.vhdldigit { color: #ff00ff } span.vhdlchar { color: #000000 } span.vhdlkeyword { color: #700070 } span.vhdllogic { color: #ff0000 } blockquote { background-color: #F7F8FB; border-left: 2px solid #9CAFD4; margin: 0 24px 0 4px; padding: 0 12px 0 16px; } /* @end */ /* .search { color: #003399; font-weight: bold; } form.search { margin-bottom: 0px; margin-top: 0px; } input.search { font-size: 75%; color: #000080; font-weight: normal; background-color: #e8eef2; } */ td.tiny { font-size: 75%; } .dirtab { padding: 4px; border-collapse: collapse; border: 1px solid #A3B4D7; } th.dirtab { background: #EBEFF6; font-weight: bold; } hr { height: 0px; border: none; border-top: 1px solid #4A6AAA; } hr.footer { height: 1px; } /* @group Member Descriptions */ table.memberdecls { border-spacing: 0px; padding: 0px; } .memberdecls td, .fieldtable tr { -webkit-transition-property: background-color, box-shadow; -webkit-transition-duration: 0.5s; -moz-transition-property: background-color, box-shadow; -moz-transition-duration: 0.5s; -ms-transition-property: background-color, box-shadow; -ms-transition-duration: 0.5s; -o-transition-property: background-color, box-shadow; -o-transition-duration: 0.5s; transition-property: background-color, box-shadow; transition-duration: 0.5s; } .memberdecls td.glow, .fieldtable tr.glow { background-color: cyan; box-shadow: 0 0 15px cyan; } .mdescLeft, .mdescRight, .memItemLeft, .memItemRight, .memTemplItemLeft, .memTemplItemRight, .memTemplParams { background-color: #F9FAFC; border: none; margin: 4px; padding: 1px 0 0 8px; } .mdescLeft, .mdescRight { padding: 0px 8px 4px 8px; color: #555; } .memSeparator { border-bottom: 1px solid #DEE4F0; line-height: 1px; margin: 0px; padding: 0px; } .memItemLeft, .memTemplItemLeft { white-space: nowrap; } .memItemRight { width: 100%; } .memTemplParams { color: #4665A2; white-space: nowrap; font-size: 80%; } /* @end */ /* @group Member Details */ /* Styles for detailed member documentation */ .memtemplate { font-size: 80%; color: #4665A2; font-weight: normal; margin-left: 9px; } .memnav { background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; margin: 2px; margin-right: 15px; padding: 2px; } .mempage { width: 100%; } .memitem { padding: 0; margin-bottom: 10px; margin-right: 5px; -webkit-transition: box-shadow 0.5s linear; -moz-transition: box-shadow 0.5s linear; -ms-transition: box-shadow 0.5s linear; -o-transition: box-shadow 0.5s linear; transition: box-shadow 0.5s linear; display: table !important; width: 100%; } .memitem.glow { box-shadow: 0 0 15px cyan; } .memname { font-weight: bold; margin-left: 6px; } .memname td { vertical-align: bottom; } .memproto, dl.reflist dt { border-top: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 6px 0px 6px 0px; color: #253555; font-weight: bold; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); background-image:url('nav_f.png'); background-repeat:repeat-x; background-color: #E2E8F2; /* opera specific markup */ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); border-top-right-radius: 4px; border-top-left-radius: 4px; /* firefox specific markup */ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; -moz-border-radius-topright: 4px; -moz-border-radius-topleft: 4px; /* webkit specific markup */ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); -webkit-border-top-right-radius: 4px; -webkit-border-top-left-radius: 4px; } .memdoc, dl.reflist dd { border-bottom: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 6px 10px 2px 10px; background-color: #FBFCFD; border-top-width: 0; background-image:url('nav_g.png'); background-repeat:repeat-x; background-color: #FFFFFF; /* opera specific markup */ border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); /* firefox specific markup */ -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; /* webkit specific markup */ -webkit-border-bottom-left-radius: 4px; -webkit-border-bottom-right-radius: 4px; -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); } dl.reflist dt { padding: 5px; } dl.reflist dd { margin: 0px 0px 10px 0px; padding: 5px; } .paramkey { text-align: right; } .paramtype { white-space: nowrap; } .paramname { color: #602020; white-space: nowrap; } .paramname em { font-style: normal; } .paramname code { line-height: 14px; } .params, .retval, .exception, .tparams { margin-left: 0px; padding-left: 0px; } .params .paramname, .retval .paramname { font-weight: bold; vertical-align: top; } .params .paramtype { font-style: italic; vertical-align: top; } .params .paramdir { font-family: "courier new",courier,monospace; vertical-align: top; } table.mlabels { border-spacing: 0px; } td.mlabels-left { width: 100%; padding: 0px; } td.mlabels-right { vertical-align: bottom; padding: 0px; white-space: nowrap; } span.mlabels { margin-left: 8px; } span.mlabel { background-color: #728DC1; border-top:1px solid #5373B4; border-left:1px solid #5373B4; border-right:1px solid #C4CFE5; border-bottom:1px solid #C4CFE5; text-shadow: none; color: white; margin-right: 4px; padding: 2px 3px; border-radius: 3px; font-size: 7pt; white-space: nowrap; vertical-align: middle; } /* @end */ /* these are for tree view when not used as main index */ div.directory { margin: 10px 0px; border-top: 1px solid #A8B8D9; border-bottom: 1px solid #A8B8D9; width: 100%; } .directory table { border-collapse:collapse; } .directory td { margin: 0px; padding: 0px; vertical-align: top; } .directory td.entry { white-space: nowrap; padding-right: 6px; padding-top: 3px; } .directory td.entry a { outline:none; } .directory td.entry a img { border: none; } .directory td.desc { width: 100%; padding-left: 6px; padding-right: 6px; padding-top: 3px; border-left: 1px solid rgba(0,0,0,0.05); } .directory tr.even { padding-left: 6px; background-color: #F7F8FB; } .directory img { vertical-align: -30%; } .directory .levels { white-space: nowrap; width: 100%; text-align: right; font-size: 9pt; } .directory .levels span { cursor: pointer; padding-left: 2px; padding-right: 2px; color: #3D578C; } div.dynheader { margin-top: 8px; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } address { font-style: normal; color: #2A3D61; } table.doxtable { border-collapse:collapse; margin-top: 4px; margin-bottom: 4px; } table.doxtable td, table.doxtable th { border: 1px solid #2D4068; padding: 3px 7px 2px; } table.doxtable th { background-color: #374F7F; color: #FFFFFF; font-size: 110%; padding-bottom: 4px; padding-top: 5px; } table.fieldtable { /*width: 100%;*/ margin-bottom: 10px; border: 1px solid #A8B8D9; border-spacing: 0px; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); } .fieldtable td, .fieldtable th { padding: 3px 7px 2px; } .fieldtable td.fieldtype, .fieldtable td.fieldname { white-space: nowrap; border-right: 1px solid #A8B8D9; border-bottom: 1px solid #A8B8D9; vertical-align: top; } .fieldtable td.fieldname { padding-top: 3px; } .fieldtable td.fielddoc { border-bottom: 1px solid #A8B8D9; /*width: 100%;*/ } .fieldtable td.fielddoc p:first-child { margin-top: 0px; } .fieldtable td.fielddoc p:last-child { margin-bottom: 2px; } .fieldtable tr:last-child td { border-bottom: none; } .fieldtable th { background-image:url('nav_f.png'); background-repeat:repeat-x; background-color: #E2E8F2; font-size: 90%; color: #253555; padding-bottom: 4px; padding-top: 5px; text-align:left; -moz-border-radius-topleft: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-left-radius: 4px; -webkit-border-top-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom: 1px solid #A8B8D9; } .tabsearch { top: 0px; left: 10px; height: 36px; background-image: url('tab_b.png'); z-index: 101; overflow: hidden; font-size: 13px; } .navpath ul { font-size: 11px; background-image:url('tab_b.png'); background-repeat:repeat-x; background-position: 0 -5px; height:30px; line-height:30px; color:#8AA0CC; border:solid 1px #C2CDE4; overflow:hidden; margin:0px; padding:0px; } .navpath li { list-style-type:none; float:left; padding-left:10px; padding-right:15px; background-image:url('bc_s.png'); background-repeat:no-repeat; background-position:right; color:#364D7C; } .navpath li.navelem a { height:32px; display:block; text-decoration: none; outline: none; color: #283A5D; font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); text-decoration: none; } .navpath li.navelem a:hover { color:#6884BD; } .navpath li.footer { list-style-type:none; float:right; padding-left:10px; padding-right:15px; background-image:none; background-repeat:no-repeat; background-position:right; color:#364D7C; font-size: 8pt; } div.summary { float: right; font-size: 8pt; padding-right: 5px; width: 50%; text-align: right; } div.summary a { white-space: nowrap; } div.ingroups { font-size: 8pt; width: 50%; text-align: left; } div.ingroups a { white-space: nowrap; } div.header { background-image:url('nav_h.png'); background-repeat:repeat-x; background-color: #F9FAFC; margin: 0px; border-bottom: 1px solid #C4CFE5; } div.headertitle { padding: 5px 5px 5px 10px; } dl { padding: 0 0 0 10px; } /* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug */ dl.section { margin-left: 0px; padding-left: 0px; } dl.note { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #D0C000; } dl.warning, dl.attention { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #FF0000; } dl.pre, dl.post, dl.invariant { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #00D000; } dl.deprecated { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #505050; } dl.todo { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #00C0E0; } dl.test { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #3030E0; } dl.bug { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #C08050; } dl.section dd { margin-bottom: 6px; } #projectlogo { text-align: center; vertical-align: bottom; border-collapse: separate; } #projectlogo img { border: 0px none; } #projectname { font: 300% Tahoma, Arial,sans-serif; margin: 0px; padding: 2px 0px; } #projectbrief { font: 120% Tahoma, Arial,sans-serif; margin: 0px; padding: 0px; } #projectnumber { font: 50% Tahoma, Arial,sans-serif; margin: 0px; padding: 0px; } #titlearea { padding: 0px; margin: 0px; width: 100%; border-bottom: 1px solid #5373B4; } .image { text-align: center; } .dotgraph { text-align: center; } .mscgraph { text-align: center; } .caption { font-weight: bold; } div.zoom { border: 1px solid #90A5CE; } dl.citelist { margin-bottom:50px; } dl.citelist dt { color:#334975; float:left; font-weight:bold; margin-right:10px; padding:5px; } dl.citelist dd { margin:2px 0; padding:5px 0; } div.toc { padding: 14px 25px; background-color: #F4F6FA; border: 1px solid #D8DFEE; border-radius: 7px 7px 7px 7px; float: right; height: auto; margin: 0 20px 10px 10px; width: 200px; } div.toc li { background: url("bdwn.png") no-repeat scroll 0 5px transparent; font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; margin-top: 5px; padding-left: 10px; padding-top: 2px; } div.toc h3 { font: bold 12px/1.2 Arial,FreeSans,sans-serif; color: #4665A2; border-bottom: 0 none; margin: 0; } div.toc ul { list-style: none outside none; border: medium none; padding: 0px; } div.toc li.level1 { margin-left: 0px; } div.toc li.level2 { margin-left: 15px; } div.toc li.level3 { margin-left: 30px; } div.toc li.level4 { margin-left: 45px; } .inherit_header { font-weight: bold; color: gray; cursor: pointer; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .inherit_header td { padding: 6px 0px 2px 5px; } .inherit { display: none; } tr.heading h2 { margin-top: 12px; margin-bottom: 4px; } @media print { #top { display: none; } #side-nav { display: none; } #nav-path { display: none; } body { overflow:visible; } h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } .summary { display: none; } .memitem { page-break-inside: avoid; } #doc-content { margin-left:0 !important; height:auto !important; width:auto !important; overflow:inherit; display:inline; } } qdjango-0.4.0/doc/html/classQDjangoHttpResponse.html0000644000175000007640000004664612163016767022436 0ustar sharkyjerryweb QDjango: QDjangoHttpResponse Class Reference
QDjangoHttpResponse Class Reference

The QDjangoHttpResponse class represents an HTTP response. More...

#include <QDjangoHttpResponse.h>

Inheritance diagram for QDjangoHttpResponse:

Public Types

enum  HttpStatus {
  OK = 200, MovedPermanently = 301, Found = 302, NotModified = 304,
  BadRequest = 400, AuthorizationRequired = 401, Forbidden = 403, NotFound = 404,
  MethodNotAllowed = 405, InternalServerError = 500
}
 Enum representing well-known HTTP status codes.
 

Signals

void ready ()
 

Public Member Functions

 QDjangoHttpResponse ()
 
 ~QDjangoHttpResponse ()
 
QByteArray body () const
 
void setBody (const QByteArray &body)
 
QString header (const QString &key) const
 
void setHeader (const QString &key, const QString &value)
 
virtual bool isReady () const
 
int statusCode () const
 
void setStatusCode (int code)
 

Friends

class QDjangoFastCgiConnection
 
class QDjangoHttpConnection
 

Detailed Description

The QDjangoHttpResponse class represents an HTTP response.

Constructor & Destructor Documentation

QDjangoHttpResponse::QDjangoHttpResponse ( )

Constructs a new HTTP response.

QDjangoHttpResponse::~QDjangoHttpResponse ( )

Destroys the HTTP response.

Member Function Documentation

QByteArray QDjangoHttpResponse::body ( ) const

Returns the raw body of the HTTP response.

QString QDjangoHttpResponse::header ( const QString &  key) const

Returns the specified HTTP response header.

Parameters
key
bool QDjangoHttpResponse::isReady ( ) const
virtual

Returns true if the response is ready to be sent.

The default implementation always returns true. If you subclass QDjangoHttpResponse to support responses which should only be sent to the client at a later point, you need to reimplement this method and emit the ready() signal once the response is ready.

void QDjangoHttpResponse::ready ( )
signal

Emit this signal from your QDjangoHttpResponse subclasses once the response is ready to be sent to the client.

See Also
isReady()
void QDjangoHttpResponse::setBody ( const QByteArray &  body)

Sets the raw body of the HTTP response.

The Content-Length header will be updated to reflect the body size.

Parameters
body
void QDjangoHttpResponse::setHeader ( const QString &  key,
const QString &  value 
)

Sets the specified HTTP response header.

Parameters
key
value
void QDjangoHttpResponse::setStatusCode ( int  code)

Sets the code for the HTTP response status line.

Parameters
code
int QDjangoHttpResponse::statusCode ( ) const

Returns the code for the HTTP response status line.


The documentation for this class was generated from the following files:
qdjango-0.4.0/doc/html/ftv2link.png0000644000175000007640000000135212163016767017046 0ustar sharkyjerrywebPNG  IHDR}\IDATxMOS[sa?-XZ(PD4 AWbu`b 77wHFCԁ/`voAPqP@ 980 +y^Z9SW\83g3'Nçl_bpV"ֆXd]3xM[1W *PGz/Eg{ aoV:这1$RW,@56-,m/蹖 r5T*S(Vf89u գwa=<{ҡUr+dDF$`zNܮ0Q3~_^N=vpTLT}kqm<?ZhX_ݥ[) `ga_*2`'=F2EP l=8Wv%THqɿ<"GxH{#֫aJmKsVءM^ T ݛr߽m_?Wİ#uIENDB`qdjango-0.4.0/doc/html/pages.html0000644000175000007640000001475012163016767016574 0ustar sharkyjerryweb QDjango: Related Pages
QDjango
Related Pages
Here is a list of all related documentation pages:
oDatabase configurationQDjango relies on the QtSql module for database access, which supports a wide array of database drivers
oDatabase modelsDatabase models are usually created by subclassing the QDjangoModel class
oMaking queriesThe QDjango object relational mapper (ORM) supports the concept of querysets, borrowed from django's ORM
\Scripting modelsThe QDjangoScript class makes it easy to access your models from QtScript
qdjango-0.4.0/doc/html/tab_s.png0000644000175000007640000000027012163016767016375 0ustar sharkyjerrywebPNG  IHDR$[IDATx݁ @@ѣ?Q"%If6[HQ<]dr s?O=w'F -~rÍ[芭m֬ݯнF)Y% `n,9B!ь\<#IENDB`qdjango-0.4.0/doc/html/classQDjangoModel.png0000644000175000007640000000073512163016767020645 0ustar sharkyjerrywebPNG  IHDRaP>PLTEutRNST2lIDATxђ EO^z*(hݝ.3ނ䐐Pa4P I~B9:-!vFHgk.BV˰*I [X+I:? *h'vo_p\ҷCĎ)zi[^Ow8UBzK!@C5xF '< KjBs/Uc!$%z)+AUK' M7!Y Cff#%:TIENDB`qdjango-0.4.0/doc/html/queries.html0000644000175000007640000003407012163016767017147 0ustar sharkyjerryweb QDjango: Making queries
Making queries

The QDjango object relational mapper (ORM) supports the concept of querysets, borrowed from django's ORM.

A queryset is a collection of database objects which match a certain number of user-specified conditions.

You can learn more about querysets by reading the QDjangoQuerySet template class documentation.

Creating and filtering querysets

Before you can start using querysets, you need to declare your database models as described in Database models.

The most basic queryset matches all the objects for a given model.

// all users

You can use the QDjangoQuerySet::filter() and QDjangoQuerySet::exclude() methods to add filtering conditions to a querset:

// find all users whose password is "foo" and whose username is not "bar"
someUsers = users.filter(QDjangoWhere("password", QDjangoWhere::Equals, "foo") &&
QDjangoWhere("username", QDjangoWhere::NotEquals, "bar"));
// find all users whose username is "foo" or "bar"
someUsers = users.filter(QDjangoWhere("username", QDjangoWhere::Equals, "foo") ||
QDjangoWhere("username", QDjangoWhere::Equals, "bar"));
// find all users whose username starts with "f":
someUsers = users.filter(QDjangoWhere("username", QDjangoWhere::StartsWith, "f"));

You can also use the QDjangoQuerySet::limit() method to limit the number of returned rows:

// limit number of results
someUsers = users.limit(0, 100);

Iterating over results

The easiest way to iterate over results is to use Qt's foreach keyword:

// iterate over matching users
foreach (const User &user, someUsers) {
qDebug() << "found user" << user.username;
}

Another way of iterating over results is to run over model instances using the QDjangoQuerySet::size() and QDjangoQuerySet::at() methods:

// iterate over matching users
User user;
for (int i = 0; i < someUsers.size(); ++i) {
if (someUsers.at(i, &user)) {
qDebug() << "found user" << user.username;
}
}

It is also possible to retrieve field data without creating model instances using the QDjangoQuerySet::values() and QDjangoQuerySet::valuesList() methods:

// retrieve usernames and passwords for matching users as maps
QList<QVariantMap> propertyMaps = someUsers.values(QStringList() << "username" << "password");
foreach (const QVariantMap &propertyMap, propertyMaps) {
qDebug() << "username" << propertyList["username"];
qDebug() << "password" << propertyList["password"];
}
// retrieve usernames and passwords for matching users as lists
QList<QVariantList> propertyLists = someUsers.valuesList(QStringList() << "username" << "password");
foreach (const QVariantList &propertyList, propertyLists) {
qDebug() << "username" << propertyList[0];
qDebug() << "password" << propertyList[1];
}

Other operations

// count matching users without retrieving their data
int numberOfUsers = someUsers.count();
// delete all the users in the queryset
someUsers.remove();
qdjango-0.4.0/doc/html/functions_enum.html0000644000175000007640000001314712163016767020530 0ustar sharkyjerryweb QDjango: Class Members - Enumerations
QDjango
 
qdjango-0.4.0/doc/html/classQDjangoUrlResolver-members.html0000644000175000007640000001646212163016767023705 0ustar sharkyjerryweb QDjango: Member List
QDjangoUrlResolver Member List

This is the complete list of members for QDjangoUrlResolver, including all inherited members.

include(const QRegExp &path, QDjangoUrlResolver *urls)QDjangoUrlResolver
QDjangoUrlResolver(QObject *parent=0)QDjangoUrlResolver
QDjangoUrlResolverPrivate (defined in QDjangoUrlResolver)QDjangoUrlResolverfriend
respond(const QDjangoHttpRequest &request, const QString &path) const QDjangoUrlResolverslot
reverse(QObject *receiver, const char *member, const QVariantList &args=QVariantList()) const QDjangoUrlResolver
set(const QRegExp &path, QObject *receiver, const char *member)QDjangoUrlResolver
~QDjangoUrlResolver() (defined in QDjangoUrlResolver)QDjangoUrlResolver
qdjango-0.4.0/doc/html/classQDjangoUrlResolver.png0000644000175000007640000000077612163016767022076 0ustar sharkyjerrywebPNG  IHDRPލPLTEutRNST2IDATxے D;/\QR1$W$u/ IV/&ïזO&{$8W7$yno>|`yc4҂$Mf'c f+ ,IJqo\ῆ ""]`FL`< DDF P!"=sFW)@qq6;]9d&^u7{ӑd Qm Vc]jk޹i>r`=A%\PZjƀ}P88R>ˤ{#:PsYE@ .(,ȮL+O[ 5Z :7 uMyҠIENDB`qdjango-0.4.0/doc/html/QDjangoMetaModel_8h_source.html0000644000175000007640000004556412163016767022576 0ustar sharkyjerryweb QDjango: QDjangoMetaModel.h Source File
QDjangoMetaModel.h
1 /*
2  * Copyright (C) 2010-2013 Jeremy Lainé
3  * Contact: http://code.google.com/p/qdjango/
4  *
5  * This file is part of the QDjango Library.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  */
17 
18 #ifndef QDJANGOMETAMODEL_H
19 #define QDJANGOMETAMODEL_H
20 
21 #include <QMap>
22 #include <QSharedDataPointer>
23 #include <QVariant>
24 
25 #include "QDjango_p.h"
26 
27 class QDjangoMetaFieldPrivate;
28 class QDjangoMetaModelPrivate;
29 
34 class QDJANGO_EXPORT QDjangoMetaField
35 {
36 public:
38  QDjangoMetaField(const QDjangoMetaField &other);
40  QDjangoMetaField& operator=(const QDjangoMetaField &other);
41 
42  QString column() const;
43  bool isAutoIncrement() const;
44  bool isBlank() const;
45  bool isNullable() const;
46  bool isUnique() const;
47  bool isValid() const;
48  QString name() const;
49  int maxLength() const;
50  QVariant toDatabase(const QVariant &value) const;
51 
52 private:
53  QSharedDataPointer<QDjangoMetaFieldPrivate> d;
54  friend class QDjangoMetaModel;
55 };
56 
64 class QDJANGO_EXPORT QDjangoMetaModel
65 {
66 public:
67  QDjangoMetaModel(const QMetaObject *model = 0);
68  QDjangoMetaModel(const QDjangoMetaModel &other);
70  QDjangoMetaModel& operator=(const QDjangoMetaModel &other);
71 
72  bool createTable() const;
73  QStringList createTableSql() const;
74  bool dropTable() const;
75 
76  void load(QObject *model, const QVariantList &props, int &pos) const;
77  bool remove(QObject *model) const;
78  bool save(QObject *model) const;
79 
80  QObject *foreignKey(const QObject *model, const char *name) const;
81  void setForeignKey(QObject *model, const char *name, QObject *value) const;
82 
83  QDjangoMetaField localField(const char *name) const;
84  QList<QDjangoMetaField> localFields() const;
85  QMap<QByteArray, QByteArray> foreignFields() const;
86  QByteArray primaryKey() const;
87  QString table() const;
88 
89 private:
90  QSharedDataPointer<QDjangoMetaModelPrivate> d;
91 };
92 
93 #endif
qdjango-0.4.0/doc/html/classQDjangoModel.html0000644000175000007640000005021712163016767021025 0ustar sharkyjerryweb QDjango: QDjangoModel Class Reference

The QDjangoModel class is the base class for all models. More...

#include <QDjangoModel.h>

Inheritance diagram for QDjangoModel:

Public Slots

bool remove ()
 
bool save ()
 
QString toString () const
 

Public Member Functions

 QDjangoModel (QObject *parent=0)
 
QVariant pk () const
 
void setPk (const QVariant &pk)
 

Protected Member Functions

QObject * foreignKey (const char *name) const
 
void setForeignKey (const char *name, QObject *value)
 

Properties

QVariant pk
 

Detailed Description

The QDjangoModel class is the base class for all models.

To declare your own model, create a class which inherits QDjangoModel and declare the database fields as properties using the Q_PROPERTY macro. You must then register the class with QDjango using QDjango::registerModel().

You can provide options for the model using the Q_CLASSINFO macro as follows:

Q_CLASSINFO("__meta__", "keyword1=value1 .. keywordN=valueN")

The following keywords are recognised for model options:

  • db_table if provided, this is the name of the database table for the model, otherwise the lowercased class name will be used
  • unique_together set of fields that, taken together, must be unique. If provided, a UNIQUE statement is included in the CREATE TABLE statement. Example: unique_together=some_field,other_field

You can also provide additional information about a field using the Q_CLASSINFO macro, in the form:

Q_CLASSINFO("field_name", "keyword1=value1 .. keywordN=valueN")

The following keywords are recognised for field options:

  • auto_increment if set to 'true', and if this field is the primary key, it will be marked as auto-increment.
  • blank if set to 'true', this field is allowed to be empty.
  • db_column if provided, this is the name of the database column for the field, otherwise the field name will be used
  • db_index if set to 'true', an index will be created on this field.
  • ignore_field if set to 'true', this field will be ignored
  • max_length the maximum length of the field (used when creating the database table)
  • null if set to 'true', empty values will be stored as NULL. The default value is 'false'.
  • primary_key if set to 'true', this field will be used as the primary key. If no primary key is explicitly defined, an auto-increment integer field will be added.
  • unique if set to 'true', this field must be unique throughout the table.
  • on_delete if provided, create a foreign key constraint on this field. Accepted values are: 'cascade', 'restrict', and 'set_null'

Constructor & Destructor Documentation

QDjangoModel::QDjangoModel ( QObject *  parent = 0)

Construct a new QDjangoModel.

Parameters
parent

Member Function Documentation

QObject * QDjangoModel::foreignKey ( const char *  name) const
protected

Retrieves the QDjangoModel pointed to by the given foreign-key.

Parameters
name
bool QDjangoModel::remove ( )
slot

Deletes the QDjangoModel from the database.

Returns
true if deletion succeeded, false otherwise
bool QDjangoModel::save ( )
slot

Saves the QDjangoModel to the database.

Returns
true if saving succeeded, false otherwise
void QDjangoModel::setForeignKey ( const char *  name,
QObject *  value 
)
protected

Sets the QDjangoModel pointed to by the given foreign-key.

Parameters
name
value
Note
The current QDjangoModel will take ownership of the given value.
void QDjangoModel::setPk ( const QVariant &  pk)

Sets the primary key for this QDjangoModel.

Parameters
pk
QString QDjangoModel::toString ( ) const
slot

Returns a string representation of the model instance.

Property Documentation

QVariant QDjangoModel::pk
readwrite

Returns the primary key for this QDjangoModel.


The documentation for this class was generated from the following files:
qdjango-0.4.0/doc/html/classQDjangoHttpController-members.html0000644000175000007640000002055212163016767024377 0ustar sharkyjerryweb QDjango: Member List
QDjangoHttpController Member List

This is the complete list of members for QDjangoHttpController, including all inherited members.

getBasicAuth(const QDjangoHttpRequest &request, QString &username, QString &password)QDjangoHttpControllerstatic
httpDateTime(const QDateTime &dt)QDjangoHttpControllerstatic
httpDateTime(const QString &str)QDjangoHttpControllerstatic
serveAuthorizationRequired(const QDjangoHttpRequest &request, const QString &realm=QLatin1String("Secure Area"))QDjangoHttpControllerstatic
serveBadRequest(const QDjangoHttpRequest &request)QDjangoHttpControllerstatic
serveInternalServerError(const QDjangoHttpRequest &request)QDjangoHttpControllerstatic
serveNotFound(const QDjangoHttpRequest &request)QDjangoHttpControllerstatic
serveRedirect(const QDjangoHttpRequest &request, const QUrl &url, bool permanent=false)QDjangoHttpControllerstatic
serveStatic(const QDjangoHttpRequest &request, const QString &filePath, const QDateTime &expires=QDateTime())QDjangoHttpControllerstatic
qdjango-0.4.0/doc/html/ftv2mo.png0000644000175000007640000000062312163016767016524 0ustar sharkyjerrywebPNG  IHDR}\ZIDATx1K@iBҡ(h"EI'oک 8R- BTP]zB3 _㒻}]V}dIiJb+|K…,[P\ʘMƢ#F`JݤkA?Y4ck6"Z)0SHM@㋺Wmo4HJ+Qobt *~8_+3Y- PwA+^}+xhϕMAE]TD~EÞߴ^R)`A9pq-۾ۍ3tƛTH) ICxd#1 m@V?Zgo_3-\IENDB`qdjango-0.4.0/doc/html/ftv2blank.png0000644000175000007640000000012612163016767017176 0ustar sharkyjerrywebPNG  IHDRɪ|IDATxݱðScOx@ y}IENDB`qdjango-0.4.0/doc/html/classQDjangoMetaModel.html0000644000175000007640000005233412163016767021636 0ustar sharkyjerryweb QDjango: QDjangoMetaModel Class Reference
QDjangoMetaModel Class Reference

The QDjangoMetaModel class holds the database schema for a model. More...

#include <QDjangoMetaModel.h>

Public Member Functions

 QDjangoMetaModel (const QMetaObject *model=0)
 Constructs a new QDjangoMetaModel by inspecting the given meta model.
 
 QDjangoMetaModel (const QDjangoMetaModel &other)
 Constructs a copy of other.
 
 ~QDjangoMetaModel ()
 Destroys the meta model.
 
QDjangoMetaModeloperator= (const QDjangoMetaModel &other)
 Assigns other to this meta model.
 
bool createTable () const
 Creates the database table for this QDjangoMetaModel.
 
QStringList createTableSql () const
 Returns the SQL queries to create the database table for this QDjangoMetaModel.
 
bool dropTable () const
 Drops the database table for this QDjangoMetaModel.
 
void load (QObject *model, const QVariantList &props, int &pos) const
 Loads the given properties into a model instance.
 
bool remove (QObject *model) const
 Removes the given model instance from the database.
 
bool save (QObject *model) const
 Saves the given model instance to the database. More...
 
QObject * foreignKey (const QObject *model, const char *name) const
 Retrieves the QDjangoModel pointed to by the given foreign-key. More...
 
void setForeignKey (QObject *model, const char *name, QObject *value) const
 Sets the QDjangoModel pointed to by the given foreign-key. More...
 
QDjangoMetaField localField (const char *name) const
 Return the local field with the specified name.
 
QList< QDjangoMetaFieldlocalFields () const
 Returns the list of local fields.
 
QMap< QByteArray, QByteArray > foreignFields () const
 Returns the foreign field mapping.
 
QByteArray primaryKey () const
 Returns the name of the primary key for the current QDjangoMetaModel.
 
QString table () const
 Returns the name of the database table.
 

Detailed Description

The QDjangoMetaModel class holds the database schema for a model.

It manages table creation and deletion operations as well as row serialisation, deserialisation and deletion operations.

Member Function Documentation

QObject * QDjangoMetaModel::foreignKey ( const QObject *  model,
const char *  name 
) const

Retrieves the QDjangoModel pointed to by the given foreign-key.

Parameters
model
name
bool QDjangoMetaModel::save ( QObject *  model) const

Saves the given model instance to the database.

Returns
true if saving succeeded, false otherwise
void QDjangoMetaModel::setForeignKey ( QObject *  model,
const char *  name,
QObject *  value 
) const

Sets the QDjangoModel pointed to by the given foreign-key.

Parameters
model
name
value

The documentation for this class was generated from the following files:
qdjango-0.4.0/doc/html/functions_type.html0000644000175000007640000001324512163016767020544 0ustar sharkyjerryweb QDjango: Class Members - Typedefs
QDjango
 
qdjango-0.4.0/doc/html/classQDjangoQuerySet_1_1const__iterator.html0000644000175000007640000012015212163016767025321 0ustar sharkyjerryweb QDjango: QDjangoQuerySet< T >::const_iterator Class Reference
QDjangoQuerySet< T >::const_iterator Class Reference

#include <QDjangoQuerySet.h>

Public Types

typedef
std::bidirectional_iterator_tag 
iterator_category
 

Public Member Functions

 const_iterator ()
 
 const_iterator (const const_iterator &other)
 
const T & operator* () const
 
const T * operator-> () const
 
bool operator== (const const_iterator &other) const
 
bool operator!= (const const_iterator &other) const
 
bool operator< (const const_iterator &other) const
 
bool operator<= (const const_iterator &other) const
 
bool operator> (const const_iterator &other) const
 
bool operator>= (const const_iterator &other) const
 
const_iteratoroperator++ ()
 
const_iterator operator++ (int)
 
const_iteratoroperator+= (int i)
 
const_iterator operator+ (int i) const
 
const_iteratoroperator-= (int i)
 
const_iterator operator- (int i) const
 
const_iteratoroperator-- ()
 
const_iterator operator-- (int)
 
difference_type operator- (const const_iterator &other) const
 

Friends

class QDjangoQuerySet
 

Detailed Description

template<class T>
class QDjangoQuerySet< T >::const_iterator

The QDjangoQuerySet::const_iterator class provides an STL-style const iterator for QDjangoQuerySet.

QDjangoQuerySet::const_iterator allows you to iterate over a QDjangoQuerySet. As a const iterator it doesn't permit you to modify the QDjangoQuerySet.

The default QDjangoQuerySet::const_iterator constructor creates an uninitialized iterator. You must initialize it using a QDjangoQuerySet function like QDjangoQuerySet::constBegin(), or QDjangoQuerySet::constEnd() before you can start iterating. Here's a typical loop that prints all the objects stored in a set:

foreach(const Weblog::Post &p, posts) {
cout << p << endl;
}

Member Typedef Documentation

template<class T>
typedef std::bidirectional_iterator_tag QDjangoQuerySet< T >::const_iterator::iterator_category

A synonym for std::bidirectional_iterator_tag indicating this iterator permits bidirectional access.

Constructor & Destructor Documentation

template<class T>
QDjangoQuerySet< T >::const_iterator::const_iterator ( )
inline

Constructs an uninitialized iterator.

Functions like operator*() and operator++() should not be called on an uninitialized iterator. Use const_iterator::operator=() to assign a value to it before using it.

See Also
See also QDjangoQuerySet::constBegin() and QDjangoQuerySet::constEnd().
template<class T>
QDjangoQuerySet< T >::const_iterator::const_iterator ( const const_iterator other)
inline

Constructs a copy of other.

Member Function Documentation

template<class T>
bool QDjangoQuerySet< T >::const_iterator::operator!= ( const const_iterator other) const
inline

Returns true if other points to a different item than this iterator; otherwise returns false.

See Also
operator==()
template<class T>
const T& QDjangoQuerySet< T >::const_iterator::operator* ( ) const
inline

Returns the current item.

See Also
operator->()
template<class T>
const_iterator QDjangoQuerySet< T >::const_iterator::operator+ ( int  i) const
inline

Returns an iterator to the item at i positions forward from this iterator. (If i is negative, the iterator goes backward.)

See Also
operator-() and operator+=()
template<class T>
const_iterator& QDjangoQuerySet< T >::const_iterator::operator++ ( )
inline

The prefix ++ operator (++it) advances the iterator to the next item in the set and returns an iterator to the new current item.

Calling this function on QDjangoQuerySet::end() leads to undefined results.

See Also
operator–()
template<class T>
const_iterator QDjangoQuerySet< T >::const_iterator::operator++ ( int  )
inline

The postfix ++ operator (it++) advances the iterator to the next item in the set and returns an iterator to the previously current item.

Calling this function on QDjangoQuerySet::end() leads to undefined results.

See Also
operator–(int)
template<class T>
const_iterator& QDjangoQuerySet< T >::const_iterator::operator+= ( int  i)
inline

Advances the iterator by i items. (If i is negative, the iterator goes backward.)

See Also
operator-=() and operator+().
template<class T>
const_iterator QDjangoQuerySet< T >::const_iterator::operator- ( int  i) const
inline

Returns an iterator to the item at i positions backward from this iterator. (If i is negative, the iterator goes forward.)

See Also
operator+() and operator-=()
template<class T>
difference_type QDjangoQuerySet< T >::const_iterator::operator- ( const const_iterator other) const
inline

Returns the number of items between the item pointed to by other and the item pointed to by this iterator.

template<class T>
const_iterator& QDjangoQuerySet< T >::const_iterator::operator-- ( )
inline

The prefix – operator (–it) makes the preceding item current and returns an iterator to the new current item.

Calling this function on QDjangoQuerySet::begin() leads to undefined results.

See Also
operator++().
template<class T>
const_iterator QDjangoQuerySet< T >::const_iterator::operator-- ( int  )
inline

The postfix – operator (it–) makes the preceding item current and returns an iterator to the previously current item.

Calling this function on QDjangoQuerySet::begin() leads to undefined results.

See Also
operator++(int).
template<class T>
const_iterator& QDjangoQuerySet< T >::const_iterator::operator-= ( int  i)
inline

Makes the iterator go back by i items. (If i is negative, the iterator goes forward.)

See Also
operator+=() and operator-()
template<class T>
const T* QDjangoQuerySet< T >::const_iterator::operator-> ( ) const
inline

Returns a pointer to the current item.

See Also
operator*()
template<class T>
bool QDjangoQuerySet< T >::const_iterator::operator< ( const const_iterator other) const
inline

Returns true if other points to a position behind this iterator; otherwise returns false.

template<class T>
bool QDjangoQuerySet< T >::const_iterator::operator<= ( const const_iterator other) const
inline

Returns true if other points to a position behind or equal this iterator; otherwise returns false.

template<class T>
bool QDjangoQuerySet< T >::const_iterator::operator== ( const const_iterator other) const
inline

Returns true if other points to the same item as this iterator; otherwise returns false.

See Also
operator!=()
template<class T>
bool QDjangoQuerySet< T >::const_iterator::operator> ( const const_iterator other) const
inline

Returns true if other points to a position before this iterator; otherwise returns false.

template<class T>
bool QDjangoQuerySet< T >::const_iterator::operator>= ( const const_iterator other) const
inline

Returns true if other points to a position before or equal this iterator; otherwise returns false.


The documentation for this class was generated from the following file:
qdjango-0.4.0/doc/html/classQDjangoModel-members.html0000644000175000007640000001676212163016767022464 0ustar sharkyjerryweb QDjango: Member List
QDjangoModel Member List

This is the complete list of members for QDjangoModel, including all inherited members.

foreignKey(const char *name) const QDjangoModelprotected
pkQDjangoModel
pk() const (defined in QDjangoModel)QDjangoModel
QDjangoModel(QObject *parent=0)QDjangoModel
remove()QDjangoModelslot
save()QDjangoModelslot
setForeignKey(const char *name, QObject *value)QDjangoModelprotected
setPk(const QVariant &pk)QDjangoModel
toString() const QDjangoModelslot
qdjango-0.4.0/doc/html/ftv2doc.png0000644000175000007640000000135212163016767016656 0ustar sharkyjerrywebPNG  IHDR}\IDATxMOS[sa?-XZ(PD4 AWbu`b 77wHFCԁ/`voAPqP@ 980 +y^Z9SW\83g3'Nçl_bpV"ֆXd]3xM[1W *PGz/Eg{ aoV:这1$RW,@56-,m/蹖 r5T*S(Vf89u գwa=<{ҡUr+dDF$`zNܮ0Q3~_^N=vpTLT}kqm<?ZhX_ݥ[) `ga_*2`'=F2EP l=8Wv%THqɿ<"GxH{#֫aJmKsVءM^ T ݛr߽m_?Wİ#uIENDB`qdjango-0.4.0/doc/html/QDjangoHttpController_8h_source.html0000644000175000007640000003703512163016767023704 0ustar sharkyjerryweb QDjango: QDjangoHttpController.h Source File
QDjangoHttpController.h
1 /*
2  * Copyright (C) 2010-2012 Jeremy Lainé
3  * Contact: http://code.google.com/p/qdjango/
4  *
5  * This file is part of the QDjango Library.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  */
17 
18 #ifndef QDJANGO_HTTP_CONTROLLER_H
19 #define QDJANGO_HTTP_CONTROLLER_H
20 
21 #include <QDateTime>
22 #include <QString>
23 
24 #include "QDjangoHttp_p.h"
25 
26 class QDjangoHttpRequest;
28 class QUrl;
29 
34 class QDJANGO_EXPORT QDjangoHttpController
35 {
36 public:
37  // get basic authorization credentials
38  static bool getBasicAuth(const QDjangoHttpRequest &request, QString &username, QString &password);
39 
40  // date / time handling
41  static QString httpDateTime(const QDateTime &dt);
42  static QDateTime httpDateTime(const QString &str);
43 
44  // common responses
45  static QDjangoHttpResponse *serveAuthorizationRequired(const QDjangoHttpRequest &request, const QString &realm = QLatin1String("Secure Area"));
46  static QDjangoHttpResponse *serveBadRequest(const QDjangoHttpRequest &request);
47  static QDjangoHttpResponse *serveInternalServerError(const QDjangoHttpRequest &request);
48  static QDjangoHttpResponse *serveNotFound(const QDjangoHttpRequest &request);
49  static QDjangoHttpResponse *serveRedirect(const QDjangoHttpRequest &request, const QUrl &url, bool permanent = false);
50  static QDjangoHttpResponse *serveStatic(const QDjangoHttpRequest &request, const QString &filePath, const QDateTime &expires = QDateTime());
51 
52 private:
53  static QDjangoHttpResponse *serveError(const QDjangoHttpRequest &request, int code, const QString &text);
54 };
55 
56 #endif
qdjango-0.4.0/doc/html/tabs.css0000644000175000007640000000221312163016767016241 0ustar sharkyjerryweb.tabs, .tabs2, .tabs3 { background-image: url('tab_b.png'); width: 100%; z-index: 101; font-size: 13px; font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; } .tabs2 { font-size: 10px; } .tabs3 { font-size: 9px; } .tablist { margin: 0; padding: 0; display: table; } .tablist li { float: left; display: table-cell; background-image: url('tab_b.png'); line-height: 36px; list-style: none; } .tablist a { display: block; padding: 0 20px; font-weight: bold; background-image:url('tab_s.png'); background-repeat:no-repeat; background-position:right; color: #283A5D; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); text-decoration: none; outline: none; } .tabs3 .tablist a { padding: 0 10px; } .tablist a:hover { background-image: url('tab_h.png'); background-repeat:repeat-x; color: #fff; text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); text-decoration: none; } .tablist li.current a { background-image: url('tab_a.png'); background-repeat:repeat-x; color: #fff; text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); } qdjango-0.4.0/doc/html/ftv2ns.png0000644000175000007640000000060412163016767016530 0ustar sharkyjerrywebPNG  IHDR}\KIDATx1K1 G⁂n lE(nࢋMA@ tK%ܕ ]BI%uͅa,e v祫i\tun0oV\$G.&@Y=%$um6'߫9Q\b)0-ZTH`pcsm 5:>ަI F] jgo[ on Ԭvq?\ 6Tee lQ c3*dWTM\rh61F fIENDB`qdjango-0.4.0/doc/html/ftv2folderclosed.png0000644000175000007640000000115012163016767020552 0ustar sharkyjerrywebPNG  IHDR}\/IDATx]MO@~uؐlp]#]PYEC\9y`xC &=qvZv3m؃vLN}}ޝZA@n ONp xKxj8s _[D'yye+ 7#rNlk* 0Ь_d_(Öz=xvhzP-䍒̪u$\DJcB4.:Ϗ-}LE #gN;B6䬜@p&h>p9EEάʑ"un$R"?{<%PNt$߶+^<"2Dqq\ҙaA"ԵP}#Ez{.8i p(ADwDE߂z;Kק8t q:uvvݛvEn{MFXgfZ֝*ߩ:jYq#3SWr'  IENDB`qdjango-0.4.0/doc/html/QDjango_8h_source.html0000644000175000007640000003501212163016767020771 0ustar sharkyjerryweb QDjango: QDjango.h Source File
QDjango.h
1 /*
2  * Copyright (C) 2010-2012 Jeremy Lainé
3  * Contact: http://code.google.com/p/qdjango/
4  *
5  * This file is part of the QDjango Library.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  */
17 
18 #ifndef QDJANGO_H
19 #define QDJANGO_H
20 
21 #include "QDjangoMetaModel.h"
22 
23 class QObject;
24 class QSqlDatabase;
25 class QSqlQuery;
26 class QString;
27 
41 class QDJANGO_EXPORT QDjango
42 {
43 public:
44  static bool createTables();
45  static bool dropTables();
46 
47  static QSqlDatabase database();
48  static void setDatabase(QSqlDatabase database);
49 
50  static bool isDebugEnabled();
51  static void setDebugEnabled(bool enabled);
52 
53  template <class T>
54  static QDjangoMetaModel registerModel();
55 
56 private:
57  // backend specific
58  static QString noLimitSql();
59 
60  static QDjangoMetaModel registerModel(const QMetaObject *meta);
61  static QDjangoMetaModel metaModel(const char *name);
62 
63  friend class QDjangoCompiler;
64  friend class QDjangoModel;
65  friend class QDjangoMetaModel;
66  friend class QDjangoQuerySetPrivate;
67 };
68 
71 template <class T>
72 QDjangoMetaModel QDjango::registerModel()
73 {
74  return registerModel(&T::staticMetaObject);
75 }
76 
77 #endif
qdjango-0.4.0/doc/html/models.html0000644000175000007640000002670212163016767016760 0ustar sharkyjerryweb QDjango: Database models
Database models

Database models are usually created by subclassing the QDjangoModel class.

The following example defines a User model suitable for storing basic account information, and illustrate different types of queries on this model.

Declaring your model

To declare your model, subclass the QDjangoModel class, and define a property using the Q_PROPERTY macro for each database field. You can provide additional information about a field using the Q_CLASSINFO macro:

  • max_length : the maximum length of the field (used when creating the database table)
  • primary_key : if set to 'true', this field will be used as the primary key. If no primary key is explicitly defined, an auto-increment integer field will be added.
#include "QDjangoModel.h"
class User : public QDjangoModel
{
Q_OBJECT
Q_PROPERTY(QString username READ username WRITE setUsername)
Q_PROPERTY(QString password READ password WRITE setPassword)
Q_CLASSINFO("username", "max_length=255")
Q_CLASSINFO("password", "max_length=128")
public:
QString username() const;
void setUsername(const QString &username);
QString password() const;
void setPassword(const QString &password);
private:
QString m_username;
QString m_password;
};

Implementing your model

QString User::username() const
{
return m_username;
}
void User::setUsername(const QString &username)
{
m_username = username;
}
QString User::password() const
{
return m_password;
}
void User::setPassword(const QString &password)
{
m_password = password;
}

Registering and using your model

To make your model available for database operations, you should now register your model using:

QDjango::registerModel<User>();

Once you have set the database (see Database configuration), you will now be able to create model instances and save them to the database:

User *user = new User;
user->setUsername("someuser");
user->setPassword("somepassword");
user->save();

.. or remove them from the database:

user->remove();

You can also perform operations such as filtering or retrieving model instances as described in Making queries.

Using QDjango without QDjangoModel

Although it is recommended you make your models inherit QDjangoModel, it is not strictly necessary. QDjango can in fact handle any QObject-derived class, but you will lose some of the syntactic sugar.

If for instance you defined a SomeObject class which inherits QObject, you can write:

QDjangoMetaModel meta = QDjango::registerModel<SomeObject>();
// prepare a SomeObject instance
SomeObject *obj = new SomeObject;
obj->setSomeProperty("some value");
obj->setOtherProperty("other value");
// save the object
meta.save(obj);
// remove the object from database
meta.remove(obj);
qdjango-0.4.0/doc/html/bdwn.png0000644000175000007640000000022312163016767016235 0ustar sharkyjerrywebPNG  IHDR5ZIDATx DP1lm rj.e D[ɾ|6V3?Ls'(}>+ Kch` ^ލnIENDB`qdjango-0.4.0/doc/html/classQDjangoHttpServer.png0000644000175000007640000000102612163016767021705 0ustar sharkyjerrywebPNG  IHDR{PrPLTEutRNST2IDATxٲ Dϼ$@B7T q_13$Lh%=93+-}M}7{*1R}$@V/I:ыyWٰ}=m~Ɨ^y:9%*Izǽ _~z?&Iml3>x^7NȾ;n`4```````<,3Nh꟰gE/}ZS.ppW쫳={}5,Q$Y0,ϪA3 ];̚q'SMp#Nfp3 Z]vwjrr=j5Ύ^+,\ShޑηV7js4_I,CZgwCVv|o`UgY*JaIENDB`qdjango-0.4.0/doc/html/classes.html0000644000175000007640000001655012163016767017132 0ustar sharkyjerryweb QDjango: Class Index
QDjango
Class Index
qdjango-0.4.0/doc/html/classQDjangoHttpRequest.html0000644000175000007640000003471212163016767022257 0ustar sharkyjerryweb QDjango: QDjangoHttpRequest Class Reference
QDjangoHttpRequest Class Reference

The QDjangoHttpRequest class represents an HTTP request. More...

#include <QDjangoHttpRequest.h>

Public Member Functions

 QDjangoHttpRequest ()
 
 ~QDjangoHttpRequest ()
 
QByteArray body () const
 
QString get (const QString &key) const
 
QString meta (const QString &key) const
 
QString method () const
 
QString path () const
 
QString post (const QString &key) const
 

Friends

class QDjangoFastCgiConnection
 
class QDjangoHttpConnection
 
class QDjangoHttpTestRequest
 

Detailed Description

The QDjangoHttpRequest class represents an HTTP request.

Constructor & Destructor Documentation

QDjangoHttpRequest::QDjangoHttpRequest ( )

Constructs a new HTTP request.

QDjangoHttpRequest::~QDjangoHttpRequest ( )

Destroys the HTTP request.

Member Function Documentation

QByteArray QDjangoHttpRequest::body ( ) const

Returns the raw body of the HTTP request.

QString QDjangoHttpRequest::get ( const QString &  key) const

Returns the GET data for the given key.

QString QDjangoHttpRequest::meta ( const QString &  key) const

Returns the specified HTTP request header.

Parameters
key
QString QDjangoHttpRequest::method ( ) const

Returns the HTTP request's method (e.g. GET, POST).

QString QDjangoHttpRequest::path ( ) const

Returns the HTTP request's path.

QString QDjangoHttpRequest::post ( const QString &  key) const

Returns the POST data for the given key.


The documentation for this class was generated from the following files:
qdjango-0.4.0/doc/html/classQDjango-members.html0000644000175000007640000002035012163016767021467 0ustar sharkyjerryweb QDjango: Member List
QDjango Member List

This is the complete list of members for QDjango, including all inherited members.

createTables()QDjangostatic
database()QDjangostatic
dropTables()QDjangostatic
isDebugEnabled()QDjangostatic
QDjangoCompiler (defined in QDjango)QDjangofriend
QDjangoMetaModel (defined in QDjango)QDjangofriend
QDjangoModel (defined in QDjango)QDjangofriend
QDjangoQuerySetPrivate (defined in QDjango)QDjangofriend
registerModel() (defined in QDjango)QDjangostatic
registerModel()QDjango
setDatabase(QSqlDatabase database)QDjangostatic
setDebugEnabled(bool enabled)QDjangostatic
qdjango-0.4.0/doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html0000644000175000007640000001360312163016767023140 0ustar sharkyjerryweb QDjango: src Directory Reference
src Directory Reference

Directories

directory  db
 
directory  http
 
directory  script
 
qdjango-0.4.0/doc/html/classQDjangoHttpController.html0000644000175000007640000005306212163016767022751 0ustar sharkyjerryweb QDjango: QDjangoHttpController Class Reference
QDjangoHttpController Class Reference

The QDjangoHttpController class provides static methods for replying to HTTP requests. More...

#include <QDjangoHttpController.h>

Static Public Member Functions

static bool getBasicAuth (const QDjangoHttpRequest &request, QString &username, QString &password)
 
static QString httpDateTime (const QDateTime &dt)
 
static QDateTime httpDateTime (const QString &str)
 
static QDjangoHttpResponseserveAuthorizationRequired (const QDjangoHttpRequest &request, const QString &realm=QLatin1String("Secure Area"))
 
static QDjangoHttpResponseserveBadRequest (const QDjangoHttpRequest &request)
 
static QDjangoHttpResponseserveInternalServerError (const QDjangoHttpRequest &request)
 
static QDjangoHttpResponseserveNotFound (const QDjangoHttpRequest &request)
 
static QDjangoHttpResponseserveRedirect (const QDjangoHttpRequest &request, const QUrl &url, bool permanent=false)
 
static QDjangoHttpResponseserveStatic (const QDjangoHttpRequest &request, const QString &filePath, const QDateTime &expires=QDateTime())
 

Detailed Description

The QDjangoHttpController class provides static methods for replying to HTTP requests.

Member Function Documentation

bool QDjangoHttpController::getBasicAuth ( const QDjangoHttpRequest request,
QString &  username,
QString &  password 
)
static

Extract basic credentials from an HTTP request.

Returns true if credentials were provider, false otherwise.

QString QDjangoHttpController::httpDateTime ( const QDateTime &  dt)
static

Converts a QDateTime to an HTTP datetime string.

QDateTime QDjangoHttpController::httpDateTime ( const QString &  str)
static

Converts an HTTP datetime string to a QDateTime.

QDjangoHttpResponse * QDjangoHttpController::serveAuthorizationRequired ( const QDjangoHttpRequest request,
const QString &  realm = QLatin1String("Secure Area") 
)
static

Respond to an HTTP request with an authorization error.

Parameters
request
realm
QDjangoHttpResponse * QDjangoHttpController::serveBadRequest ( const QDjangoHttpRequest request)
static

Respond to a malformed HTTP request.

Parameters
request
QDjangoHttpResponse * QDjangoHttpController::serveInternalServerError ( const QDjangoHttpRequest request)
static

Respond to an HTTP request with an internal server error.

Parameters
request
QDjangoHttpResponse * QDjangoHttpController::serveNotFound ( const QDjangoHttpRequest request)
static

Respond to an HTTP request with a not found error.

Parameters
request
QDjangoHttpResponse * QDjangoHttpController::serveRedirect ( const QDjangoHttpRequest request,
const QUrl &  url,
bool  permanent = false 
)
static

Respond to an HTTP request with a redirect.

Parameters
request
urlThe URL to which the user is redirected.
permanentWhether the redirect is permanent.
QDjangoHttpResponse * QDjangoHttpController::serveStatic ( const QDjangoHttpRequest request,
const QString &  docPath,
const QDateTime &  expires = QDateTime() 
)
static

Respond to an HTTP request for a static file.

Parameters
request
docPathThe path to the document, such that it can be opened using a QFile.
expiresAn optional expiry date.

The documentation for this class was generated from the following files:
qdjango-0.4.0/doc/html/jquery.js0000644000175000007640000031436512163016767016471 0ustar sharkyjerryweb/*! * jQuery JavaScript Library v1.7.1 * http://jquery.com/ * * Copyright 2011, John Resig * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * Includes Sizzle.js * http://sizzlejs.com/ * Copyright 2011, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * * Date: Mon Nov 21 21:11:03 2011 -0500 */ (function(bb,L){var av=bb.document,bu=bb.navigator,bl=bb.location;var b=(function(){var bF=function(b0,b1){return new bF.fn.init(b0,b1,bD)},bU=bb.jQuery,bH=bb.$,bD,bY=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,bM=/\S/,bI=/^\s+/,bE=/\s+$/,bA=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,bN=/^[\],:{}\s]*$/,bW=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,bP=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,bJ=/(?:^|:|,)(?:\s*\[)+/g,by=/(webkit)[ \/]([\w.]+)/,bR=/(opera)(?:.*version)?[ \/]([\w.]+)/,bQ=/(msie) ([\w.]+)/,bS=/(mozilla)(?:.*? rv:([\w.]+))?/,bB=/-([a-z]|[0-9])/ig,bZ=/^-ms-/,bT=function(b0,b1){return(b1+"").toUpperCase()},bX=bu.userAgent,bV,bC,e,bL=Object.prototype.toString,bG=Object.prototype.hasOwnProperty,bz=Array.prototype.push,bK=Array.prototype.slice,bO=String.prototype.trim,bv=Array.prototype.indexOf,bx={};bF.fn=bF.prototype={constructor:bF,init:function(b0,b4,b3){var b2,b5,b1,b6;if(!b0){return this}if(b0.nodeType){this.context=this[0]=b0;this.length=1;return this}if(b0==="body"&&!b4&&av.body){this.context=av;this[0]=av.body;this.selector=b0;this.length=1;return this}if(typeof b0==="string"){if(b0.charAt(0)==="<"&&b0.charAt(b0.length-1)===">"&&b0.length>=3){b2=[null,b0,null]}else{b2=bY.exec(b0)}if(b2&&(b2[1]||!b4)){if(b2[1]){b4=b4 instanceof bF?b4[0]:b4;b6=(b4?b4.ownerDocument||b4:av);b1=bA.exec(b0);if(b1){if(bF.isPlainObject(b4)){b0=[av.createElement(b1[1])];bF.fn.attr.call(b0,b4,true)}else{b0=[b6.createElement(b1[1])]}}else{b1=bF.buildFragment([b2[1]],[b6]);b0=(b1.cacheable?bF.clone(b1.fragment):b1.fragment).childNodes}return bF.merge(this,b0)}else{b5=av.getElementById(b2[2]);if(b5&&b5.parentNode){if(b5.id!==b2[2]){return b3.find(b0)}this.length=1;this[0]=b5}this.context=av;this.selector=b0;return this}}else{if(!b4||b4.jquery){return(b4||b3).find(b0)}else{return this.constructor(b4).find(b0)}}}else{if(bF.isFunction(b0)){return b3.ready(b0)}}if(b0.selector!==L){this.selector=b0.selector;this.context=b0.context}return bF.makeArray(b0,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return bK.call(this,0)},get:function(b0){return b0==null?this.toArray():(b0<0?this[this.length+b0]:this[b0])},pushStack:function(b1,b3,b0){var b2=this.constructor();if(bF.isArray(b1)){bz.apply(b2,b1)}else{bF.merge(b2,b1)}b2.prevObject=this;b2.context=this.context;if(b3==="find"){b2.selector=this.selector+(this.selector?" ":"")+b0}else{if(b3){b2.selector=this.selector+"."+b3+"("+b0+")"}}return b2},each:function(b1,b0){return bF.each(this,b1,b0)},ready:function(b0){bF.bindReady();bC.add(b0);return this},eq:function(b0){b0=+b0;return b0===-1?this.slice(b0):this.slice(b0,b0+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(bK.apply(this,arguments),"slice",bK.call(arguments).join(","))},map:function(b0){return this.pushStack(bF.map(this,function(b2,b1){return b0.call(b2,b1,b2)}))},end:function(){return this.prevObject||this.constructor(null)},push:bz,sort:[].sort,splice:[].splice};bF.fn.init.prototype=bF.fn;bF.extend=bF.fn.extend=function(){var b9,b2,b0,b1,b6,b7,b5=arguments[0]||{},b4=1,b3=arguments.length,b8=false;if(typeof b5==="boolean"){b8=b5;b5=arguments[1]||{};b4=2}if(typeof b5!=="object"&&!bF.isFunction(b5)){b5={}}if(b3===b4){b5=this;--b4}for(;b40){return}bC.fireWith(av,[bF]);if(bF.fn.trigger){bF(av).trigger("ready").off("ready")}}},bindReady:function(){if(bC){return}bC=bF.Callbacks("once memory");if(av.readyState==="complete"){return setTimeout(bF.ready,1)}if(av.addEventListener){av.addEventListener("DOMContentLoaded",e,false);bb.addEventListener("load",bF.ready,false)}else{if(av.attachEvent){av.attachEvent("onreadystatechange",e);bb.attachEvent("onload",bF.ready);var b0=false;try{b0=bb.frameElement==null}catch(b1){}if(av.documentElement.doScroll&&b0){bw()}}}},isFunction:function(b0){return bF.type(b0)==="function"},isArray:Array.isArray||function(b0){return bF.type(b0)==="array"},isWindow:function(b0){return b0&&typeof b0==="object"&&"setInterval" in b0},isNumeric:function(b0){return !isNaN(parseFloat(b0))&&isFinite(b0)},type:function(b0){return b0==null?String(b0):bx[bL.call(b0)]||"object"},isPlainObject:function(b2){if(!b2||bF.type(b2)!=="object"||b2.nodeType||bF.isWindow(b2)){return false}try{if(b2.constructor&&!bG.call(b2,"constructor")&&!bG.call(b2.constructor.prototype,"isPrototypeOf")){return false}}catch(b1){return false}var b0;for(b0 in b2){}return b0===L||bG.call(b2,b0)},isEmptyObject:function(b1){for(var b0 in b1){return false}return true},error:function(b0){throw new Error(b0)},parseJSON:function(b0){if(typeof b0!=="string"||!b0){return null}b0=bF.trim(b0);if(bb.JSON&&bb.JSON.parse){return bb.JSON.parse(b0)}if(bN.test(b0.replace(bW,"@").replace(bP,"]").replace(bJ,""))){return(new Function("return "+b0))()}bF.error("Invalid JSON: "+b0)},parseXML:function(b2){var b0,b1;try{if(bb.DOMParser){b1=new DOMParser();b0=b1.parseFromString(b2,"text/xml")}else{b0=new ActiveXObject("Microsoft.XMLDOM");b0.async="false";b0.loadXML(b2)}}catch(b3){b0=L}if(!b0||!b0.documentElement||b0.getElementsByTagName("parsererror").length){bF.error("Invalid XML: "+b2)}return b0},noop:function(){},globalEval:function(b0){if(b0&&bM.test(b0)){(bb.execScript||function(b1){bb["eval"].call(bb,b1)})(b0)}},camelCase:function(b0){return b0.replace(bZ,"ms-").replace(bB,bT)},nodeName:function(b1,b0){return b1.nodeName&&b1.nodeName.toUpperCase()===b0.toUpperCase()},each:function(b3,b6,b2){var b1,b4=0,b5=b3.length,b0=b5===L||bF.isFunction(b3);if(b2){if(b0){for(b1 in b3){if(b6.apply(b3[b1],b2)===false){break}}}else{for(;b40&&b0[0]&&b0[b1-1])||b1===0||bF.isArray(b0));if(b3){for(;b21?aJ.call(arguments,0):bG;if(!(--bw)){bC.resolveWith(bC,bx)}}}function bz(bF){return function(bG){bB[bF]=arguments.length>1?aJ.call(arguments,0):bG;bC.notifyWith(bE,bB)}}if(e>1){for(;bv
a";bI=bv.getElementsByTagName("*");bF=bv.getElementsByTagName("a")[0];if(!bI||!bI.length||!bF){return{}}bG=av.createElement("select");bx=bG.appendChild(av.createElement("option"));bE=bv.getElementsByTagName("input")[0];bJ={leadingWhitespace:(bv.firstChild.nodeType===3),tbody:!bv.getElementsByTagName("tbody").length,htmlSerialize:!!bv.getElementsByTagName("link").length,style:/top/.test(bF.getAttribute("style")),hrefNormalized:(bF.getAttribute("href")==="/a"),opacity:/^0.55/.test(bF.style.opacity),cssFloat:!!bF.style.cssFloat,checkOn:(bE.value==="on"),optSelected:bx.selected,getSetAttribute:bv.className!=="t",enctype:!!av.createElement("form").enctype,html5Clone:av.createElement("nav").cloneNode(true).outerHTML!=="<:nav>",submitBubbles:true,changeBubbles:true,focusinBubbles:false,deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true};bE.checked=true;bJ.noCloneChecked=bE.cloneNode(true).checked;bG.disabled=true;bJ.optDisabled=!bx.disabled;try{delete bv.test}catch(bC){bJ.deleteExpando=false}if(!bv.addEventListener&&bv.attachEvent&&bv.fireEvent){bv.attachEvent("onclick",function(){bJ.noCloneEvent=false});bv.cloneNode(true).fireEvent("onclick")}bE=av.createElement("input");bE.value="t";bE.setAttribute("type","radio");bJ.radioValue=bE.value==="t";bE.setAttribute("checked","checked");bv.appendChild(bE);bD=av.createDocumentFragment();bD.appendChild(bv.lastChild);bJ.checkClone=bD.cloneNode(true).cloneNode(true).lastChild.checked;bJ.appendChecked=bE.checked;bD.removeChild(bE);bD.appendChild(bv);bv.innerHTML="";if(bb.getComputedStyle){bA=av.createElement("div");bA.style.width="0";bA.style.marginRight="0";bv.style.width="2px";bv.appendChild(bA);bJ.reliableMarginRight=(parseInt((bb.getComputedStyle(bA,null)||{marginRight:0}).marginRight,10)||0)===0}if(bv.attachEvent){for(by in {submit:1,change:1,focusin:1}){bB="on"+by;bw=(bB in bv);if(!bw){bv.setAttribute(bB,"return;");bw=(typeof bv[bB]==="function")}bJ[by+"Bubbles"]=bw}}bD.removeChild(bv);bD=bG=bx=bA=bv=bE=null;b(function(){var bM,bU,bV,bT,bN,bO,bL,bS,bR,e,bP,bQ=av.getElementsByTagName("body")[0];if(!bQ){return}bL=1;bS="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";bR="visibility:hidden;border:0;";e="style='"+bS+"border:5px solid #000;padding:0;'";bP="
";bM=av.createElement("div");bM.style.cssText=bR+"width:0;height:0;position:static;top:0;margin-top:"+bL+"px";bQ.insertBefore(bM,bQ.firstChild);bv=av.createElement("div");bM.appendChild(bv);bv.innerHTML="
t
";bz=bv.getElementsByTagName("td");bw=(bz[0].offsetHeight===0);bz[0].style.display="";bz[1].style.display="none";bJ.reliableHiddenOffsets=bw&&(bz[0].offsetHeight===0);bv.innerHTML="";bv.style.width=bv.style.paddingLeft="1px";b.boxModel=bJ.boxModel=bv.offsetWidth===2;if(typeof bv.style.zoom!=="undefined"){bv.style.display="inline";bv.style.zoom=1;bJ.inlineBlockNeedsLayout=(bv.offsetWidth===2);bv.style.display="";bv.innerHTML="
";bJ.shrinkWrapBlocks=(bv.offsetWidth!==2)}bv.style.cssText=bS+bR;bv.innerHTML=bP;bU=bv.firstChild;bV=bU.firstChild;bN=bU.nextSibling.firstChild.firstChild;bO={doesNotAddBorder:(bV.offsetTop!==5),doesAddBorderForTableAndCells:(bN.offsetTop===5)};bV.style.position="fixed";bV.style.top="20px";bO.fixedPosition=(bV.offsetTop===20||bV.offsetTop===15);bV.style.position=bV.style.top="";bU.style.overflow="hidden";bU.style.position="relative";bO.subtractsBorderForOverflowNotVisible=(bV.offsetTop===-5);bO.doesNotIncludeMarginInBodyOffset=(bQ.offsetTop!==bL);bQ.removeChild(bM);bv=bM=null;b.extend(bJ,bO)});return bJ})();var aS=/^(?:\{.*\}|\[.*\])$/,aA=/([A-Z])/g;b.extend({cache:{},uuid:0,expando:"jQuery"+(b.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},hasData:function(e){e=e.nodeType?b.cache[e[b.expando]]:e[b.expando];return !!e&&!S(e)},data:function(bx,bv,bz,by){if(!b.acceptData(bx)){return}var bG,bA,bD,bE=b.expando,bC=typeof bv==="string",bF=bx.nodeType,e=bF?b.cache:bx,bw=bF?bx[bE]:bx[bE]&&bE,bB=bv==="events";if((!bw||!e[bw]||(!bB&&!by&&!e[bw].data))&&bC&&bz===L){return}if(!bw){if(bF){bx[bE]=bw=++b.uuid}else{bw=bE}}if(!e[bw]){e[bw]={};if(!bF){e[bw].toJSON=b.noop}}if(typeof bv==="object"||typeof bv==="function"){if(by){e[bw]=b.extend(e[bw],bv)}else{e[bw].data=b.extend(e[bw].data,bv)}}bG=bA=e[bw];if(!by){if(!bA.data){bA.data={}}bA=bA.data}if(bz!==L){bA[b.camelCase(bv)]=bz}if(bB&&!bA[bv]){return bG.events}if(bC){bD=bA[bv];if(bD==null){bD=bA[b.camelCase(bv)]}}else{bD=bA}return bD},removeData:function(bx,bv,by){if(!b.acceptData(bx)){return}var bB,bA,bz,bC=b.expando,bD=bx.nodeType,e=bD?b.cache:bx,bw=bD?bx[bC]:bC;if(!e[bw]){return}if(bv){bB=by?e[bw]:e[bw].data;if(bB){if(!b.isArray(bv)){if(bv in bB){bv=[bv]}else{bv=b.camelCase(bv);if(bv in bB){bv=[bv]}else{bv=bv.split(" ")}}}for(bA=0,bz=bv.length;bA-1){return true}}return false},val:function(bx){var e,bv,by,bw=this[0];if(!arguments.length){if(bw){e=b.valHooks[bw.nodeName.toLowerCase()]||b.valHooks[bw.type];if(e&&"get" in e&&(bv=e.get(bw,"value"))!==L){return bv}bv=bw.value;return typeof bv==="string"?bv.replace(aU,""):bv==null?"":bv}return}by=b.isFunction(bx);return this.each(function(bA){var bz=b(this),bB;if(this.nodeType!==1){return}if(by){bB=bx.call(this,bA,bz.val())}else{bB=bx}if(bB==null){bB=""}else{if(typeof bB==="number"){bB+=""}else{if(b.isArray(bB)){bB=b.map(bB,function(bC){return bC==null?"":bC+""})}}}e=b.valHooks[this.nodeName.toLowerCase()]||b.valHooks[this.type];if(!e||!("set" in e)||e.set(this,bB,"value")===L){this.value=bB}})}});b.extend({valHooks:{option:{get:function(e){var bv=e.attributes.value;return !bv||bv.specified?e.value:e.text}},select:{get:function(e){var bA,bv,bz,bx,by=e.selectedIndex,bB=[],bC=e.options,bw=e.type==="select-one";if(by<0){return null}bv=bw?by:0;bz=bw?by+1:bC.length;for(;bv=0});if(!e.length){bv.selectedIndex=-1}return e}}},attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(bA,bx,bB,bz){var bw,e,by,bv=bA.nodeType; if(!bA||bv===3||bv===8||bv===2){return}if(bz&&bx in b.attrFn){return b(bA)[bx](bB)}if(typeof bA.getAttribute==="undefined"){return b.prop(bA,bx,bB)}by=bv!==1||!b.isXMLDoc(bA);if(by){bx=bx.toLowerCase();e=b.attrHooks[bx]||(ao.test(bx)?aY:be)}if(bB!==L){if(bB===null){b.removeAttr(bA,bx);return}else{if(e&&"set" in e&&by&&(bw=e.set(bA,bB,bx))!==L){return bw}else{bA.setAttribute(bx,""+bB);return bB}}}else{if(e&&"get" in e&&by&&(bw=e.get(bA,bx))!==null){return bw}else{bw=bA.getAttribute(bx);return bw===null?L:bw}}},removeAttr:function(bx,bz){var by,bA,bv,e,bw=0;if(bz&&bx.nodeType===1){bA=bz.toLowerCase().split(af);e=bA.length;for(;bw=0)}}})});var bd=/^(?:textarea|input|select)$/i,n=/^([^\.]*)?(?:\.(.+))?$/,J=/\bhover(\.\S+)?\b/,aO=/^key/,bf=/^(?:mouse|contextmenu)|click/,T=/^(?:focusinfocus|focusoutblur)$/,U=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,Y=function(e){var bv=U.exec(e);if(bv){bv[1]=(bv[1]||"").toLowerCase();bv[3]=bv[3]&&new RegExp("(?:^|\\s)"+bv[3]+"(?:\\s|$)")}return bv},j=function(bw,e){var bv=bw.attributes||{};return((!e[1]||bw.nodeName.toLowerCase()===e[1])&&(!e[2]||(bv.id||{}).value===e[2])&&(!e[3]||e[3].test((bv["class"]||{}).value)))},bt=function(e){return b.event.special.hover?e:e.replace(J,"mouseenter$1 mouseleave$1")};b.event={add:function(bx,bC,bJ,bA,by){var bD,bB,bK,bI,bH,bF,e,bG,bv,bz,bw,bE;if(bx.nodeType===3||bx.nodeType===8||!bC||!bJ||!(bD=b._data(bx))){return}if(bJ.handler){bv=bJ;bJ=bv.handler}if(!bJ.guid){bJ.guid=b.guid++}bK=bD.events;if(!bK){bD.events=bK={}}bB=bD.handle;if(!bB){bD.handle=bB=function(bL){return typeof b!=="undefined"&&(!bL||b.event.triggered!==bL.type)?b.event.dispatch.apply(bB.elem,arguments):L};bB.elem=bx}bC=b.trim(bt(bC)).split(" ");for(bI=0;bI=0){bG=bG.slice(0,-1);bw=true}if(bG.indexOf(".")>=0){bx=bG.split(".");bG=bx.shift();bx.sort()}if((!bA||b.event.customEvent[bG])&&!b.event.global[bG]){return}bv=typeof bv==="object"?bv[b.expando]?bv:new b.Event(bG,bv):new b.Event(bG);bv.type=bG;bv.isTrigger=true;bv.exclusive=bw;bv.namespace=bx.join(".");bv.namespace_re=bv.namespace?new RegExp("(^|\\.)"+bx.join("\\.(?:.*\\.)?")+"(\\.|$)"):null;by=bG.indexOf(":")<0?"on"+bG:"";if(!bA){e=b.cache;for(bC in e){if(e[bC].events&&e[bC].events[bG]){b.event.trigger(bv,bD,e[bC].handle.elem,true)}}return}bv.result=L;if(!bv.target){bv.target=bA}bD=bD!=null?b.makeArray(bD):[];bD.unshift(bv);bF=b.event.special[bG]||{};if(bF.trigger&&bF.trigger.apply(bA,bD)===false){return}bB=[[bA,bF.bindType||bG]];if(!bJ&&!bF.noBubble&&!b.isWindow(bA)){bI=bF.delegateType||bG;bH=T.test(bI+bG)?bA:bA.parentNode;bz=null;for(;bH;bH=bH.parentNode){bB.push([bH,bI]);bz=bH}if(bz&&bz===bA.ownerDocument){bB.push([bz.defaultView||bz.parentWindow||bb,bI])}}for(bC=0;bCbA){bH.push({elem:this,matches:bz.slice(bA)})}for(bC=0;bC0?this.on(e,null,bx,bw):this.trigger(e)};if(b.attrFn){b.attrFn[e]=true}if(aO.test(e)){b.event.fixHooks[e]=b.event.keyHooks}if(bf.test(e)){b.event.fixHooks[e]=b.event.mouseHooks}}); /*! * Sizzle CSS Selector Engine * Copyright 2011, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * More information: http://sizzlejs.com/ */ (function(){var bH=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,bC="sizcache"+(Math.random()+"").replace(".",""),bI=0,bL=Object.prototype.toString,bB=false,bA=true,bK=/\\/g,bO=/\r\n/g,bQ=/\W/;[0,0].sort(function(){bA=false;return 0});var by=function(bV,e,bY,bZ){bY=bY||[];e=e||av;var b1=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!bV||typeof bV!=="string"){return bY}var bS,b3,b6,bR,b2,b5,b4,bX,bU=true,bT=by.isXML(e),bW=[],b0=bV;do{bH.exec("");bS=bH.exec(b0);if(bS){b0=bS[3];bW.push(bS[1]);if(bS[2]){bR=bS[3];break}}}while(bS);if(bW.length>1&&bD.exec(bV)){if(bW.length===2&&bE.relative[bW[0]]){b3=bM(bW[0]+bW[1],e,bZ)}else{b3=bE.relative[bW[0]]?[e]:by(bW.shift(),e);while(bW.length){bV=bW.shift();if(bE.relative[bV]){bV+=bW.shift()}b3=bM(bV,b3,bZ)}}}else{if(!bZ&&bW.length>1&&e.nodeType===9&&!bT&&bE.match.ID.test(bW[0])&&!bE.match.ID.test(bW[bW.length-1])){b2=by.find(bW.shift(),e,bT);e=b2.expr?by.filter(b2.expr,b2.set)[0]:b2.set[0]}if(e){b2=bZ?{expr:bW.pop(),set:bF(bZ)}:by.find(bW.pop(),bW.length===1&&(bW[0]==="~"||bW[0]==="+")&&e.parentNode?e.parentNode:e,bT);b3=b2.expr?by.filter(b2.expr,b2.set):b2.set;if(bW.length>0){b6=bF(b3)}else{bU=false}while(bW.length){b5=bW.pop();b4=b5;if(!bE.relative[b5]){b5=""}else{b4=bW.pop()}if(b4==null){b4=e}bE.relative[b5](b6,b4,bT)}}else{b6=bW=[]}}if(!b6){b6=b3}if(!b6){by.error(b5||bV)}if(bL.call(b6)==="[object Array]"){if(!bU){bY.push.apply(bY,b6)}else{if(e&&e.nodeType===1){for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&(b6[bX]===true||b6[bX].nodeType===1&&by.contains(e,b6[bX]))){bY.push(b3[bX])}}}else{for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&b6[bX].nodeType===1){bY.push(b3[bX])}}}}}else{bF(b6,bY)}if(bR){by(bR,b1,bY,bZ);by.uniqueSort(bY)}return bY};by.uniqueSort=function(bR){if(bJ){bB=bA;bR.sort(bJ);if(bB){for(var e=1;e0};by.find=function(bX,e,bY){var bW,bS,bU,bT,bV,bR;if(!bX){return[]}for(bS=0,bU=bE.order.length;bS":function(bW,bR){var bV,bU=typeof bR==="string",bS=0,e=bW.length;if(bU&&!bQ.test(bR)){bR=bR.toLowerCase();for(;bS=0)){if(!bS){e.push(bV)}}else{if(bS){bR[bU]=false}}}}return false},ID:function(e){return e[1].replace(bK,"")},TAG:function(bR,e){return bR[1].replace(bK,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){if(!e[2]){by.error(e[0])}e[2]=e[2].replace(/^\+|\s*/g,"");var bR=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(bR[1]+(bR[2]||1))-0;e[3]=bR[3]-0}else{if(e[2]){by.error(e[0])}}e[0]=bI++;return e},ATTR:function(bU,bR,bS,e,bV,bW){var bT=bU[1]=bU[1].replace(bK,"");if(!bW&&bE.attrMap[bT]){bU[1]=bE.attrMap[bT]}bU[4]=(bU[4]||bU[5]||"").replace(bK,"");if(bU[2]==="~="){bU[4]=" "+bU[4]+" "}return bU},PSEUDO:function(bU,bR,bS,e,bV){if(bU[1]==="not"){if((bH.exec(bU[3])||"").length>1||/^\w/.test(bU[3])){bU[3]=by(bU[3],null,null,bR)}else{var bT=by.filter(bU[3],bR,bS,true^bV);if(!bS){e.push.apply(e,bT)}return false}}else{if(bE.match.POS.test(bU[0])||bE.match.CHILD.test(bU[0])){return true}}return bU},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(bS,bR,e){return !!by(e[3],bS).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(bS){var e=bS.getAttribute("type"),bR=bS.type;return bS.nodeName.toLowerCase()==="input"&&"text"===bR&&(e===bR||e===null)},radio:function(e){return e.nodeName.toLowerCase()==="input"&&"radio"===e.type},checkbox:function(e){return e.nodeName.toLowerCase()==="input"&&"checkbox"===e.type},file:function(e){return e.nodeName.toLowerCase()==="input"&&"file"===e.type},password:function(e){return e.nodeName.toLowerCase()==="input"&&"password"===e.type},submit:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"submit"===bR.type},image:function(e){return e.nodeName.toLowerCase()==="input"&&"image"===e.type},reset:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"reset"===bR.type},button:function(bR){var e=bR.nodeName.toLowerCase();return e==="input"&&"button"===bR.type||e==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)},focus:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(bR,e){return e===0},last:function(bS,bR,e,bT){return bR===bT.length-1},even:function(bR,e){return e%2===0},odd:function(bR,e){return e%2===1 },lt:function(bS,bR,e){return bRe[3]-0},nth:function(bS,bR,e){return e[3]-0===bR},eq:function(bS,bR,e){return e[3]-0===bR}},filter:{PSEUDO:function(bS,bX,bW,bY){var e=bX[1],bR=bE.filters[e];if(bR){return bR(bS,bW,bX,bY)}else{if(e==="contains"){return(bS.textContent||bS.innerText||bw([bS])||"").indexOf(bX[3])>=0}else{if(e==="not"){var bT=bX[3];for(var bV=0,bU=bT.length;bV=0)}}},ID:function(bR,e){return bR.nodeType===1&&bR.getAttribute("id")===e},TAG:function(bR,e){return(e==="*"&&bR.nodeType===1)||!!bR.nodeName&&bR.nodeName.toLowerCase()===e},CLASS:function(bR,e){return(" "+(bR.className||bR.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(bV,bT){var bS=bT[1],e=by.attr?by.attr(bV,bS):bE.attrHandle[bS]?bE.attrHandle[bS](bV):bV[bS]!=null?bV[bS]:bV.getAttribute(bS),bW=e+"",bU=bT[2],bR=bT[4];return e==null?bU==="!=":!bU&&by.attr?e!=null:bU==="="?bW===bR:bU==="*="?bW.indexOf(bR)>=0:bU==="~="?(" "+bW+" ").indexOf(bR)>=0:!bR?bW&&e!==false:bU==="!="?bW!==bR:bU==="^="?bW.indexOf(bR)===0:bU==="$="?bW.substr(bW.length-bR.length)===bR:bU==="|="?bW===bR||bW.substr(0,bR.length+1)===bR+"-":false},POS:function(bU,bR,bS,bV){var e=bR[2],bT=bE.setFilters[e];if(bT){return bT(bU,bS,bR,bV)}}}};var bD=bE.match.POS,bx=function(bR,e){return"\\"+(e-0+1)};for(var bz in bE.match){bE.match[bz]=new RegExp(bE.match[bz].source+(/(?![^\[]*\])(?![^\(]*\))/.source));bE.leftMatch[bz]=new RegExp(/(^(?:.|\r|\n)*?)/.source+bE.match[bz].source.replace(/\\(\d+)/g,bx))}var bF=function(bR,e){bR=Array.prototype.slice.call(bR,0);if(e){e.push.apply(e,bR);return e}return bR};try{Array.prototype.slice.call(av.documentElement.childNodes,0)[0].nodeType}catch(bP){bF=function(bU,bT){var bS=0,bR=bT||[];if(bL.call(bU)==="[object Array]"){Array.prototype.push.apply(bR,bU)}else{if(typeof bU.length==="number"){for(var e=bU.length;bS";e.insertBefore(bR,e.firstChild);if(av.getElementById(bS)){bE.find.ID=function(bU,bV,bW){if(typeof bV.getElementById!=="undefined"&&!bW){var bT=bV.getElementById(bU[1]);return bT?bT.id===bU[1]||typeof bT.getAttributeNode!=="undefined"&&bT.getAttributeNode("id").nodeValue===bU[1]?[bT]:L:[]}};bE.filter.ID=function(bV,bT){var bU=typeof bV.getAttributeNode!=="undefined"&&bV.getAttributeNode("id");return bV.nodeType===1&&bU&&bU.nodeValue===bT}}e.removeChild(bR);e=bR=null})();(function(){var e=av.createElement("div");e.appendChild(av.createComment(""));if(e.getElementsByTagName("*").length>0){bE.find.TAG=function(bR,bV){var bU=bV.getElementsByTagName(bR[1]);if(bR[1]==="*"){var bT=[];for(var bS=0;bU[bS];bS++){if(bU[bS].nodeType===1){bT.push(bU[bS])}}bU=bT}return bU}}e.innerHTML="";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){bE.attrHandle.href=function(bR){return bR.getAttribute("href",2)}}e=null})();if(av.querySelectorAll){(function(){var e=by,bT=av.createElement("div"),bS="__sizzle__";bT.innerHTML="

";if(bT.querySelectorAll&&bT.querySelectorAll(".TEST").length===0){return}by=function(b4,bV,bZ,b3){bV=bV||av;if(!b3&&!by.isXML(bV)){var b2=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b4);if(b2&&(bV.nodeType===1||bV.nodeType===9)){if(b2[1]){return bF(bV.getElementsByTagName(b4),bZ)}else{if(b2[2]&&bE.find.CLASS&&bV.getElementsByClassName){return bF(bV.getElementsByClassName(b2[2]),bZ)}}}if(bV.nodeType===9){if(b4==="body"&&bV.body){return bF([bV.body],bZ)}else{if(b2&&b2[3]){var bY=bV.getElementById(b2[3]);if(bY&&bY.parentNode){if(bY.id===b2[3]){return bF([bY],bZ)}}else{return bF([],bZ)}}}try{return bF(bV.querySelectorAll(b4),bZ)}catch(b0){}}else{if(bV.nodeType===1&&bV.nodeName.toLowerCase()!=="object"){var bW=bV,bX=bV.getAttribute("id"),bU=bX||bS,b6=bV.parentNode,b5=/^\s*[+~]/.test(b4);if(!bX){bV.setAttribute("id",bU)}else{bU=bU.replace(/'/g,"\\$&")}if(b5&&b6){bV=bV.parentNode}try{if(!b5||b6){return bF(bV.querySelectorAll("[id='"+bU+"'] "+b4),bZ)}}catch(b1){}finally{if(!bX){bW.removeAttribute("id")}}}}}return e(b4,bV,bZ,b3)};for(var bR in e){by[bR]=e[bR]}bT=null})()}(function(){var e=av.documentElement,bS=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(bS){var bU=!bS.call(av.createElement("div"),"div"),bR=false;try{bS.call(av.documentElement,"[test!='']:sizzle")}catch(bT){bR=true}by.matchesSelector=function(bW,bY){bY=bY.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!by.isXML(bW)){try{if(bR||!bE.match.PSEUDO.test(bY)&&!/!=/.test(bY)){var bV=bS.call(bW,bY);if(bV||!bU||bW.document&&bW.document.nodeType!==11){return bV}}}catch(bX){}}return by(bY,null,null,[bW]).length>0}}})();(function(){var e=av.createElement("div");e.innerHTML="
";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}bE.order.splice(1,0,"CLASS");bE.find.CLASS=function(bR,bS,bT){if(typeof bS.getElementsByClassName!=="undefined"&&!bT){return bS.getElementsByClassName(bR[1])}};e=null})();function bv(bR,bW,bV,bZ,bX,bY){for(var bT=0,bS=bZ.length;bT0){bU=e;break}}}e=e[bR]}bZ[bT]=bU}}}if(av.documentElement.contains){by.contains=function(bR,e){return bR!==e&&(bR.contains?bR.contains(e):true)}}else{if(av.documentElement.compareDocumentPosition){by.contains=function(bR,e){return !!(bR.compareDocumentPosition(e)&16)}}else{by.contains=function(){return false}}}by.isXML=function(e){var bR=(e?e.ownerDocument||e:0).documentElement;return bR?bR.nodeName!=="HTML":false};var bM=function(bS,e,bW){var bV,bX=[],bU="",bY=e.nodeType?[e]:e;while((bV=bE.match.PSEUDO.exec(bS))){bU+=bV[0];bS=bS.replace(bE.match.PSEUDO,"")}bS=bE.relative[bS]?bS+"*":bS;for(var bT=0,bR=bY.length;bT0){for(bB=bA;bB=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(by,bx){var bv=[],bw,e,bz=this[0];if(b.isArray(by)){var bB=1;while(bz&&bz.ownerDocument&&bz!==bx){for(bw=0;bw-1:b.find.matchesSelector(bz,by)){bv.push(bz);break}else{bz=bz.parentNode;if(!bz||!bz.ownerDocument||bz===bx||bz.nodeType===11){break}}}}bv=bv.length>1?b.unique(bv):bv;return this.pushStack(bv,"closest",by)},index:function(e){if(!e){return(this[0]&&this[0].parentNode)?this.prevAll().length:-1}if(typeof e==="string"){return b.inArray(this[0],b(e))}return b.inArray(e.jquery?e[0]:e,this)},add:function(e,bv){var bx=typeof e==="string"?b(e,bv):b.makeArray(e&&e.nodeType?[e]:e),bw=b.merge(this.get(),bx);return this.pushStack(C(bx[0])||C(bw[0])?bw:b.unique(bw))},andSelf:function(){return this.add(this.prevObject)}});function C(e){return !e||!e.parentNode||e.parentNode.nodeType===11}b.each({parent:function(bv){var e=bv.parentNode;return e&&e.nodeType!==11?e:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(bv,e,bw){return b.dir(bv,"parentNode",bw)},next:function(e){return b.nth(e,2,"nextSibling")},prev:function(e){return b.nth(e,2,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(bv,e,bw){return b.dir(bv,"nextSibling",bw)},prevUntil:function(bv,e,bw){return b.dir(bv,"previousSibling",bw)},siblings:function(e){return b.sibling(e.parentNode.firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.makeArray(e.childNodes)}},function(e,bv){b.fn[e]=function(by,bw){var bx=b.map(this,bv,by);if(!ab.test(e)){bw=by}if(bw&&typeof bw==="string"){bx=b.filter(bw,bx)}bx=this.length>1&&!ay[e]?b.unique(bx):bx;if((this.length>1||a9.test(bw))&&aq.test(e)){bx=bx.reverse()}return this.pushStack(bx,e,P.call(arguments).join(","))}});b.extend({filter:function(bw,e,bv){if(bv){bw=":not("+bw+")"}return e.length===1?b.find.matchesSelector(e[0],bw)?[e[0]]:[]:b.find.matches(bw,e)},dir:function(bw,bv,by){var e=[],bx=bw[bv];while(bx&&bx.nodeType!==9&&(by===L||bx.nodeType!==1||!b(bx).is(by))){if(bx.nodeType===1){e.push(bx)}bx=bx[bv]}return e},nth:function(by,e,bw,bx){e=e||1;var bv=0;for(;by;by=by[bw]){if(by.nodeType===1&&++bv===e){break}}return by},sibling:function(bw,bv){var e=[];for(;bw;bw=bw.nextSibling){if(bw.nodeType===1&&bw!==bv){e.push(bw)}}return e}});function aG(bx,bw,e){bw=bw||0;if(b.isFunction(bw)){return b.grep(bx,function(bz,by){var bA=!!bw.call(bz,by,bz);return bA===e})}else{if(bw.nodeType){return b.grep(bx,function(bz,by){return(bz===bw)===e})}else{if(typeof bw==="string"){var bv=b.grep(bx,function(by){return by.nodeType===1});if(bp.test(bw)){return b.filter(bw,bv,!e)}else{bw=b.filter(bw,bv)}}}}return b.grep(bx,function(bz,by){return(b.inArray(bz,bw)>=0)===e})}function a(e){var bw=aR.split("|"),bv=e.createDocumentFragment();if(bv.createElement){while(bw.length){bv.createElement(bw.pop())}}return bv}var aR="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ag=/ jQuery\d+="(?:\d+|null)"/g,ar=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,d=/<([\w:]+)/,w=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},ac=a(av); ax.optgroup=ax.option;ax.tbody=ax.tfoot=ax.colgroup=ax.caption=ax.thead;ax.th=ax.td;if(!b.support.htmlSerialize){ax._default=[1,"div
","
"]}b.fn.extend({text:function(e){if(b.isFunction(e)){return this.each(function(bw){var bv=b(this);bv.text(e.call(this,bw,bv.text()))})}if(typeof e!=="object"&&e!==L){return this.empty().append((this[0]&&this[0].ownerDocument||av).createTextNode(e))}return b.text(this)},wrapAll:function(e){if(b.isFunction(e)){return this.each(function(bw){b(this).wrapAll(e.call(this,bw))})}if(this[0]){var bv=b(e,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){bv.insertBefore(this[0])}bv.map(function(){var bw=this;while(bw.firstChild&&bw.firstChild.nodeType===1){bw=bw.firstChild}return bw}).append(this)}return this},wrapInner:function(e){if(b.isFunction(e)){return this.each(function(bv){b(this).wrapInner(e.call(this,bv))})}return this.each(function(){var bv=b(this),bw=bv.contents();if(bw.length){bw.wrapAll(e)}else{bv.append(e)}})},wrap:function(e){var bv=b.isFunction(e);return this.each(function(bw){b(this).wrapAll(bv?e.call(this,bw):e)})},unwrap:function(){return this.parent().each(function(){if(!b.nodeName(this,"body")){b(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.appendChild(e)}})},prepend:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.insertBefore(e,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this)})}else{if(arguments.length){var e=b.clean(arguments);e.push.apply(e,this.toArray());return this.pushStack(e,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this.nextSibling)})}else{if(arguments.length){var e=this.pushStack(this,"after",arguments);e.push.apply(e,b.clean(arguments));return e}}},remove:function(e,bx){for(var bv=0,bw;(bw=this[bv])!=null;bv++){if(!e||b.filter(e,[bw]).length){if(!bx&&bw.nodeType===1){b.cleanData(bw.getElementsByTagName("*"));b.cleanData([bw])}if(bw.parentNode){bw.parentNode.removeChild(bw)}}}return this},empty:function(){for(var e=0,bv;(bv=this[e])!=null;e++){if(bv.nodeType===1){b.cleanData(bv.getElementsByTagName("*"))}while(bv.firstChild){bv.removeChild(bv.firstChild)}}return this},clone:function(bv,e){bv=bv==null?false:bv;e=e==null?bv:e;return this.map(function(){return b.clone(this,bv,e)})},html:function(bx){if(bx===L){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(ag,""):null}else{if(typeof bx==="string"&&!ae.test(bx)&&(b.support.leadingWhitespace||!ar.test(bx))&&!ax[(d.exec(bx)||["",""])[1].toLowerCase()]){bx=bx.replace(R,"<$1>");try{for(var bw=0,bv=this.length;bw1&&bw0?this.clone(true):this).get();b(bC[bA])[bv](by);bz=bz.concat(by)}return this.pushStack(bz,e,bC.selector)}}});function bg(e){if(typeof e.getElementsByTagName!=="undefined"){return e.getElementsByTagName("*")}else{if(typeof e.querySelectorAll!=="undefined"){return e.querySelectorAll("*")}else{return[]}}}function az(e){if(e.type==="checkbox"||e.type==="radio"){e.defaultChecked=e.checked}}function E(e){var bv=(e.nodeName||"").toLowerCase();if(bv==="input"){az(e)}else{if(bv!=="script"&&typeof e.getElementsByTagName!=="undefined"){b.grep(e.getElementsByTagName("input"),az)}}}function al(e){var bv=av.createElement("div");ac.appendChild(bv);bv.innerHTML=e.outerHTML;return bv.firstChild}b.extend({clone:function(by,bA,bw){var e,bv,bx,bz=b.support.html5Clone||!ah.test("<"+by.nodeName)?by.cloneNode(true):al(by);if((!b.support.noCloneEvent||!b.support.noCloneChecked)&&(by.nodeType===1||by.nodeType===11)&&!b.isXMLDoc(by)){ai(by,bz);e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){if(bv[bx]){ai(e[bx],bv[bx])}}}if(bA){t(by,bz);if(bw){e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){t(e[bx],bv[bx])}}}e=bv=null;return bz},clean:function(bw,by,bH,bA){var bF;by=by||av;if(typeof by.createElement==="undefined"){by=by.ownerDocument||by[0]&&by[0].ownerDocument||av}var bI=[],bB;for(var bE=0,bz;(bz=bw[bE])!=null;bE++){if(typeof bz==="number"){bz+=""}if(!bz){continue}if(typeof bz==="string"){if(!W.test(bz)){bz=by.createTextNode(bz)}else{bz=bz.replace(R,"<$1>");var bK=(d.exec(bz)||["",""])[1].toLowerCase(),bx=ax[bK]||ax._default,bD=bx[0],bv=by.createElement("div");if(by===av){ac.appendChild(bv)}else{a(by).appendChild(bv)}bv.innerHTML=bx[1]+bz+bx[2];while(bD--){bv=bv.lastChild}if(!b.support.tbody){var e=w.test(bz),bC=bK==="table"&&!e?bv.firstChild&&bv.firstChild.childNodes:bx[1]===""&&!e?bv.childNodes:[];for(bB=bC.length-1;bB>=0;--bB){if(b.nodeName(bC[bB],"tbody")&&!bC[bB].childNodes.length){bC[bB].parentNode.removeChild(bC[bB])}}}if(!b.support.leadingWhitespace&&ar.test(bz)){bv.insertBefore(by.createTextNode(ar.exec(bz)[0]),bv.firstChild)}bz=bv.childNodes}}var bG;if(!b.support.appendChecked){if(bz[0]&&typeof(bG=bz.length)==="number"){for(bB=0;bB=0){return bx+"px"}}else{return bx}}}});if(!b.support.opacity){b.cssHooks.opacity={get:function(bv,e){return au.test((e&&bv.currentStyle?bv.currentStyle.filter:bv.style.filter)||"")?(parseFloat(RegExp.$1)/100)+"":e?"1":""},set:function(by,bz){var bx=by.style,bv=by.currentStyle,e=b.isNumeric(bz)?"alpha(opacity="+bz*100+")":"",bw=bv&&bv.filter||bx.filter||"";bx.zoom=1;if(bz>=1&&b.trim(bw.replace(ak,""))===""){bx.removeAttribute("filter");if(bv&&!bv.filter){return}}bx.filter=ak.test(bw)?bw.replace(ak,e):bw+" "+e}}}b(function(){if(!b.support.reliableMarginRight){b.cssHooks.marginRight={get:function(bw,bv){var e;b.swap(bw,{display:"inline-block"},function(){if(bv){e=Z(bw,"margin-right","marginRight")}else{e=bw.style.marginRight}});return e}}}});if(av.defaultView&&av.defaultView.getComputedStyle){aI=function(by,bw){var bv,bx,e;bw=bw.replace(z,"-$1").toLowerCase();if((bx=by.ownerDocument.defaultView)&&(e=bx.getComputedStyle(by,null))){bv=e.getPropertyValue(bw);if(bv===""&&!b.contains(by.ownerDocument.documentElement,by)){bv=b.style(by,bw)}}return bv}}if(av.documentElement.currentStyle){aX=function(bz,bw){var bA,e,by,bv=bz.currentStyle&&bz.currentStyle[bw],bx=bz.style;if(bv===null&&bx&&(by=bx[bw])){bv=by}if(!bc.test(bv)&&bn.test(bv)){bA=bx.left;e=bz.runtimeStyle&&bz.runtimeStyle.left;if(e){bz.runtimeStyle.left=bz.currentStyle.left}bx.left=bw==="fontSize"?"1em":(bv||0);bv=bx.pixelLeft+"px";bx.left=bA;if(e){bz.runtimeStyle.left=e}}return bv===""?"auto":bv}}Z=aI||aX;function p(by,bw,bv){var bA=bw==="width"?by.offsetWidth:by.offsetHeight,bz=bw==="width"?an:a1,bx=0,e=bz.length; if(bA>0){if(bv!=="border"){for(;bx)<[^<]*)*<\/script>/gi,q=/^(?:select|textarea)/i,h=/\s+/,br=/([?&])_=[^&]*/,K=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,A=b.fn.load,aa={},r={},aE,s,aV=["*/"]+["*"];try{aE=bl.href}catch(aw){aE=av.createElement("a");aE.href="";aE=aE.href}s=K.exec(aE.toLowerCase())||[];function f(e){return function(by,bA){if(typeof by!=="string"){bA=by;by="*"}if(b.isFunction(bA)){var bx=by.toLowerCase().split(h),bw=0,bz=bx.length,bv,bB,bC;for(;bw=0){var e=bw.slice(by,bw.length);bw=bw.slice(0,by)}var bx="GET";if(bz){if(b.isFunction(bz)){bA=bz;bz=L}else{if(typeof bz==="object"){bz=b.param(bz,b.ajaxSettings.traditional);bx="POST"}}}var bv=this;b.ajax({url:bw,type:bx,dataType:"html",data:bz,complete:function(bC,bB,bD){bD=bC.responseText;if(bC.isResolved()){bC.done(function(bE){bD=bE});bv.html(e?b("
").append(bD.replace(a6,"")).find(e):bD)}if(bA){bv.each(bA,[bD,bB,bC])}}});return this},serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?b.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||q.test(this.nodeName)||aZ.test(this.type))}).map(function(e,bv){var bw=b(this).val();return bw==null?null:b.isArray(bw)?b.map(bw,function(by,bx){return{name:bv.name,value:by.replace(bs,"\r\n")}}):{name:bv.name,value:bw.replace(bs,"\r\n")}}).get()}});b.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,bv){b.fn[bv]=function(bw){return this.on(bv,bw)}});b.each(["get","post"],function(e,bv){b[bv]=function(bw,by,bz,bx){if(b.isFunction(by)){bx=bx||bz;bz=by;by=L}return b.ajax({type:bv,url:bw,data:by,success:bz,dataType:bx})}});b.extend({getScript:function(e,bv){return b.get(e,L,bv,"script")},getJSON:function(e,bv,bw){return b.get(e,bv,bw,"json")},ajaxSetup:function(bv,e){if(e){am(bv,b.ajaxSettings)}else{e=bv;bv=b.ajaxSettings}am(bv,e);return bv},ajaxSettings:{url:aE,isLocal:aM.test(s[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":aV},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":bb.String,"text html":true,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{context:true,url:true}},ajaxPrefilter:f(aa),ajaxTransport:f(r),ajax:function(bz,bx){if(typeof bz==="object"){bx=bz;bz=L}bx=bx||{};var bD=b.ajaxSetup({},bx),bS=bD.context||bD,bG=bS!==bD&&(bS.nodeType||bS instanceof b)?b(bS):b.event,bR=b.Deferred(),bN=b.Callbacks("once memory"),bB=bD.statusCode||{},bC,bH={},bO={},bQ,by,bL,bE,bI,bA=0,bw,bK,bJ={readyState:0,setRequestHeader:function(bT,bU){if(!bA){var e=bT.toLowerCase();bT=bO[e]=bO[e]||bT;bH[bT]=bU}return this},getAllResponseHeaders:function(){return bA===2?bQ:null},getResponseHeader:function(bT){var e;if(bA===2){if(!by){by={};while((e=aD.exec(bQ))){by[e[1].toLowerCase()]=e[2]}}e=by[bT.toLowerCase()]}return e===L?null:e},overrideMimeType:function(e){if(!bA){bD.mimeType=e}return this},abort:function(e){e=e||"abort";if(bL){bL.abort(e)}bF(0,e);return this}};function bF(bZ,bU,b0,bW){if(bA===2){return}bA=2;if(bE){clearTimeout(bE)}bL=L;bQ=bW||"";bJ.readyState=bZ>0?4:0;var bT,b4,b3,bX=bU,bY=b0?bj(bD,bJ,b0):L,bV,b2;if(bZ>=200&&bZ<300||bZ===304){if(bD.ifModified){if((bV=bJ.getResponseHeader("Last-Modified"))){b.lastModified[bC]=bV}if((b2=bJ.getResponseHeader("Etag"))){b.etag[bC]=b2}}if(bZ===304){bX="notmodified";bT=true}else{try{b4=G(bD,bY);bX="success";bT=true}catch(b1){bX="parsererror";b3=b1}}}else{b3=bX;if(!bX||bZ){bX="error";if(bZ<0){bZ=0}}}bJ.status=bZ;bJ.statusText=""+(bU||bX);if(bT){bR.resolveWith(bS,[b4,bX,bJ])}else{bR.rejectWith(bS,[bJ,bX,b3])}bJ.statusCode(bB);bB=L;if(bw){bG.trigger("ajax"+(bT?"Success":"Error"),[bJ,bD,bT?b4:b3])}bN.fireWith(bS,[bJ,bX]);if(bw){bG.trigger("ajaxComplete",[bJ,bD]);if(!(--b.active)){b.event.trigger("ajaxStop")}}}bR.promise(bJ);bJ.success=bJ.done;bJ.error=bJ.fail;bJ.complete=bN.add;bJ.statusCode=function(bT){if(bT){var e;if(bA<2){for(e in bT){bB[e]=[bB[e],bT[e]]}}else{e=bT[bJ.status];bJ.then(e,e)}}return this};bD.url=((bz||bD.url)+"").replace(bq,"").replace(c,s[1]+"//");bD.dataTypes=b.trim(bD.dataType||"*").toLowerCase().split(h);if(bD.crossDomain==null){bI=K.exec(bD.url.toLowerCase());bD.crossDomain=!!(bI&&(bI[1]!=s[1]||bI[2]!=s[2]||(bI[3]||(bI[1]==="http:"?80:443))!=(s[3]||(s[1]==="http:"?80:443))))}if(bD.data&&bD.processData&&typeof bD.data!=="string"){bD.data=b.param(bD.data,bD.traditional)}aW(aa,bD,bx,bJ);if(bA===2){return false}bw=bD.global;bD.type=bD.type.toUpperCase();bD.hasContent=!aQ.test(bD.type);if(bw&&b.active++===0){b.event.trigger("ajaxStart")}if(!bD.hasContent){if(bD.data){bD.url+=(M.test(bD.url)?"&":"?")+bD.data;delete bD.data}bC=bD.url;if(bD.cache===false){var bv=b.now(),bP=bD.url.replace(br,"$1_="+bv);bD.url=bP+((bP===bD.url)?(M.test(bD.url)?"&":"?")+"_="+bv:"")}}if(bD.data&&bD.hasContent&&bD.contentType!==false||bx.contentType){bJ.setRequestHeader("Content-Type",bD.contentType)}if(bD.ifModified){bC=bC||bD.url;if(b.lastModified[bC]){bJ.setRequestHeader("If-Modified-Since",b.lastModified[bC])}if(b.etag[bC]){bJ.setRequestHeader("If-None-Match",b.etag[bC])}}bJ.setRequestHeader("Accept",bD.dataTypes[0]&&bD.accepts[bD.dataTypes[0]]?bD.accepts[bD.dataTypes[0]]+(bD.dataTypes[0]!=="*"?", "+aV+"; q=0.01":""):bD.accepts["*"]);for(bK in bD.headers){bJ.setRequestHeader(bK,bD.headers[bK])}if(bD.beforeSend&&(bD.beforeSend.call(bS,bJ,bD)===false||bA===2)){bJ.abort();return false}for(bK in {success:1,error:1,complete:1}){bJ[bK](bD[bK])}bL=aW(r,bD,bx,bJ);if(!bL){bF(-1,"No Transport")}else{bJ.readyState=1;if(bw){bG.trigger("ajaxSend",[bJ,bD])}if(bD.async&&bD.timeout>0){bE=setTimeout(function(){bJ.abort("timeout")},bD.timeout)}try{bA=1;bL.send(bH,bF)}catch(bM){if(bA<2){bF(-1,bM)}else{throw bM}}}return bJ},param:function(e,bw){var bv=[],by=function(bz,bA){bA=b.isFunction(bA)?bA():bA;bv[bv.length]=encodeURIComponent(bz)+"="+encodeURIComponent(bA)};if(bw===L){bw=b.ajaxSettings.traditional}if(b.isArray(e)||(e.jquery&&!b.isPlainObject(e))){b.each(e,function(){by(this.name,this.value)})}else{for(var bx in e){v(bx,e[bx],bw,by)}}return bv.join("&").replace(k,"+")}});function v(bw,by,bv,bx){if(b.isArray(by)){b.each(by,function(bA,bz){if(bv||ap.test(bw)){bx(bw,bz)}else{v(bw+"["+(typeof bz==="object"||b.isArray(bz)?bA:"")+"]",bz,bv,bx)}})}else{if(!bv&&by!=null&&typeof by==="object"){for(var e in by){v(bw+"["+e+"]",by[e],bv,bx)}}else{bx(bw,by)}}}b.extend({active:0,lastModified:{},etag:{}});function bj(bD,bC,bz){var bv=bD.contents,bB=bD.dataTypes,bw=bD.responseFields,by,bA,bx,e;for(bA in bw){if(bA in bz){bC[bw[bA]]=bz[bA]}}while(bB[0]==="*"){bB.shift();if(by===L){by=bD.mimeType||bC.getResponseHeader("content-type")}}if(by){for(bA in bv){if(bv[bA]&&bv[bA].test(by)){bB.unshift(bA);break}}}if(bB[0] in bz){bx=bB[0]}else{for(bA in bz){if(!bB[0]||bD.converters[bA+" "+bB[0]]){bx=bA;break}if(!e){e=bA}}bx=bx||e}if(bx){if(bx!==bB[0]){bB.unshift(bx)}return bz[bx]}}function G(bH,bz){if(bH.dataFilter){bz=bH.dataFilter(bz,bH.dataType)}var bD=bH.dataTypes,bG={},bA,bE,bw=bD.length,bB,bC=bD[0],bx,by,bF,bv,e;for(bA=1;bA=bw.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();bw.animatedProperties[this.prop]=true;for(bA in bw.animatedProperties){if(bw.animatedProperties[bA]!==true){e=false}}if(e){if(bw.overflow!=null&&!b.support.shrinkWrapBlocks){b.each(["","X","Y"],function(bC,bD){bz.style["overflow"+bD]=bw.overflow[bC]})}if(bw.hide){b(bz).hide()}if(bw.hide||bw.show){for(bA in bw.animatedProperties){b.style(bz,bA,bw.orig[bA]);b.removeData(bz,"fxshow"+bA,true);b.removeData(bz,"toggle"+bA,true)}}bv=bw.complete;if(bv){bw.complete=false;bv.call(bz)}}return false}else{if(bw.duration==Infinity){this.now=bx}else{bB=bx-this.startTime;this.state=bB/bw.duration;this.pos=b.easing[bw.animatedProperties[this.prop]](this.state,bB,0,1,bw.duration);this.now=this.start+((this.end-this.start)*this.pos)}this.update()}return true}};b.extend(b.fx,{tick:function(){var bw,bv=b.timers,e=0;for(;e").appendTo(e),bw=bv.css("display");bv.remove();if(bw==="none"||bw===""){if(!a8){a8=av.createElement("iframe");a8.frameBorder=a8.width=a8.height=0}e.appendChild(a8);if(!m||!a8.createElement){m=(a8.contentWindow||a8.contentDocument).document;m.write((av.compatMode==="CSS1Compat"?"":"")+"");m.close()}bv=m.createElement(bx);m.body.appendChild(bv);bw=b.css(bv,"display");e.removeChild(a8)}Q[bx]=bw}return Q[bx]}var V=/^t(?:able|d|h)$/i,ad=/^(?:body|html)$/i;if("getBoundingClientRect" in av.documentElement){b.fn.offset=function(bI){var by=this[0],bB;if(bI){return this.each(function(e){b.offset.setOffset(this,bI,e)})}if(!by||!by.ownerDocument){return null}if(by===by.ownerDocument.body){return b.offset.bodyOffset(by)}try{bB=by.getBoundingClientRect()}catch(bF){}var bH=by.ownerDocument,bw=bH.documentElement;if(!bB||!b.contains(bw,by)){return bB?{top:bB.top,left:bB.left}:{top:0,left:0}}var bC=bH.body,bD=aK(bH),bA=bw.clientTop||bC.clientTop||0,bE=bw.clientLeft||bC.clientLeft||0,bv=bD.pageYOffset||b.support.boxModel&&bw.scrollTop||bC.scrollTop,bz=bD.pageXOffset||b.support.boxModel&&bw.scrollLeft||bC.scrollLeft,bG=bB.top+bv-bA,bx=bB.left+bz-bE;return{top:bG,left:bx}}}else{b.fn.offset=function(bF){var bz=this[0];if(bF){return this.each(function(bG){b.offset.setOffset(this,bF,bG)})}if(!bz||!bz.ownerDocument){return null}if(bz===bz.ownerDocument.body){return b.offset.bodyOffset(bz)}var bC,bw=bz.offsetParent,bv=bz,bE=bz.ownerDocument,bx=bE.documentElement,bA=bE.body,bB=bE.defaultView,e=bB?bB.getComputedStyle(bz,null):bz.currentStyle,bD=bz.offsetTop,by=bz.offsetLeft;while((bz=bz.parentNode)&&bz!==bA&&bz!==bx){if(b.support.fixedPosition&&e.position==="fixed"){break}bC=bB?bB.getComputedStyle(bz,null):bz.currentStyle;bD-=bz.scrollTop;by-=bz.scrollLeft;if(bz===bw){bD+=bz.offsetTop;by+=bz.offsetLeft;if(b.support.doesNotAddBorder&&!(b.support.doesAddBorderForTableAndCells&&V.test(bz.nodeName))){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}bv=bw;bw=bz.offsetParent}if(b.support.subtractsBorderForOverflowNotVisible&&bC.overflow!=="visible"){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}e=bC}if(e.position==="relative"||e.position==="static"){bD+=bA.offsetTop;by+=bA.offsetLeft}if(b.support.fixedPosition&&e.position==="fixed"){bD+=Math.max(bx.scrollTop,bA.scrollTop);by+=Math.max(bx.scrollLeft,bA.scrollLeft)}return{top:bD,left:by}}}b.offset={bodyOffset:function(e){var bw=e.offsetTop,bv=e.offsetLeft;if(b.support.doesNotIncludeMarginInBodyOffset){bw+=parseFloat(b.css(e,"marginTop"))||0;bv+=parseFloat(b.css(e,"marginLeft"))||0}return{top:bw,left:bv}},setOffset:function(bx,bG,bA){var bB=b.css(bx,"position");if(bB==="static"){bx.style.position="relative"}var bz=b(bx),bv=bz.offset(),e=b.css(bx,"top"),bE=b.css(bx,"left"),bF=(bB==="absolute"||bB==="fixed")&&b.inArray("auto",[e,bE])>-1,bD={},bC={},bw,by;if(bF){bC=bz.position();bw=bC.top;by=bC.left}else{bw=parseFloat(e)||0;by=parseFloat(bE)||0}if(b.isFunction(bG)){bG=bG.call(bx,bA,bv)}if(bG.top!=null){bD.top=(bG.top-bv.top)+bw}if(bG.left!=null){bD.left=(bG.left-bv.left)+by}if("using" in bG){bG.using.call(bx,bD)}else{bz.css(bD)}}};b.fn.extend({position:function(){if(!this[0]){return null}var bw=this[0],bv=this.offsetParent(),bx=this.offset(),e=ad.test(bv[0].nodeName)?{top:0,left:0}:bv.offset();bx.top-=parseFloat(b.css(bw,"marginTop"))||0;bx.left-=parseFloat(b.css(bw,"marginLeft"))||0;e.top+=parseFloat(b.css(bv[0],"borderTopWidth"))||0;e.left+=parseFloat(b.css(bv[0],"borderLeftWidth"))||0;return{top:bx.top-e.top,left:bx.left-e.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||av.body;while(e&&(!ad.test(e.nodeName)&&b.css(e,"position")==="static")){e=e.offsetParent}return e})}});b.each(["Left","Top"],function(bv,e){var bw="scroll"+e;b.fn[bw]=function(bz){var bx,by;if(bz===L){bx=this[0];if(!bx){return null}by=aK(bx);return by?("pageXOffset" in by)?by[bv?"pageYOffset":"pageXOffset"]:b.support.boxModel&&by.document.documentElement[bw]||by.document.body[bw]:bx[bw]}return this.each(function(){by=aK(this);if(by){by.scrollTo(!bv?bz:b(by).scrollLeft(),bv?bz:b(by).scrollTop())}else{this[bw]=bz}})}});function aK(e){return b.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:false}b.each(["Height","Width"],function(bv,e){var bw=e.toLowerCase();b.fn["inner"+e]=function(){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,"padding")):this[bw]():null};b.fn["outer"+e]=function(by){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,by?"margin":"border")):this[bw]():null};b.fn[bw]=function(bz){var bA=this[0];if(!bA){return bz==null?null:this}if(b.isFunction(bz)){return this.each(function(bE){var bD=b(this);bD[bw](bz.call(this,bE,bD[bw]()))})}if(b.isWindow(bA)){var bB=bA.document.documentElement["client"+e],bx=bA.document.body;return bA.document.compatMode==="CSS1Compat"&&bB||bx&&bx["client"+e]||bB}else{if(bA.nodeType===9){return Math.max(bA.documentElement["client"+e],bA.body["scroll"+e],bA.documentElement["scroll"+e],bA.body["offset"+e],bA.documentElement["offset"+e])}else{if(bz===L){var bC=b.css(bA,bw),by=parseFloat(bC);return b.isNumeric(by)?by:bC}else{return this.css(bw,typeof bz==="string"?bz:bz+"px")}}}}});bb.jQuery=bb.$=b;if(typeof define==="function"&&define.amd&&define.amd.jQuery){define("jquery",[],function(){return b })}})(window); qdjango-0.4.0/doc/html/dynsections.js0000644000175000007640000000564712163016767017514 0ustar sharkyjerrywebfunction toggleVisibility(linkObj) { var base = $(linkObj).attr('id'); var summary = $('#'+base+'-summary'); var content = $('#'+base+'-content'); var trigger = $('#'+base+'-trigger'); var src=$(trigger).attr('src'); if (content.is(':visible')===true) { content.hide(); summary.show(); $(linkObj).addClass('closed').removeClass('opened'); $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); } else { content.show(); summary.hide(); $(linkObj).removeClass('closed').addClass('opened'); $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); } return false; } function updateStripes() { $('table.directory tr'). removeClass('even').filter(':visible:even').addClass('even'); } function toggleLevel(level) { $('table.directory tr').each(function(){ var l = this.id.split('_').length-1; var i = $('#img'+this.id.substring(3)); var a = $('#arr'+this.id.substring(3)); if (l QDjango: QDjangoQuerySet.h Source File
QDjango
QDjangoQuerySet.h
1 /*
2  * Copyright (C) 2010-2012 Jeremy Lainé
3  * Copyright (C) 2011 Mathias Hasselmann
4  * Contact: http://code.google.com/p/qdjango/
5  *
6  * This file is part of the QDjango Library.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  */
18 
19 #ifndef QDJANGO_QUERYSET_H
20 #define QDJANGO_QUERYSET_H
21 
22 #include "QDjango.h"
23 #include "QDjangoWhere.h"
24 #include "QDjangoQuerySet_p.h"
25 
45 template <class T>
47 {
48 public:
50  typedef int size_type;
51  typedef T value_type;
52  typedef value_type *pointer;
53  typedef const value_type *const_pointer;
54  typedef value_type &reference;
55  typedef const value_type &const_reference;
56  typedef qptrdiff difference_type;
79  {
80  friend class QDjangoQuerySet;
81 
82  public:
86  typedef std::bidirectional_iterator_tag iterator_category;
87 
89  typedef qptrdiff difference_type;
90  typedef T value_type;
91  typedef T *pointer;
92  typedef T &reference;
103  : m_querySet(0)
104  , m_fetched(-1)
105  , m_offset(0)
106  {
107  }
108 
112  : m_querySet(other.m_querySet)
113  , m_fetched(-1)
114  , m_offset(other.m_offset)
115  {
116  }
117 
118  private:
119  const_iterator(const QDjangoQuerySet<T> *querySet, int offset = 0)
120  : m_querySet(querySet)
121  , m_fetched(-1)
122  , m_offset(offset)
123  {
124  }
125 
126  public:
131  const T &operator*() const { return *t(); }
132 
137  const T *operator->() const { return t(); }
138 
139 
145  bool operator==(const const_iterator &other) const
146  {
147  return m_querySet == other.m_querySet && m_offset == other.m_offset;
148  }
149 
155  bool operator!=(const const_iterator &other) const
156  {
157  return m_querySet != other.m_querySet || m_offset != other.m_offset;
158  }
159 
163  bool operator<(const const_iterator& other) const
164  {
165  return (m_querySet == other.m_querySet && m_offset < other.m_offset)
166  || m_querySet < other.m_querySet;
167  }
168 
172  bool operator<=(const const_iterator& other) const
173  {
174  return (m_querySet == other.m_querySet && m_offset <= other.m_offset)
175  || m_querySet < other.m_querySet;
176  }
177 
181  bool operator>(const const_iterator& other) const
182  {
183  return (m_querySet == other.m_querySet && m_offset > other.m_offset)
184  || m_querySet > other.m_querySet;
185  }
186 
190  bool operator>=(const const_iterator& other) const
191  {
192  return (m_querySet == other.m_querySet && m_offset >= other.m_offset)
193  || m_querySet > other.m_querySet;
194  }
195 
203  const_iterator &operator++() { ++m_offset; return *this; }
204 
212  const_iterator operator++(int) { const_iterator n(*this); ++m_offset; return n; }
213 
219  const_iterator &operator+=(int i) { m_offset += i; return *this; }
220 
226  const_iterator operator+(int i) const { return const_iterator(m_querySet, m_offset + i); }
227 
233  const_iterator &operator-=(int i) { m_offset -= i; return *this; }
234 
240  const_iterator operator-(int i) const { return const_iterator(m_querySet, m_offset - i); }
241 
249  const_iterator &operator--() { --m_offset; return *this; }
250 
258  const_iterator operator--(int) { const_iterator n(*this); --m_offset; return n; }
259 
260 
264  difference_type operator-(const const_iterator &other) const { return m_offset - other.m_offset; }
265 
266  private:
267  const T *t() const
268  {
269  if (m_fetched != m_offset && m_querySet) {
270  if (const_cast<QDjangoQuerySet<T> *>(m_querySet)->at(m_offset, &m_object)) {
271  m_fetched = m_offset;
272  }
273  }
274 
275  return m_fetched == m_offset ? &m_object : 0;
276  }
277 
278  private:
279  const QDjangoQuerySet<T> *m_querySet;
280  mutable int m_fetched;
281  mutable T m_object;
282 
283  int m_offset;
284  };
285 
288 
289  QDjangoQuerySet();
290  QDjangoQuerySet(const QDjangoQuerySet<T> &other);
292 
293  QDjangoQuerySet all() const;
296  QDjangoQuerySet limit(int pos, int length = -1) const;
297  QDjangoQuerySet none() const;
298  QDjangoQuerySet orderBy(const QStringList &keys) const;
300 
301  int count() const;
302  QDjangoWhere where() const;
303 
304  bool remove();
305  int size();
306  int update(const QVariantMap &fields);
307  QList<QVariantMap> values(const QStringList &fields = QStringList());
308  QList<QVariantList> valuesList(const QStringList &fields = QStringList());
309 
310  T *get(const QDjangoWhere &where, T *target = 0) const;
311  T *at(int index, T *target = 0);
312 
313  const_iterator constBegin() const;
314  const_iterator begin() const;
315 
316  const_iterator constEnd() const;
317  const_iterator end() const;
318 
320 
321 private:
322  QDjangoQuerySetPrivate *d;
323 };
324 
327 template <class T>
329 {
330  d = new QDjangoQuerySetPrivate(T::staticMetaObject.className());
331 }
332 
337 template <class T>
339 {
340  other.d->counter.ref();
341  d = other.d;
342 }
343 
346 template <class T>
348 {
349  if (!d->counter.deref())
350  delete d;
351 }
352 
363 template <class T>
364 T *QDjangoQuerySet<T>::at(int index, T *target)
365 {
366  T *entry = target ? target : new T;
367  if (!d->sqlLoad(entry, index))
368  {
369  if (!target)
370  delete entry;
371  return 0;
372  }
373  return entry;
374 }
375 
380 template <class T>
382 {
383  return const_iterator(this);
384 }
385 
390 template <class T>
392 {
393  return const_iterator(this);
394 }
395 
401 template <class T>
403 {
405 }
406 
412 template <class T>
414 {
416 }
417 
420 template <class T>
422 {
423  QDjangoQuerySet<T> other;
424  other.d->lowMark = d->lowMark;
425  other.d->highMark = d->highMark;
426  other.d->orderBy = d->orderBy;
427  other.d->selectRelated = d->selectRelated;
428  other.d->whereClause = d->whereClause;
429  return other;
430 }
431 
441 template <class T>
443 {
444  if (d->hasResults)
445  return d->properties.size();
446 
447  // execute COUNT query
448  QDjangoQuery query(d->countQuery());
449  if (!query.exec() || !query.next())
450  return -1;
451  return query.value(0).toInt();
452 }
453 
464 template <class T>
466 {
467  QDjangoQuerySet<T> other = all();
468  other.d->addFilter(!where);
469  return other;
470 }
471 
482 template <class T>
484 {
485  QDjangoQuerySet<T> other = all();
486  other.d->addFilter(where);
487  return other;
488 }
489 
501 template <class T>
502 T *QDjangoQuerySet<T>::get(const QDjangoWhere &where, T *target) const
503 {
504  QDjangoQuerySet<T> qs = filter(where);
505  return qs.size() == 1 ? qs.at(0, target) : 0;
506 }
507 
520 template <class T>
522 {
523  Q_ASSERT(pos >= 0);
524  Q_ASSERT(length >= -1);
525 
526  QDjangoQuerySet<T> other = all();
527  other.d->lowMark += pos;
528  if (length > 0)
529  {
530  // calculate new high mark
531  other.d->highMark = other.d->lowMark + length;
532  // never exceed the current high mark
533  if (d->highMark > 0 && other.d->highMark > d->highMark)
534  other.d->highMark = d->highMark;
535  }
536  return other;
537 }
538 
541 template <class T>
543 {
544  QDjangoQuerySet<T> other;
545  other.d->whereClause = !QDjangoWhere();
546  return other;
547 }
548 
556 template <class T>
557 QDjangoQuerySet<T> QDjangoQuerySet<T>::orderBy(const QStringList &keys) const
558 {
559  // it is not possible to change ordering once a limit has been set
560  Q_ASSERT(!d->lowMark && !d->highMark);
561 
562  QDjangoQuerySet<T> other = all();
563  other.d->orderBy << keys;
564  return other;
565 }
566 
571 template <class T>
573 {
574  return d->sqlDelete();
575 }
576 
581 template <class T>
583 {
584  QDjangoQuerySet<T> other = all();
585  other.d->selectRelated = true;
586  return other;
587 }
588 
595 template <class T>
597 {
598  if (!d->sqlFetch())
599  return -1;
600  return d->properties.size();
601 }
602 
606 template <class T>
607 int QDjangoQuerySet<T>::update(const QVariantMap &fields)
608 {
609  return d->sqlUpdate(fields);
610 }
611 
617 template <class T>
618 QList<QVariantMap> QDjangoQuerySet<T>::values(const QStringList &fields)
619 {
620  return d->sqlValues(fields);
621 }
622 
629 template <class T>
630 QList<QVariantList> QDjangoQuerySet<T>::valuesList(const QStringList &fields)
631 {
632  return d->sqlValuesList(fields);
633 }
634 
638 template <class T>
640 {
641  return d->resolvedWhere(QDjango::database());
642 }
643 
648 template <class T>
650 {
651  other.d->counter.ref();
652  if (!d->counter.deref())
653  delete d;
654  d = other.d;
655  return *this;
656 }
657 
658 #endif
qdjango-0.4.0/doc/html/ftv2node.png0000644000175000007640000000012612163016767017034 0ustar sharkyjerrywebPNG  IHDRɪ|IDATxݱðScOx@ y}IENDB`qdjango-0.4.0/doc/html/classQDjangoMetaModel-members.html0000644000175000007640000002331112163016767023257 0ustar sharkyjerryweb QDjango: Member List
QDjangoMetaModel Member List

This is the complete list of members for QDjangoMetaModel, including all inherited members.

createTable() const QDjangoMetaModel
createTableSql() const QDjangoMetaModel
dropTable() const QDjangoMetaModel
foreignFields() const QDjangoMetaModel
foreignKey(const QObject *model, const char *name) const QDjangoMetaModel
load(QObject *model, const QVariantList &props, int &pos) const QDjangoMetaModel
localField(const char *name) const QDjangoMetaModel
localFields() const QDjangoMetaModel
operator=(const QDjangoMetaModel &other)QDjangoMetaModel
primaryKey() const QDjangoMetaModel
QDjangoMetaModel(const QMetaObject *model=0)QDjangoMetaModel
QDjangoMetaModel(const QDjangoMetaModel &other)QDjangoMetaModel
remove(QObject *model) const QDjangoMetaModel
save(QObject *model) const QDjangoMetaModel
setForeignKey(QObject *model, const char *name, QObject *value) const QDjangoMetaModel
table() const QDjangoMetaModel
~QDjangoMetaModel()QDjangoMetaModel
qdjango-0.4.0/doc/html/functions_prop.html0000644000175000007640000001273212163016767020543 0ustar sharkyjerryweb QDjango: Class Members - Properties
QDjango
 
qdjango-0.4.0/doc/html/annotated.html0000644000175000007640000002312512163016767017446 0ustar sharkyjerryweb QDjango: Class List
QDjango
Class List
Here are the classes, structs, unions and interfaces with brief descriptions:
[detail level 12]
oCQDjangoSet of static functions
oCQDjangoFastCgiServerFastCGI server
oCQDjangoHttpControllerStatic methods for replying to HTTP requests
oCQDjangoHttpRequestHTTP request
oCQDjangoHttpResponseHTTP response
oCQDjangoHttpServerHTTP server
oCQDjangoMetaFieldHolds the database schema for a field
oCQDjangoMetaModelHolds the database schema for a model
oCQDjangoModelBase class for all models
oCQDjangoQuerySetThe QDjangoQuerySet class is a template class for performing database queries
|\Cconst_iterator
oCQDjangoScriptStatic methods for making models scriptable
oCQDjangoUrlResolverMaps incoming HTTP requests to handlers
\CQDjangoWhereExpresses an SQL constraint
qdjango-0.4.0/doc/html/nav_g.png0000644000175000007640000000013712163016767016401 0ustar sharkyjerrywebPNG  IHDR1&IDATx1 OHf_ ->~M iMS<IENDB`qdjango-0.4.0/doc/html/functions.html0000644000175000007640000006727312163016767017515 0ustar sharkyjerryweb QDjango: Class Members
QDjango
Here is a list of all documented class members with links to the class documentation for each member:

- a -

- b -

- c -

- d -

- e -

- f -

- g -

- h -

- i -

- l -

- m -

- n -

- o -

- p -

- q -

- r -

- s -

- t -

- u -

- v -

- w -

- ~ -

qdjango-0.4.0/doc/html/open.png0000644000175000007640000000017312163016767016250 0ustar sharkyjerrywebPNG  IHDR BIDATx 0 ׬ՙ\39b!9{|I>$#ߴ8/z/>2[giU,/~\ 9ٸIENDB`qdjango-0.4.0/doc/html/classQDjango.html0000644000175000007640000004341312163016767020044 0ustar sharkyjerryweb QDjango: QDjango Class Reference

The QDjango class provides a set of static functions. More...

#include <QDjango.h>

Public Member Functions

template<class T >
QDjangoMetaModel registerModel ()
 

Static Public Member Functions

static bool createTables ()
 Creates the database tables for all registered models.
 
static bool dropTables ()
 Drops the database tables for all registered models.
 
static QSqlDatabase database ()
 Returns the database used by QDjango. More...
 
static void setDatabase (QSqlDatabase database)
 Sets the database used by QDjango. More...
 
static bool isDebugEnabled ()
 Returns whether debugging information should be printed. More...
 
static void setDebugEnabled (bool enabled)
 Sets whether debugging information should be printed. More...
 
template<class T >
static QDjangoMetaModel registerModel ()
 

Friends

class QDjangoCompiler
 
class QDjangoModel
 
class QDjangoMetaModel
 
class QDjangoQuerySetPrivate
 

Detailed Description

The QDjango class provides a set of static functions.

It is used to access registered QDjangoModel classes.

Member Function Documentation

QSqlDatabase QDjango::database ( )
static

Returns the database used by QDjango.

If you call this method from any thread but the application's main thread, a new connection to the database will be created. The connection will automatically be torn down once the thread finishes.

See Also
setDatabase()
bool QDjango::isDebugEnabled ( )
static

Returns whether debugging information should be printed.

See Also
setDebugEnabled()
template<class T >
QDjangoMetaModel QDjango::registerModel ( )

Register a QDjangoModel class with QDjango.

void QDjango::setDatabase ( QSqlDatabase  database)
static

Sets the database used by QDjango.

You must call this method from your application's main thread.

See Also
database()
void QDjango::setDebugEnabled ( bool  enabled)
static

Sets whether debugging information should be printed.

See Also
isDebugEnabled()

The documentation for this class was generated from the following files:
qdjango-0.4.0/doc/html/classQDjangoQuerySet-members.html0000644000175000007640000002766012163016767023204 0ustar sharkyjerryweb QDjango: Member List
QDjangoQuerySet< T > Member List

This is the complete list of members for QDjangoQuerySet< T >, including all inherited members.

all() const QDjangoQuerySet< T >
at(int index, T *target=0)QDjangoQuerySet< T >
begin() const QDjangoQuerySet< T >
constBegin() const QDjangoQuerySet< T >
constEnd() const QDjangoQuerySet< T >
ConstIterator typedefQDjangoQuerySet< T >
count() const QDjangoQuerySet< T >
end() const QDjangoQuerySet< T >
exclude(const QDjangoWhere &where) const QDjangoQuerySet< T >
filter(const QDjangoWhere &where) const QDjangoQuerySet< T >
get(const QDjangoWhere &where, T *target=0) const QDjangoQuerySet< T >
limit(int pos, int length=-1) const QDjangoQuerySet< T >
none() const QDjangoQuerySet< T >
operator=(const QDjangoQuerySet< T > &other)QDjangoQuerySet< T >
orderBy(const QStringList &keys) const QDjangoQuerySet< T >
QDjangoQuerySet()QDjangoQuerySet< T >
QDjangoQuerySet(const QDjangoQuerySet< T > &other)QDjangoQuerySet< T >
remove()QDjangoQuerySet< T >
selectRelated() const QDjangoQuerySet< T >
size()QDjangoQuerySet< T >
update(const QVariantMap &fields)QDjangoQuerySet< T >
values(const QStringList &fields=QStringList())QDjangoQuerySet< T >
valuesList(const QStringList &fields=QStringList())QDjangoQuerySet< T >
where() const QDjangoQuerySet< T >
~QDjangoQuerySet()QDjangoQuerySet< T >
qdjango-0.4.0/doc/html/ftv2lastnode.png0000644000175000007640000000012612163016767017720 0ustar sharkyjerrywebPNG  IHDRɪ|IDATxݱðScOx@ y}IENDB`qdjango-0.4.0/doc/html/bc_s.png0000644000175000007640000000124412163016767016215 0ustar sharkyjerrywebPNG  IHDR_ kIDATxkQϝ̤I&m&156*nąܸR,4 +H(Ub1J.(EmߏhJmKS'C(х & r3g(z&_9}՟@mu ` h`ԯ &~M4%3?h)\Yi>Jb @giވkg\轭EUv+?E"pB\Y&$vM+Dn)}:Xo 3گ'.f0u9Ljf6%3Gf#sm(,k*ʒJJˢou_~ r]%%mnu]zr5[ưXeI QDjango: QDjangoFastCgiServer.h Source File
QDjangoFastCgiServer.h
1 /*
2  * Copyright (C) 2010-2012 Jeremy Lainé
3  * Contact: http://code.google.com/p/qdjango/
4  *
5  * This file is part of the QDjango Library.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  */
17 
18 #ifndef QDJANGO_FASTCGI_SERVER_H
19 #define QDJANGO_FASTCGI_SERVER_H
20 
21 #include <QHostAddress>
22 #include <QObject>
23 
24 #include "QDjangoHttp_p.h"
25 
26 class QDjangoFastCgiServerPrivate;
28 class QDjangoUrlResolver;
29 
40 class QDJANGO_EXPORT QDjangoFastCgiServer : public QObject
41 {
42  Q_OBJECT
43 
44 public:
45  QDjangoFastCgiServer(QObject *parent = 0);
47 
48  void close();
49  bool listen(const QString &name);
50  bool listen(const QHostAddress &address, quint16 port);
51  QDjangoUrlResolver *urls() const;
52 
53 private slots:
54  void _q_newLocalConnection();
55  void _q_newTcpConnection();
56 
57 private:
58  Q_DISABLE_COPY(QDjangoFastCgiServer)
59  QDjangoFastCgiServerPrivate *d;
60 };
61 
62 #endif
qdjango-0.4.0/doc/html/classQDjangoHttpRequest-members.html0000644000175000007640000002031012163016767023674 0ustar sharkyjerryweb QDjango: Member List
QDjangoHttpRequest Member List

This is the complete list of members for QDjangoHttpRequest, including all inherited members.

body() const QDjangoHttpRequest
get(const QString &key) const QDjangoHttpRequest
meta(const QString &key) const QDjangoHttpRequest
method() const QDjangoHttpRequest
path() const QDjangoHttpRequest
post(const QString &key) const QDjangoHttpRequest
QDjangoFastCgiConnection (defined in QDjangoHttpRequest)QDjangoHttpRequestfriend
QDjangoHttpConnection (defined in QDjangoHttpRequest)QDjangoHttpRequestfriend
QDjangoHttpRequest()QDjangoHttpRequest
QDjangoHttpTestRequest (defined in QDjangoHttpRequest)QDjangoHttpRequestfriend
~QDjangoHttpRequest()QDjangoHttpRequest
qdjango-0.4.0/doc/html/QDjangoWhere_8h_source.html0000644000175000007640000004467612163016767022004 0ustar sharkyjerryweb QDjango: QDjangoWhere.h Source File
QDjangoWhere.h
1 /*
2  * Copyright (C) 2010-2012 Jeremy Lainé
3  * Contact: http://code.google.com/p/qdjango/
4  *
5  * This file is part of the QDjango Library.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  */
17 
18 #ifndef QDJANGO_WHERE_H
19 #define QDJANGO_WHERE_H
20 
21 #include <QSharedDataPointer>
22 #include <QVariant>
23 
24 #include "QDjango_p.h"
25 
26 class QDjangoMetaModel;
27 class QDjangoQuery;
28 class QDjangoWherePrivate;
29 
40 class QDJANGO_EXPORT QDjangoWhere
41 {
42 public:
44  enum Operation
45  {
69  IsNull
70  };
71 
72  QDjangoWhere();
73  QDjangoWhere(const QDjangoWhere &other);
74  QDjangoWhere(const QString &key, QDjangoWhere::Operation operation, QVariant value);
75  ~QDjangoWhere();
76 
77  QDjangoWhere& operator=(const QDjangoWhere &other);
78  QDjangoWhere operator!() const;
79  QDjangoWhere operator&&(const QDjangoWhere &other) const;
80  QDjangoWhere operator||(const QDjangoWhere &other) const;
81 
82  void bindValues(QDjangoQuery &query) const;
83  bool isAll() const;
84  bool isNone() const;
85  QString sql(const QSqlDatabase &db) const;
86 
87 private:
88  QSharedDataPointer<QDjangoWherePrivate> d;
89  friend class QDjangoCompiler;
90 };
91 
92 #endif
qdjango-0.4.0/doc/html/index.html0000644000175000007640000001301312163016767016573 0ustar sharkyjerryweb QDjango: Main Page
QDjango
QDjango Documentation

QDjango is a simple yet powerful Object Relation Mapper (ORM) built on top of the Qt library. Where possible it tries to follow django's ORM API, hence its name.

See Also
QDjango
QDjangoModel
QDjangoWhere
QDjangoQuerySet
qdjango-0.4.0/doc/html/classQDjangoHttpServer-members.html0000644000175000007640000001543512163016767023526 0ustar sharkyjerryweb QDjango: Member List
QDjangoHttpServer Member List

This is the complete list of members for QDjangoHttpServer, including all inherited members.

close()QDjangoHttpServer
listen(const QHostAddress &address, quint16 port)QDjangoHttpServer
QDjangoHttpServer(QObject *parent=0)QDjangoHttpServer
requestFinished(QDjangoHttpRequest *request, QDjangoHttpResponse *response)QDjangoHttpServersignal
urls() const QDjangoHttpServer
~QDjangoHttpServer()QDjangoHttpServer
qdjango-0.4.0/doc/html/sync_off.png0000644000175000007640000000152512163016767017117 0ustar sharkyjerrywebPNG  IHDRw=IDATxKhTW1I&38MII3b$c I1V1-(T.* t!K[čf`l(l"Y6gT}sgܹ d{8?̝;u`:!FB?Űm'y>ѝlU_?]Y(N8f1qn-etm 0}b%׌=0?1s08;_ W|%\Zð >舽lnp.a{ )t; b n652?>Oдunm`׭ZWjC~>־0+ {{fMŕټ` ݛ%uA6,]kWu]7ihu1 l Ҷ̺:\cxhRQt$ fd<4B[fd7=.M9//O a},j?.5ښm?X2#d p(?c!a1ޗةܾ7dK:)3],H+ku<|`LhC7e םt H$^2%l.aeÉ|s }D^hz~Rá]|#@חև[k<|(*ݹdtM:,]' X_n| /cfOIENDB`qdjango-0.4.0/doc/html/ftv2pnode.png0000644000175000007640000000034512163016767017217 0ustar sharkyjerrywebPNG  IHDRɪ|IDATx=QFDk:FPK؃=V@ճ 8SHx0bnrr{򽿾$ TP XOd6"SOB(Q)+YĈ ҪR>Vtsm9(k-@ȧ-$ b [he Kp-l|CApRG'rͭaIENDB`qdjango-0.4.0/doc/html/group__Script.html0000644000175000007640000001301412163016767020304 0ustar sharkyjerryweb QDjango: Script
QDjango
Script

Classes

class  QDjangoScript
 The QDjangoScript class provides static methods for making models scriptable. More...
 

Detailed Description

qdjango-0.4.0/doc/html/classQDjangoFastCgiServer-members.html0000644000175000007640000001542412163016767024125 0ustar sharkyjerryweb QDjango: Member List
QDjangoFastCgiServer Member List

This is the complete list of members for QDjangoFastCgiServer, including all inherited members.

close()QDjangoFastCgiServer
listen(const QString &name)QDjangoFastCgiServer
listen(const QHostAddress &address, quint16 port)QDjangoFastCgiServer
QDjangoFastCgiServer(QObject *parent=0)QDjangoFastCgiServer
urls() const QDjangoFastCgiServer
~QDjangoFastCgiServer()QDjangoFastCgiServer
qdjango-0.4.0/doc/html/ftv2vertline.png0000644000175000007640000000012612163016767017737 0ustar sharkyjerrywebPNG  IHDRɪ|IDATxݱðScOx@ y}IENDB`qdjango-0.4.0/doc/html/QDjangoUrlResolver_8h_source.html0000644000175000007640000003252412163016767023203 0ustar sharkyjerryweb QDjango: QDjangoUrlResolver.h Source File
QDjangoUrlResolver.h
1 /*
2  * Copyright (C) 2010-2012 Jeremy Lainé
3  * Contact: http://code.google.com/p/qdjango/
4  *
5  * This file is part of the QDjango Library.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  */
17 
18 #ifndef QDJANGO_URL_RESOLVER_H
19 #define QDJANGO_URL_RESOLVER_H
20 
21 #include <QObject>
22 #include <QVariant>
23 
24 #include "QDjangoHttp_p.h"
25 
26 class QDjangoHttpRequest;
28 class QDjangoUrlResolverPrivate;
29 class QRegExp;
30 
35 class QDJANGO_EXPORT QDjangoUrlResolver : public QObject
36 {
37  Q_OBJECT
38 
39 public:
40  QDjangoUrlResolver(QObject *parent = 0);
42 
43  bool include(const QRegExp &path, QDjangoUrlResolver *urls);
44  bool set(const QRegExp &path, QObject *receiver, const char *member);
45  QString reverse(QObject *receiver, const char *member, const QVariantList &args = QVariantList()) const;
46 
47 public slots:
48  QDjangoHttpResponse* respond(const QDjangoHttpRequest &request, const QString &path) const;
49 
50 private:
51  QDjangoUrlResolverPrivate *d;
52  friend class QDjangoUrlResolverPrivate;
53 };
54 
55 
56 #endif
qdjango-0.4.0/doc/html/sync_on.png0000644000175000007640000000151512163016767016760 0ustar sharkyjerrywebPNG  IHDRw=IDATx_HTY8i4-g6&kQ)!0URKڅ/PE>K-+K.YdEPaAZSܝ;3wgfsWK.Da'q_k DQCg 0Y:qZ)~L0HV z-C%g68%wUϿ }? ?3 K@h aaUe s~2&&B*Alji*˨,oƣT,d[3-*> LɟfkҠw#*AEjKUy>&{8m5Ki jjD*Nigw7DmzK۾M!k?o_lX#~XӑR*EՂדE;6e"Q(=Ezæ5Kؼָ_ 1zBJ X96jL^7{J1i@%8'7M_\Q#Uy Wo x8sv|Sn q_m >b[JX,4[T{Ratjjzz'ȶiIws KC^Y%6ꈺ]vhiWvh'̂|[^YrD=|sIENDB`qdjango-0.4.0/doc/html/classQDjangoMetaField-members.html0000644000175000007640000002144712163016767023252 0ustar sharkyjerryweb QDjango: Member List
QDjangoMetaField Member List

This is the complete list of members for QDjangoMetaField, including all inherited members.

column() const QDjangoMetaField
isAutoIncrement() const QDjangoMetaField
isBlank() const QDjangoMetaField
isNullable() const QDjangoMetaField
isUnique() const QDjangoMetaField
isValid() const QDjangoMetaField
maxLength() const QDjangoMetaField
name() const QDjangoMetaField
operator=(const QDjangoMetaField &other)QDjangoMetaField
QDjangoMetaField()QDjangoMetaField
QDjangoMetaField(const QDjangoMetaField &other)QDjangoMetaField
QDjangoMetaModel (defined in QDjangoMetaField)QDjangoMetaFieldfriend
toDatabase(const QVariant &value) const QDjangoMetaField
~QDjangoMetaField()QDjangoMetaField
qdjango-0.4.0/doc/html/classQDjangoFastCgiServer.html0000644000175000007640000003141512163016767022473 0ustar sharkyjerryweb QDjango: QDjangoFastCgiServer Class Reference
QDjangoFastCgiServer Class Reference

The QDjangoFastCgiServer class represents a FastCGI server. More...

#include <QDjangoFastCgiServer.h>

Inheritance diagram for QDjangoFastCgiServer:

Public Member Functions

 QDjangoFastCgiServer (QObject *parent=0)
 
 ~QDjangoFastCgiServer ()
 
void close ()
 
bool listen (const QString &name)
 
bool listen (const QHostAddress &address, quint16 port)
 
QDjangoUrlResolverurls () const
 

Detailed Description

The QDjangoFastCgiServer class represents a FastCGI server.

It allows you to create a FastCGI server which your reverse proxy (e.g. apache, nginx) will query to serve your web application.

To register views, see urls().

See Also
QDjangoHttpServer

Constructor & Destructor Documentation

QDjangoFastCgiServer::QDjangoFastCgiServer ( QObject *  parent = 0)

Constructs a new FastCGI server.

QDjangoFastCgiServer::~QDjangoFastCgiServer ( )

Destroys the FastCGI server.

Member Function Documentation

void QDjangoFastCgiServer::close ( )

Closes the server. The server will no longer listen for incoming connections.

bool QDjangoFastCgiServer::listen ( const QString &  name)

Tells the server to listen for incoming connections on the given local socket.

bool QDjangoFastCgiServer::listen ( const QHostAddress &  address,
quint16  port 
)

Tells the server to listen for incoming TCP connections on the given address and port.

QDjangoUrlResolver * QDjangoFastCgiServer::urls ( ) const

Returns the root URL resolver for the server, which dispatches requests to handlers.


The documentation for this class was generated from the following files:
qdjango-0.4.0/doc/html/functions_eval.html0000644000175000007640000001615512163016767020515 0ustar sharkyjerryweb QDjango: Class Members - Enumerator
QDjango
 
qdjango-0.4.0/doc/html/ftv2mnode.png0000644000175000007640000000036612163016767017217 0ustar sharkyjerrywebPNG  IHDRɪ|IDATx!NA\ Um@`5i`h W7] b&ofdY4 c 3v=]\B I=BB;k WN@vy4]Y|M}]x6a }dׇY>||5?>|B"'IENDB`qdjango-0.4.0/doc/html/classQDjangoWhere-members.html0000644000175000007640000003005412163016767022464 0ustar sharkyjerryweb QDjango: Member List
QDjangoWhere Member List

This is the complete list of members for QDjangoWhere, including all inherited members.

bindValues(QDjangoQuery &query) const QDjangoWhere
Contains enum valueQDjangoWhere
EndsWith enum valueQDjangoWhere
Equals enum valueQDjangoWhere
GreaterOrEquals enum valueQDjangoWhere
GreaterThan enum valueQDjangoWhere
isAll() const QDjangoWhere
IsIn enum valueQDjangoWhere
isNone() const QDjangoWhere
IsNull enum valueQDjangoWhere
LessOrEquals enum valueQDjangoWhere
LessThan enum valueQDjangoWhere
None enum valueQDjangoWhere
NotEquals enum valueQDjangoWhere
Operation enum nameQDjangoWhere
operator!() const QDjangoWhere
operator&&(const QDjangoWhere &other) const QDjangoWhere
operator=(const QDjangoWhere &other)QDjangoWhere
operator||(const QDjangoWhere &other) const QDjangoWhere
QDjangoCompiler (defined in QDjangoWhere)QDjangoWherefriend
QDjangoWhere()QDjangoWhere
QDjangoWhere(const QDjangoWhere &other)QDjangoWhere
QDjangoWhere(const QString &key, QDjangoWhere::Operation operation, QVariant value)QDjangoWhere
sql(const QSqlDatabase &db) const QDjangoWhere
StartsWith enum valueQDjangoWhere
~QDjangoWhere()QDjangoWhere
qdjango-0.4.0/doc/html/hierarchy.html0000644000175000007640000002412612163016767017451 0ustar sharkyjerryweb QDjango: Class Hierarchy
QDjango
Class Hierarchy
This inheritance list is sorted roughly, but not completely, alphabetically:
[detail level 12]
oCQDjangoQuerySet< T >::const_iterator
oCQDjangoSet of static functions
oCQDjangoHttpControllerStatic methods for replying to HTTP requests
oCQDjangoHttpRequestHTTP request
oCQDjangoMetaFieldHolds the database schema for a field
oCQDjangoMetaModelHolds the database schema for a model
oCQDjangoQuerySet< T >The QDjangoQuerySet class is a template class for performing database queries
oCQDjangoScriptStatic methods for making models scriptable
oCQDjangoWhereExpresses an SQL constraint
\CQObject
 oCQDjangoFastCgiServerFastCGI server
 oCQDjangoHttpResponseHTTP response
 oCQDjangoHttpServerHTTP server
 oCQDjangoModelBase class for all models
 \CQDjangoUrlResolverMaps incoming HTTP requests to handlers
qdjango-0.4.0/doc/html/closed.png0000644000175000007640000000020412163016767016553 0ustar sharkyjerrywebPNG  IHDR KIDATxm @!Gk7-`&sts@k}2 P%_N .:0Dk›x" ֛)x5IENDB`qdjango-0.4.0/doc/html/search/0000755000175000007640000000000012163016767016045 5ustar sharkyjerrywebqdjango-0.4.0/doc/html/search/enumvalues_6c.html0000644000175000007640000000177312163016767021517 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/search_r.png0000644000175000007640000000114412163016767020341 0ustar sharkyjerrywebPNG  IHDR] pHYs   cHRMms8zʴ3Dv6*IDATxڤԿAo kVi|YIR߼C+Lg,R\B$`4)BPA!UI( 檧Ïsu:‰B$|~Z,?J^ZR.F!`08 eY$I
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_67.html0000644000175000007640000000176412163016767020027 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_71.js0000644000175000007640000000607012163016767017465 0ustar sharkyjerrywebvar searchData= [ ['qdjango',['QDjango',['../classQDjango.html',1,'']]], ['qdjangofastcgiserver',['QDjangoFastCgiServer',['../classQDjangoFastCgiServer.html',1,'QDjangoFastCgiServer'],['../classQDjangoFastCgiServer.html#afcefe8dfbd329d666f40ca42c8cf0162',1,'QDjangoFastCgiServer::QDjangoFastCgiServer()']]], ['qdjangohttpcontroller',['QDjangoHttpController',['../classQDjangoHttpController.html',1,'']]], ['qdjangohttprequest',['QDjangoHttpRequest',['../classQDjangoHttpRequest.html',1,'QDjangoHttpRequest'],['../classQDjangoHttpRequest.html#ab95882169fb45152b9ebefb54700cefb',1,'QDjangoHttpRequest::QDjangoHttpRequest()']]], ['qdjangohttpresponse',['QDjangoHttpResponse',['../classQDjangoHttpResponse.html',1,'QDjangoHttpResponse'],['../classQDjangoHttpResponse.html#a7e6fff0888bef878bec92d2de205cb10',1,'QDjangoHttpResponse::QDjangoHttpResponse()']]], ['qdjangohttpserver',['QDjangoHttpServer',['../classQDjangoHttpServer.html',1,'QDjangoHttpServer'],['../classQDjangoHttpServer.html#ac2ba6269ef45e693c6769c259d43d140',1,'QDjangoHttpServer::QDjangoHttpServer()']]], ['qdjangometafield',['QDjangoMetaField',['../classQDjangoMetaField.html',1,'QDjangoMetaField'],['../classQDjangoMetaField.html#a8cc27dd70c459945614924253ad5a12f',1,'QDjangoMetaField::QDjangoMetaField()'],['../classQDjangoMetaField.html#a81bd79a8da2107e509b86646785ac103',1,'QDjangoMetaField::QDjangoMetaField(const QDjangoMetaField &other)']]], ['qdjangometamodel',['QDjangoMetaModel',['../classQDjangoMetaModel.html',1,'QDjangoMetaModel'],['../classQDjangoMetaModel.html#a1b754865128373d45816c2c2f7cd4174',1,'QDjangoMetaModel::QDjangoMetaModel(const QMetaObject *model=0)'],['../classQDjangoMetaModel.html#a1c072d0d1dac763fb748a30adee36703',1,'QDjangoMetaModel::QDjangoMetaModel(const QDjangoMetaModel &other)']]], ['qdjangomodel',['QDjangoModel',['../classQDjangoModel.html',1,'QDjangoModel'],['../classQDjangoModel.html#a17618c2c2704ca50bcb2a42af8563c75',1,'QDjangoModel::QDjangoModel()']]], ['qdjangoqueryset',['QDjangoQuerySet',['../classQDjangoQuerySet.html',1,'QDjangoQuerySet< T >'],['../classQDjangoQuerySet.html#ac6be94907f26e73d589cb27089f5704f',1,'QDjangoQuerySet::QDjangoQuerySet()'],['../classQDjangoQuerySet.html#acda717c88cfac9caeab2064c85b8c43f',1,'QDjangoQuerySet::QDjangoQuerySet(const QDjangoQuerySet< T > &other)']]], ['qdjangoscript',['QDjangoScript',['../classQDjangoScript.html',1,'']]], ['qdjangourlresolver',['QDjangoUrlResolver',['../classQDjangoUrlResolver.html',1,'QDjangoUrlResolver'],['../classQDjangoUrlResolver.html#a95234626d964271a5011b16e3d7261d0',1,'QDjangoUrlResolver::QDjangoUrlResolver()']]], ['qdjangowhere',['QDjangoWhere',['../classQDjangoWhere.html',1,'QDjangoWhere'],['../classQDjangoWhere.html#a50ac19701294ddb6685fe94d3295443d',1,'QDjangoWhere::QDjangoWhere()'],['../classQDjangoWhere.html#a10670a3c8b20ad09ba8075598f5bb1d2',1,'QDjangoWhere::QDjangoWhere(const QDjangoWhere &other)'],['../classQDjangoWhere.html#ae6c00db74d95e8ec392c26fb5db527f9',1,'QDjangoWhere::QDjangoWhere(const QString &key, QDjangoWhere::Operation operation, QVariant value)']]] ]; qdjango-0.4.0/doc/html/search/all_70.html0000644000175000007640000000176412163016767020021 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_6f.html0000644000175000007640000000176412163016767020106 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/functions_70.html0000644000175000007640000000177212163016767021260 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/functions_70.js0000644000175000007640000000056212163016767020724 0ustar sharkyjerrywebvar searchData= [ ['path',['path',['../classQDjangoHttpRequest.html#a412998283362816e59a4ef0fadc8a03c',1,'QDjangoHttpRequest']]], ['post',['post',['../classQDjangoHttpRequest.html#af91093f8f4bd224a0bedc113fc2bee1a',1,'QDjangoHttpRequest']]], ['primarykey',['primaryKey',['../classQDjangoMetaModel.html#aa8e9c3859f80193ae9c4af8d990a9f80',1,'QDjangoMetaModel']]] ]; qdjango-0.4.0/doc/html/search/all_72.html0000644000175000007640000000176412163016767020023 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_66.html0000644000175000007640000000176412163016767020026 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_6e.html0000644000175000007640000000176412163016767020105 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/pages_6d.js0000644000175000007640000000013012163016767020065 0ustar sharkyjerrywebvar searchData= [ ['making_20queries',['Making queries',['../queries.html',1,'']]] ]; qdjango-0.4.0/doc/html/search/enumvalues_6c.js0000644000175000007640000000047212163016767021162 0ustar sharkyjerrywebvar searchData= [ ['lessorequals',['LessOrEquals',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61aa04ad6dd35036b63aea54927a94de4fd',1,'QDjangoWhere']]], ['lessthan',['LessThan',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61a9d0e59798a8fd57f07c3320db0827d7c',1,'QDjangoWhere']]] ]; qdjango-0.4.0/doc/html/search/pages_64.html0000644000175000007640000000176612163016767020355 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/functions_71.html0000644000175000007640000000177212163016767021261 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_6c.html0000644000175000007640000000176412163016767020103 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/enumvalues_63.js0000644000175000007640000000024312163016767021076 0ustar sharkyjerrywebvar searchData= [ ['contains',['Contains',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61a8fac1f24f799537e2b077f8d9630d914',1,'QDjangoWhere']]] ]; qdjango-0.4.0/doc/html/search/functions_6f.html0000644000175000007640000000177212163016767021345 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_67.js0000644000175000007640000000124312163016767017467 0ustar sharkyjerrywebvar searchData= [ ['get',['get',['../classQDjangoQuerySet.html#a05318c9ee9b5b0ff81d8ebe23dd9d6c7',1,'QDjangoQuerySet::get()'],['../classQDjangoHttpRequest.html#a773b0d4f50e74c54a093d54014fa35d5',1,'QDjangoHttpRequest::get()']]], ['getbasicauth',['getBasicAuth',['../classQDjangoHttpController.html#a5d16038304e7b60c9060d0ec48b78ac7',1,'QDjangoHttpController']]], ['greaterorequals',['GreaterOrEquals',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61ac3ecafdfa0556367e134966c90a52fca',1,'QDjangoWhere']]], ['greaterthan',['GreaterThan',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61ae3974d19c6f746d096f98aa3d63798a0',1,'QDjangoWhere']]] ]; qdjango-0.4.0/doc/html/search/functions_61.js0000644000175000007640000000034612163016767020724 0ustar sharkyjerrywebvar searchData= [ ['all',['all',['../classQDjangoQuerySet.html#a287a68a0977e431b05f5e44493aac1bc',1,'QDjangoQuerySet']]], ['at',['at',['../classQDjangoQuerySet.html#a1bcfbffb6676f4ec19f9278c3f0adf4f',1,'QDjangoQuerySet']]] ]; qdjango-0.4.0/doc/html/search/functions_75.js0000644000175000007640000000054512163016767020732 0ustar sharkyjerrywebvar searchData= [ ['update',['update',['../classQDjangoQuerySet.html#a467e97426c6f19a118d1ff77b59f9431',1,'QDjangoQuerySet']]], ['urls',['urls',['../classQDjangoFastCgiServer.html#a573ce8ce7f46d76e3bcdc90b455ecc67',1,'QDjangoFastCgiServer::urls()'],['../classQDjangoHttpServer.html#a07f654016ad6113e1c1ff50e345666ef',1,'QDjangoHttpServer::urls()']]] ]; qdjango-0.4.0/doc/html/search/all_6d.js0000644000175000007640000000067012163016767017547 0ustar sharkyjerrywebvar searchData= [ ['maxlength',['maxLength',['../classQDjangoMetaField.html#ac5b8fe43394eee0ed4ed1df490342835',1,'QDjangoMetaField']]], ['meta',['meta',['../classQDjangoHttpRequest.html#a5e1bcaef5f0e58275b25322b36423593',1,'QDjangoHttpRequest']]], ['method',['method',['../classQDjangoHttpRequest.html#af53ea376feeccd67fa2fe61ffb56fa26',1,'QDjangoHttpRequest']]], ['making_20queries',['Making queries',['../queries.html',1,'']]] ]; qdjango-0.4.0/doc/html/search/all_73.html0000644000175000007640000000176412163016767020024 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/classes_63.js0000644000175000007640000000020712163016767020347 0ustar sharkyjerrywebvar searchData= [ ['const_5fiterator',['const_iterator',['../classQDjangoQuerySet_1_1const__iterator.html',1,'QDjangoQuerySet']]] ]; qdjango-0.4.0/doc/html/search/all_66.js0000644000175000007640000000075312163016767017473 0ustar sharkyjerrywebvar searchData= [ ['filter',['filter',['../classQDjangoQuerySet.html#a5fc458cda1b34cad3d9f4f99224feae6',1,'QDjangoQuerySet']]], ['foreignfields',['foreignFields',['../classQDjangoMetaModel.html#aeb5c323f4f1e0925d00e2f081afdbe0c',1,'QDjangoMetaModel']]], ['foreignkey',['foreignKey',['../classQDjangoMetaModel.html#a22062f4798b05b42d40d260160581d2d',1,'QDjangoMetaModel::foreignKey()'],['../classQDjangoModel.html#a3b6d25d1ed112a154d6973f230427d1f',1,'QDjangoModel::foreignKey()']]] ]; qdjango-0.4.0/doc/html/search/nomatches.html0000644000175000007640000000071512163016767020717 0ustar sharkyjerryweb
No Matches
qdjango-0.4.0/doc/html/search/groups_68.js0000644000175000007640000000010612163016767020234 0ustar sharkyjerrywebvar searchData= [ ['http',['Http',['../group__Http.html',1,'']]] ]; qdjango-0.4.0/doc/html/search/functions_71.js0000644000175000007640000000423212163016767020723 0ustar sharkyjerrywebvar searchData= [ ['qdjangofastcgiserver',['QDjangoFastCgiServer',['../classQDjangoFastCgiServer.html#afcefe8dfbd329d666f40ca42c8cf0162',1,'QDjangoFastCgiServer']]], ['qdjangohttprequest',['QDjangoHttpRequest',['../classQDjangoHttpRequest.html#ab95882169fb45152b9ebefb54700cefb',1,'QDjangoHttpRequest']]], ['qdjangohttpresponse',['QDjangoHttpResponse',['../classQDjangoHttpResponse.html#a7e6fff0888bef878bec92d2de205cb10',1,'QDjangoHttpResponse']]], ['qdjangohttpserver',['QDjangoHttpServer',['../classQDjangoHttpServer.html#ac2ba6269ef45e693c6769c259d43d140',1,'QDjangoHttpServer']]], ['qdjangometafield',['QDjangoMetaField',['../classQDjangoMetaField.html#a8cc27dd70c459945614924253ad5a12f',1,'QDjangoMetaField::QDjangoMetaField()'],['../classQDjangoMetaField.html#a81bd79a8da2107e509b86646785ac103',1,'QDjangoMetaField::QDjangoMetaField(const QDjangoMetaField &other)']]], ['qdjangometamodel',['QDjangoMetaModel',['../classQDjangoMetaModel.html#a1b754865128373d45816c2c2f7cd4174',1,'QDjangoMetaModel::QDjangoMetaModel(const QMetaObject *model=0)'],['../classQDjangoMetaModel.html#a1c072d0d1dac763fb748a30adee36703',1,'QDjangoMetaModel::QDjangoMetaModel(const QDjangoMetaModel &other)']]], ['qdjangomodel',['QDjangoModel',['../classQDjangoModel.html#a17618c2c2704ca50bcb2a42af8563c75',1,'QDjangoModel']]], ['qdjangoqueryset',['QDjangoQuerySet',['../classQDjangoQuerySet.html#ac6be94907f26e73d589cb27089f5704f',1,'QDjangoQuerySet::QDjangoQuerySet()'],['../classQDjangoQuerySet.html#acda717c88cfac9caeab2064c85b8c43f',1,'QDjangoQuerySet::QDjangoQuerySet(const QDjangoQuerySet< T > &other)']]], ['qdjangourlresolver',['QDjangoUrlResolver',['../classQDjangoUrlResolver.html#a95234626d964271a5011b16e3d7261d0',1,'QDjangoUrlResolver']]], ['qdjangowhere',['QDjangoWhere',['../classQDjangoWhere.html#a50ac19701294ddb6685fe94d3295443d',1,'QDjangoWhere::QDjangoWhere()'],['../classQDjangoWhere.html#a10670a3c8b20ad09ba8075598f5bb1d2',1,'QDjangoWhere::QDjangoWhere(const QDjangoWhere &other)'],['../classQDjangoWhere.html#ae6c00db74d95e8ec392c26fb5db527f9',1,'QDjangoWhere::QDjangoWhere(const QString &key, QDjangoWhere::Operation operation, QVariant value)']]] ]; qdjango-0.4.0/doc/html/search/functions_65.html0000644000175000007640000000177212163016767021264 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_63.html0000644000175000007640000000176412163016767020023 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/enumvalues_67.js0000644000175000007640000000050612163016767021104 0ustar sharkyjerrywebvar searchData= [ ['greaterorequals',['GreaterOrEquals',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61ac3ecafdfa0556367e134966c90a52fca',1,'QDjangoWhere']]], ['greaterthan',['GreaterThan',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61ae3974d19c6f746d096f98aa3d63798a0',1,'QDjangoWhere']]] ]; qdjango-0.4.0/doc/html/search/groups_68.html0000644000175000007640000000176712163016767020602 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_6e.js0000644000175000007640000000100112163016767017535 0ustar sharkyjerrywebvar searchData= [ ['name',['name',['../classQDjangoMetaField.html#ae0c9e3e20586b5a9a1b3bcc39e92475a',1,'QDjangoMetaField']]], ['none',['none',['../classQDjangoQuerySet.html#a976f1184c6c036ce0d3c414761eb581c',1,'QDjangoQuerySet::none()'],['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61a14cc20ae36e119b2fb9fbec217c3cb4d',1,'QDjangoWhere::None()']]], ['notequals',['NotEquals',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61a1a733f4d536e1a12ca5cfb791e00ed8c',1,'QDjangoWhere']]] ]; qdjango-0.4.0/doc/html/search/functions_76.js0000644000175000007640000000037412163016767020733 0ustar sharkyjerrywebvar searchData= [ ['values',['values',['../classQDjangoQuerySet.html#a9e558d61d83f171a3e627295d544ccb1',1,'QDjangoQuerySet']]], ['valueslist',['valuesList',['../classQDjangoQuerySet.html#a7125a4bf5e722c8af322c1b6e4be05b0',1,'QDjangoQuerySet']]] ]; qdjango-0.4.0/doc/html/search/functions_69.js0000644000175000007640000000224412163016767020733 0ustar sharkyjerrywebvar searchData= [ ['include',['include',['../classQDjangoUrlResolver.html#ad0d06c383a2788d366e6f350879854c4',1,'QDjangoUrlResolver']]], ['isall',['isAll',['../classQDjangoWhere.html#a013cbab47caf55963346ae8dee1a2400',1,'QDjangoWhere']]], ['isautoincrement',['isAutoIncrement',['../classQDjangoMetaField.html#a69d755fefa2d6f9b5d270d41bce0221b',1,'QDjangoMetaField']]], ['isblank',['isBlank',['../classQDjangoMetaField.html#a4f63e58b551affa7ad06a0ea813fea54',1,'QDjangoMetaField']]], ['isdebugenabled',['isDebugEnabled',['../classQDjango.html#af3e7f569631b1af5933b4d8a9412c23e',1,'QDjango']]], ['isnone',['isNone',['../classQDjangoWhere.html#a9bea36462cdac72a99b7ebd237fb7a2b',1,'QDjangoWhere']]], ['isnullable',['isNullable',['../classQDjangoMetaField.html#aa871f2f95d91ab9705510972633231d3',1,'QDjangoMetaField']]], ['isready',['isReady',['../classQDjangoHttpResponse.html#a332da8b361deeab1be1945f32b37830d',1,'QDjangoHttpResponse']]], ['isunique',['isUnique',['../classQDjangoMetaField.html#af971cecad6f1ed4d2b45ac065be26394',1,'QDjangoMetaField']]], ['isvalid',['isValid',['../classQDjangoMetaField.html#af796c5c13565804956be6f55f7c8bc9a',1,'QDjangoMetaField']]] ]; qdjango-0.4.0/doc/html/search/enumvalues_69.js0000644000175000007640000000044612163016767021111 0ustar sharkyjerrywebvar searchData= [ ['isin',['IsIn',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61a8141b3f1eb7e08118029260548d923fc',1,'QDjangoWhere']]], ['isnull',['IsNull',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61a873665d3b466c7315cbb80bb5bcb1d01',1,'QDjangoWhere']]] ]; qdjango-0.4.0/doc/html/search/enums_68.html0000644000175000007640000000176612163016767020411 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/search_l.png0000644000175000007640000000113412163016767020332 0ustar sharkyjerrywebPNG  IHDR- pHYs   cHRMms8zʴ3Dv6*IDATxڬT=P~91M@0FPD/ѡ.;JtCڥ܊D(I.xo4hpFD8Ecmmnnl1 ,"vh4zl6{D:iP%>aax
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/enumvalues_63.html0000644000175000007640000000177312163016767021437 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_77.html0000644000175000007640000000176412163016767020030 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/search_m.png0000644000175000007640000000023612163016767020335 0ustar sharkyjerrywebPNG  IHDR5^KMgAMAOX2tEXtSoftwareAdobe ImageReadyqe<0IDATxb,//g```<~8#?bbZP,Xnݺ <~EIENDB`qdjango-0.4.0/doc/html/search/enumvalues_6e.html0000644000175000007640000000177312163016767021521 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/close.png0000644000175000007640000000042112163016767017655 0ustar sharkyjerrywebPNG  IHDR w&IDATuQF@  C5Cg3(w{#*&9}Ͳ,ض y""q<ϑi8K߾6 Ce(;//BVx</ڶEUUte,"gL}ߣk2VSF1 s1 DZwA$IYQ[ ouk*AiWY(G/0{A,)eln]? yEIENDB`qdjango-0.4.0/doc/html/search/all_64.js0000644000175000007640000000101012163016767017454 0ustar sharkyjerrywebvar searchData= [ ['database',['database',['../classQDjango.html#a944127defa81b71150ae052fe596720f',1,'QDjango::database()'],['../group__Database.html',1,'(Global Namespace)'],['../database.html',1,'(Global Namespace)']]], ['droptable',['dropTable',['../classQDjangoMetaModel.html#af3d2abee49df5f47d04e55c10df83abf',1,'QDjangoMetaModel']]], ['droptables',['dropTables',['../classQDjango.html#a048353657fcc85d02d136f0342da42c5',1,'QDjango']]], ['database_20models',['Database models',['../models.html',1,'']]] ]; qdjango-0.4.0/doc/html/search/all_63.js0000644000175000007640000000342112163016767017463 0ustar sharkyjerrywebvar searchData= [ ['close',['close',['../classQDjangoFastCgiServer.html#a826d0416c093391b394fbdf987bd0224',1,'QDjangoFastCgiServer::close()'],['../classQDjangoHttpServer.html#a6c8489586be55abfb30e91f1ad285ec3',1,'QDjangoHttpServer::close()']]], ['column',['column',['../classQDjangoMetaField.html#a717f09baae7cf63bd9c28916c377a67d',1,'QDjangoMetaField']]], ['const_5fiterator',['const_iterator',['../classQDjangoQuerySet_1_1const__iterator.html',1,'QDjangoQuerySet']]], ['const_5fiterator',['const_iterator',['../classQDjangoQuerySet_1_1const__iterator.html#a1f1a96de41f3a62077f99259c9a41815',1,'QDjangoQuerySet::const_iterator::const_iterator()'],['../classQDjangoQuerySet_1_1const__iterator.html#a10765b3161c9189064896023cf55c33f',1,'QDjangoQuerySet::const_iterator::const_iterator(const const_iterator &other)']]], ['constbegin',['constBegin',['../classQDjangoQuerySet.html#aebaf89dae3fd33cc787349b398b60da4',1,'QDjangoQuerySet']]], ['constend',['constEnd',['../classQDjangoQuerySet.html#a6fc354bc092ad900bbaba96d77801839',1,'QDjangoQuerySet']]], ['constiterator',['ConstIterator',['../classQDjangoQuerySet.html#a5427734628b61bf759b84161f3cf36b4',1,'QDjangoQuerySet']]], ['contains',['Contains',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61a8fac1f24f799537e2b077f8d9630d914',1,'QDjangoWhere']]], ['count',['count',['../classQDjangoQuerySet.html#a90bfd4aecf07372b2d68c56b345e12a8',1,'QDjangoQuerySet']]], ['createtable',['createTable',['../classQDjangoMetaModel.html#a74cac06c7bfa638042cf1ad3d81b2f7c',1,'QDjangoMetaModel']]], ['createtables',['createTables',['../classQDjango.html#a7b2c53fdd96b3d6db199e411bb76f0f4',1,'QDjango']]], ['createtablesql',['createTableSql',['../classQDjangoMetaModel.html#a2d0acd62d428910a0700b34f068b78a3',1,'QDjangoMetaModel']]] ]; qdjango-0.4.0/doc/html/search/groups_64.html0000644000175000007640000000176712163016767020576 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/enumvalues_65.html0000644000175000007640000000177312163016767021441 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_6c.js0000644000175000007640000000224412163016767017545 0ustar sharkyjerrywebvar searchData= [ ['lessorequals',['LessOrEquals',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61aa04ad6dd35036b63aea54927a94de4fd',1,'QDjangoWhere']]], ['lessthan',['LessThan',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61a9d0e59798a8fd57f07c3320db0827d7c',1,'QDjangoWhere']]], ['limit',['limit',['../classQDjangoQuerySet.html#af353175373ce8a2087ed42840be58f4c',1,'QDjangoQuerySet']]], ['listen',['listen',['../classQDjangoFastCgiServer.html#a7d104eaf5a3d5a1bce0e07b0947ef86a',1,'QDjangoFastCgiServer::listen(const QString &name)'],['../classQDjangoFastCgiServer.html#a842eba0a96b883f48e38629bee8906ce',1,'QDjangoFastCgiServer::listen(const QHostAddress &address, quint16 port)'],['../classQDjangoHttpServer.html#a1ea40c79bfc1b55c2d06cdef8355ae26',1,'QDjangoHttpServer::listen()']]], ['load',['load',['../classQDjangoMetaModel.html#a754b0ae26c7019bce1a46aaf62bc0fee',1,'QDjangoMetaModel']]], ['localfield',['localField',['../classQDjangoMetaModel.html#ab75c14bc40f7afcd2519a216983d08b3',1,'QDjangoMetaModel']]], ['localfields',['localFields',['../classQDjangoMetaModel.html#aa681629f5b2c744bfb7613d2dcc7fe90',1,'QDjangoMetaModel']]] ]; qdjango-0.4.0/doc/html/search/all_64.html0000644000175000007640000000176412163016767020024 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_73.js0000644000175000007640000000552712163016767017475 0ustar sharkyjerrywebvar searchData= [ ['save',['save',['../classQDjangoMetaModel.html#a6837d4f7f1d89327516e2e9ad39bef32',1,'QDjangoMetaModel::save()'],['../classQDjangoModel.html#a74616d7699ea6f0156a7ad80955a484a',1,'QDjangoModel::save()']]], ['script',['Script',['../group__Script.html',1,'']]], ['scripting_20models',['Scripting models',['../scripting.html',1,'']]], ['selectrelated',['selectRelated',['../classQDjangoQuerySet.html#ac9633a4c3e92d30411df2fdd39090dab',1,'QDjangoQuerySet']]], ['serveauthorizationrequired',['serveAuthorizationRequired',['../classQDjangoHttpController.html#a1fe68af15977005370ac23633b305b7b',1,'QDjangoHttpController']]], ['servebadrequest',['serveBadRequest',['../classQDjangoHttpController.html#a6bf1064236afe030b94fe779676cbbc8',1,'QDjangoHttpController']]], ['serveinternalservererror',['serveInternalServerError',['../classQDjangoHttpController.html#a0b5b7ec8be16b1012f9d09f95fc0469a',1,'QDjangoHttpController']]], ['servenotfound',['serveNotFound',['../classQDjangoHttpController.html#adbc2c527604240c1c23ad417533c81ae',1,'QDjangoHttpController']]], ['serveredirect',['serveRedirect',['../classQDjangoHttpController.html#a5aaa6c9a7fa7b925a60d6127c92e47e2',1,'QDjangoHttpController']]], ['servestatic',['serveStatic',['../classQDjangoHttpController.html#aff791959526b022f5f33d0e092d779c5',1,'QDjangoHttpController']]], ['set',['set',['../classQDjangoUrlResolver.html#adec43858d061198b245c4467a3d00e41',1,'QDjangoUrlResolver']]], ['setbody',['setBody',['../classQDjangoHttpResponse.html#a3e892d1bb7050c5afa169e8e654c406d',1,'QDjangoHttpResponse']]], ['setdatabase',['setDatabase',['../classQDjango.html#a9a6962db6d787d8bcadc525a01fa6a2d',1,'QDjango']]], ['setdebugenabled',['setDebugEnabled',['../classQDjango.html#a76320043c64f142e619122178659d69c',1,'QDjango']]], ['setforeignkey',['setForeignKey',['../classQDjangoMetaModel.html#a603c0ccdef63152602d4bcb1b79b1a82',1,'QDjangoMetaModel::setForeignKey()'],['../classQDjangoModel.html#a060e30783f3e08e7a2d0843c3d9e4c8f',1,'QDjangoModel::setForeignKey()']]], ['setheader',['setHeader',['../classQDjangoHttpResponse.html#afc690a773b570998b5aa7ec3ebbf5452',1,'QDjangoHttpResponse']]], ['setpk',['setPk',['../classQDjangoModel.html#a182d1bc9588e6707b31af03ef9feff25',1,'QDjangoModel']]], ['setstatuscode',['setStatusCode',['../classQDjangoHttpResponse.html#aa9e8e7be8f27d71ce50444cda267264d',1,'QDjangoHttpResponse']]], ['size',['size',['../classQDjangoQuerySet.html#a90a5cd47b75e0cee952461ab574b3f46',1,'QDjangoQuerySet']]], ['sql',['sql',['../classQDjangoWhere.html#a62a68d37e044cd5bbb0c53f4c8d5f4ba',1,'QDjangoWhere']]], ['startswith',['StartsWith',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61a2c59d066559ebd6ebd37d65f9ac33622',1,'QDjangoWhere']]], ['statuscode',['statusCode',['../classQDjangoHttpResponse.html#aa1cdb7432f4c9fe5bdf29d8cf0f1a032',1,'QDjangoHttpResponse']]] ]; qdjango-0.4.0/doc/html/search/all_7e.js0000644000175000007640000000217012163016767017546 0ustar sharkyjerrywebvar searchData= [ ['_7eqdjangofastcgiserver',['~QDjangoFastCgiServer',['../classQDjangoFastCgiServer.html#ab30091c8e9716fbdb70f3a8d6a41e01c',1,'QDjangoFastCgiServer']]], ['_7eqdjangohttprequest',['~QDjangoHttpRequest',['../classQDjangoHttpRequest.html#a70335989bd56e375c1a562308ca4a79f',1,'QDjangoHttpRequest']]], ['_7eqdjangohttpresponse',['~QDjangoHttpResponse',['../classQDjangoHttpResponse.html#a34309ddda4aa778eea2f14cfd383fbdf',1,'QDjangoHttpResponse']]], ['_7eqdjangohttpserver',['~QDjangoHttpServer',['../classQDjangoHttpServer.html#a3a22c79e296f07a419992f41542691ac',1,'QDjangoHttpServer']]], ['_7eqdjangometafield',['~QDjangoMetaField',['../classQDjangoMetaField.html#ab1999fd8b6ff75f36e7f5f048263e6ae',1,'QDjangoMetaField']]], ['_7eqdjangometamodel',['~QDjangoMetaModel',['../classQDjangoMetaModel.html#a0377fb890378d4c715a717dddecd05f5',1,'QDjangoMetaModel']]], ['_7eqdjangoqueryset',['~QDjangoQuerySet',['../classQDjangoQuerySet.html#a6998688bf21743c6eac0a9f53b906e25',1,'QDjangoQuerySet']]], ['_7eqdjangowhere',['~QDjangoWhere',['../classQDjangoWhere.html#a79c6943b5f2c9711b5480082c0832f8b',1,'QDjangoWhere']]] ]; qdjango-0.4.0/doc/html/search/functions_75.html0000644000175000007640000000177212163016767021265 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/functions_63.js0000644000175000007640000000262112163016767020724 0ustar sharkyjerrywebvar searchData= [ ['close',['close',['../classQDjangoFastCgiServer.html#a826d0416c093391b394fbdf987bd0224',1,'QDjangoFastCgiServer::close()'],['../classQDjangoHttpServer.html#a6c8489586be55abfb30e91f1ad285ec3',1,'QDjangoHttpServer::close()']]], ['column',['column',['../classQDjangoMetaField.html#a717f09baae7cf63bd9c28916c377a67d',1,'QDjangoMetaField']]], ['const_5fiterator',['const_iterator',['../classQDjangoQuerySet_1_1const__iterator.html#a1f1a96de41f3a62077f99259c9a41815',1,'QDjangoQuerySet::const_iterator::const_iterator()'],['../classQDjangoQuerySet_1_1const__iterator.html#a10765b3161c9189064896023cf55c33f',1,'QDjangoQuerySet::const_iterator::const_iterator(const const_iterator &other)']]], ['constbegin',['constBegin',['../classQDjangoQuerySet.html#aebaf89dae3fd33cc787349b398b60da4',1,'QDjangoQuerySet']]], ['constend',['constEnd',['../classQDjangoQuerySet.html#a6fc354bc092ad900bbaba96d77801839',1,'QDjangoQuerySet']]], ['count',['count',['../classQDjangoQuerySet.html#a90bfd4aecf07372b2d68c56b345e12a8',1,'QDjangoQuerySet']]], ['createtable',['createTable',['../classQDjangoMetaModel.html#a74cac06c7bfa638042cf1ad3d81b2f7c',1,'QDjangoMetaModel']]], ['createtables',['createTables',['../classQDjango.html#a7b2c53fdd96b3d6db199e411bb76f0f4',1,'QDjango']]], ['createtablesql',['createTableSql',['../classQDjangoMetaModel.html#a2d0acd62d428910a0700b34f068b78a3',1,'QDjangoMetaModel']]] ]; qdjango-0.4.0/doc/html/search/enums_6f.js0000644000175000007640000000020412163016767020121 0ustar sharkyjerrywebvar searchData= [ ['operation',['Operation',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61',1,'QDjangoWhere']]] ]; qdjango-0.4.0/doc/html/search/functions_6c.js0000644000175000007640000000157612163016767021014 0ustar sharkyjerrywebvar searchData= [ ['limit',['limit',['../classQDjangoQuerySet.html#af353175373ce8a2087ed42840be58f4c',1,'QDjangoQuerySet']]], ['listen',['listen',['../classQDjangoFastCgiServer.html#a7d104eaf5a3d5a1bce0e07b0947ef86a',1,'QDjangoFastCgiServer::listen(const QString &name)'],['../classQDjangoFastCgiServer.html#a842eba0a96b883f48e38629bee8906ce',1,'QDjangoFastCgiServer::listen(const QHostAddress &address, quint16 port)'],['../classQDjangoHttpServer.html#a1ea40c79bfc1b55c2d06cdef8355ae26',1,'QDjangoHttpServer::listen()']]], ['load',['load',['../classQDjangoMetaModel.html#a754b0ae26c7019bce1a46aaf62bc0fee',1,'QDjangoMetaModel']]], ['localfield',['localField',['../classQDjangoMetaModel.html#ab75c14bc40f7afcd2519a216983d08b3',1,'QDjangoMetaModel']]], ['localfields',['localFields',['../classQDjangoMetaModel.html#aa681629f5b2c744bfb7613d2dcc7fe90',1,'QDjangoMetaModel']]] ]; qdjango-0.4.0/doc/html/search/all_72.js0000644000175000007640000000222512163016767017464 0ustar sharkyjerrywebvar searchData= [ ['ready',['ready',['../classQDjangoHttpResponse.html#a08e9dd15a48e58d108c61fcd75111efe',1,'QDjangoHttpResponse']]], ['registermodel',['registerModel',['../classQDjango.html#ad5c33aff92420cc2984894683e25d86c',1,'QDjango::registerModel()'],['../classQDjangoScript.html#aa5d4323bf975d73ae480903ab7caee63',1,'QDjangoScript::registerModel()']]], ['registerwhere',['registerWhere',['../classQDjangoScript.html#a8efa64b848d95de8956a63ef13e8d55f',1,'QDjangoScript']]], ['remove',['remove',['../classQDjangoMetaModel.html#a3b0a36043675008e7114b420a73e3f62',1,'QDjangoMetaModel::remove()'],['../classQDjangoModel.html#add5761ed0860fc1e4e6d2e8b3601b4ee',1,'QDjangoModel::remove()'],['../classQDjangoQuerySet.html#ad174f57f5b4091aeba43482ac3b0635f',1,'QDjangoQuerySet::remove()']]], ['requestfinished',['requestFinished',['../classQDjangoHttpServer.html#adf578de15d401fbdb391f3e4c6672f12',1,'QDjangoHttpServer']]], ['respond',['respond',['../classQDjangoUrlResolver.html#a232c8538036a82c73dbc894481231df7',1,'QDjangoUrlResolver']]], ['reverse',['reverse',['../classQDjangoUrlResolver.html#ab771ce59f7a55a610822170f148b0c79',1,'QDjangoUrlResolver']]] ]; qdjango-0.4.0/doc/html/search/pages_6d.html0000644000175000007640000000176612163016767020435 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_74.js0000644000175000007640000000055412163016767017471 0ustar sharkyjerrywebvar searchData= [ ['table',['table',['../classQDjangoMetaModel.html#ad05a604af4863c82dbb8b6b76514fb8e',1,'QDjangoMetaModel']]], ['todatabase',['toDatabase',['../classQDjangoMetaField.html#adc781decc92e0ff78ae60ec4a22a83bf',1,'QDjangoMetaField']]], ['tostring',['toString',['../classQDjangoModel.html#a98d5c5ea2b0dec3b7787d4ed2cfea913',1,'QDjangoModel']]] ]; qdjango-0.4.0/doc/html/search/functions_64.html0000644000175000007640000000177212163016767021263 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/properties_70.js0000644000175000007640000000016612163016767021110 0ustar sharkyjerrywebvar searchData= [ ['pk',['pk',['../classQDjangoModel.html#a4958bd5f7b02304b51d33e66684dcbb1',1,'QDjangoModel']]] ]; qdjango-0.4.0/doc/html/search/classes_71.js0000644000175000007640000000211412163016767020345 0ustar sharkyjerrywebvar searchData= [ ['qdjango',['QDjango',['../classQDjango.html',1,'']]], ['qdjangofastcgiserver',['QDjangoFastCgiServer',['../classQDjangoFastCgiServer.html',1,'']]], ['qdjangohttpcontroller',['QDjangoHttpController',['../classQDjangoHttpController.html',1,'']]], ['qdjangohttprequest',['QDjangoHttpRequest',['../classQDjangoHttpRequest.html',1,'']]], ['qdjangohttpresponse',['QDjangoHttpResponse',['../classQDjangoHttpResponse.html',1,'']]], ['qdjangohttpserver',['QDjangoHttpServer',['../classQDjangoHttpServer.html',1,'']]], ['qdjangometafield',['QDjangoMetaField',['../classQDjangoMetaField.html',1,'']]], ['qdjangometamodel',['QDjangoMetaModel',['../classQDjangoMetaModel.html',1,'']]], ['qdjangomodel',['QDjangoModel',['../classQDjangoModel.html',1,'']]], ['qdjangoqueryset',['QDjangoQuerySet',['../classQDjangoQuerySet.html',1,'']]], ['qdjangoscript',['QDjangoScript',['../classQDjangoScript.html',1,'']]], ['qdjangourlresolver',['QDjangoUrlResolver',['../classQDjangoUrlResolver.html',1,'']]], ['qdjangowhere',['QDjangoWhere',['../classQDjangoWhere.html',1,'']]] ]; qdjango-0.4.0/doc/html/search/enumvalues_73.js0000644000175000007640000000024712163016767021103 0ustar sharkyjerrywebvar searchData= [ ['startswith',['StartsWith',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61a2c59d066559ebd6ebd37d65f9ac33622',1,'QDjangoWhere']]] ]; qdjango-0.4.0/doc/html/search/functions_72.js0000644000175000007640000000222512163016767020724 0ustar sharkyjerrywebvar searchData= [ ['ready',['ready',['../classQDjangoHttpResponse.html#a08e9dd15a48e58d108c61fcd75111efe',1,'QDjangoHttpResponse']]], ['registermodel',['registerModel',['../classQDjango.html#ad5c33aff92420cc2984894683e25d86c',1,'QDjango::registerModel()'],['../classQDjangoScript.html#aa5d4323bf975d73ae480903ab7caee63',1,'QDjangoScript::registerModel()']]], ['registerwhere',['registerWhere',['../classQDjangoScript.html#a8efa64b848d95de8956a63ef13e8d55f',1,'QDjangoScript']]], ['remove',['remove',['../classQDjangoMetaModel.html#a3b0a36043675008e7114b420a73e3f62',1,'QDjangoMetaModel::remove()'],['../classQDjangoModel.html#add5761ed0860fc1e4e6d2e8b3601b4ee',1,'QDjangoModel::remove()'],['../classQDjangoQuerySet.html#ad174f57f5b4091aeba43482ac3b0635f',1,'QDjangoQuerySet::remove()']]], ['requestfinished',['requestFinished',['../classQDjangoHttpServer.html#adf578de15d401fbdb391f3e4c6672f12',1,'QDjangoHttpServer']]], ['respond',['respond',['../classQDjangoUrlResolver.html#a232c8538036a82c73dbc894481231df7',1,'QDjangoUrlResolver']]], ['reverse',['reverse',['../classQDjangoUrlResolver.html#ab771ce59f7a55a610822170f148b0c79',1,'QDjangoUrlResolver']]] ]; qdjango-0.4.0/doc/html/search/functions_7e.js0000644000175000007640000000217012163016767021006 0ustar sharkyjerrywebvar searchData= [ ['_7eqdjangofastcgiserver',['~QDjangoFastCgiServer',['../classQDjangoFastCgiServer.html#ab30091c8e9716fbdb70f3a8d6a41e01c',1,'QDjangoFastCgiServer']]], ['_7eqdjangohttprequest',['~QDjangoHttpRequest',['../classQDjangoHttpRequest.html#a70335989bd56e375c1a562308ca4a79f',1,'QDjangoHttpRequest']]], ['_7eqdjangohttpresponse',['~QDjangoHttpResponse',['../classQDjangoHttpResponse.html#a34309ddda4aa778eea2f14cfd383fbdf',1,'QDjangoHttpResponse']]], ['_7eqdjangohttpserver',['~QDjangoHttpServer',['../classQDjangoHttpServer.html#a3a22c79e296f07a419992f41542691ac',1,'QDjangoHttpServer']]], ['_7eqdjangometafield',['~QDjangoMetaField',['../classQDjangoMetaField.html#ab1999fd8b6ff75f36e7f5f048263e6ae',1,'QDjangoMetaField']]], ['_7eqdjangometamodel',['~QDjangoMetaModel',['../classQDjangoMetaModel.html#a0377fb890378d4c715a717dddecd05f5',1,'QDjangoMetaModel']]], ['_7eqdjangoqueryset',['~QDjangoQuerySet',['../classQDjangoQuerySet.html#a6998688bf21743c6eac0a9f53b906e25',1,'QDjangoQuerySet']]], ['_7eqdjangowhere',['~QDjangoWhere',['../classQDjangoWhere.html#a79c6943b5f2c9711b5480082c0832f8b',1,'QDjangoWhere']]] ]; qdjango-0.4.0/doc/html/search/functions_65.js0000644000175000007640000000036012163016767020724 0ustar sharkyjerrywebvar searchData= [ ['end',['end',['../classQDjangoQuerySet.html#a9253266bf70525952344faac46b505c4',1,'QDjangoQuerySet']]], ['exclude',['exclude',['../classQDjangoQuerySet.html#af27220e6645f081348c99ff55a5d5ed6',1,'QDjangoQuerySet']]] ]; qdjango-0.4.0/doc/html/search/classes_71.html0000644000175000007640000000177012163016767020704 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/functions_73.html0000644000175000007640000000177212163016767021263 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_6d.html0000644000175000007640000000176412163016767020104 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/enumvalues_73.html0000644000175000007640000000177312163016767021440 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/enums_68.js0000644000175000007640000000022412163016767020045 0ustar sharkyjerrywebvar searchData= [ ['httpstatus',['HttpStatus',['../classQDjangoHttpResponse.html#acba279eee56bd9fe488553a7e47a840e',1,'QDjangoHttpResponse']]] ]; qdjango-0.4.0/doc/html/search/functions_61.html0000644000175000007640000000177212163016767021260 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/functions_76.html0000644000175000007640000000177212163016767021266 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_70.js0000644000175000007640000000072412163016767017464 0ustar sharkyjerrywebvar searchData= [ ['path',['path',['../classQDjangoHttpRequest.html#a412998283362816e59a4ef0fadc8a03c',1,'QDjangoHttpRequest']]], ['pk',['pk',['../classQDjangoModel.html#a4958bd5f7b02304b51d33e66684dcbb1',1,'QDjangoModel']]], ['post',['post',['../classQDjangoHttpRequest.html#af91093f8f4bd224a0bedc113fc2bee1a',1,'QDjangoHttpRequest']]], ['primarykey',['primaryKey',['../classQDjangoMetaModel.html#aa8e9c3859f80193ae9c4af8d990a9f80',1,'QDjangoMetaModel']]] ]; qdjango-0.4.0/doc/html/search/functions_63.html0000644000175000007640000000177212163016767021262 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_74.html0000644000175000007640000000176412163016767020025 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_65.html0000644000175000007640000000176412163016767020025 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/functions_77.js0000644000175000007640000000020212163016767020722 0ustar sharkyjerrywebvar searchData= [ ['where',['where',['../classQDjangoQuerySet.html#aa822e676b19b9e92091561a914ff8b98',1,'QDjangoQuerySet']]] ]; qdjango-0.4.0/doc/html/search/enumvalues_6e.js0000644000175000007640000000045412163016767021164 0ustar sharkyjerrywebvar searchData= [ ['none',['None',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61a14cc20ae36e119b2fb9fbec217c3cb4d',1,'QDjangoWhere']]], ['notequals',['NotEquals',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61a1a733f4d536e1a12ca5cfb791e00ed8c',1,'QDjangoWhere']]] ]; qdjango-0.4.0/doc/html/search/functions_74.html0000644000175000007640000000177212163016767021264 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_7e.html0000644000175000007640000000176412163016767020106 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_68.html0000644000175000007640000000176412163016767020030 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/functions_77.html0000644000175000007640000000177212163016767021267 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/functions_6e.html0000644000175000007640000000177212163016767021344 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/enums_6f.html0000644000175000007640000000176612163016767020467 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_69.html0000644000175000007640000000176412163016767020031 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/pages_73.html0000644000175000007640000000176612163016767020355 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/typedefs_63.html0000644000175000007640000000177112163016767021074 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_62.html0000644000175000007640000000176412163016767020022 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/functions_62.js0000644000175000007640000000072512163016767020726 0ustar sharkyjerrywebvar searchData= [ ['begin',['begin',['../classQDjangoQuerySet.html#a490a5a9b6f9672b35894529f9a5bad43',1,'QDjangoQuerySet']]], ['bindvalues',['bindValues',['../classQDjangoWhere.html#ab362b0e5287ab3f6b0a04c56517d49d7',1,'QDjangoWhere']]], ['body',['body',['../classQDjangoHttpRequest.html#a3f4c3313e6c50c05ae5202b7dd9c397e',1,'QDjangoHttpRequest::body()'],['../classQDjangoHttpResponse.html#ae73fac3d7e130af552d4c2418a64a4a6',1,'QDjangoHttpResponse::body()']]] ]; qdjango-0.4.0/doc/html/search/typedefs_63.js0000644000175000007640000000022212163016767020532 0ustar sharkyjerrywebvar searchData= [ ['constiterator',['ConstIterator',['../classQDjangoQuerySet.html#a5427734628b61bf759b84161f3cf36b4',1,'QDjangoQuerySet']]] ]; qdjango-0.4.0/doc/html/search/pages_73.js0000644000175000007640000000013612163016767020013 0ustar sharkyjerrywebvar searchData= [ ['scripting_20models',['Scripting models',['../scripting.html',1,'']]] ]; qdjango-0.4.0/doc/html/search/all_69.js0000644000175000007640000000314112163016767017470 0ustar sharkyjerrywebvar searchData= [ ['include',['include',['../classQDjangoUrlResolver.html#ad0d06c383a2788d366e6f350879854c4',1,'QDjangoUrlResolver']]], ['isall',['isAll',['../classQDjangoWhere.html#a013cbab47caf55963346ae8dee1a2400',1,'QDjangoWhere']]], ['isautoincrement',['isAutoIncrement',['../classQDjangoMetaField.html#a69d755fefa2d6f9b5d270d41bce0221b',1,'QDjangoMetaField']]], ['isblank',['isBlank',['../classQDjangoMetaField.html#a4f63e58b551affa7ad06a0ea813fea54',1,'QDjangoMetaField']]], ['isdebugenabled',['isDebugEnabled',['../classQDjango.html#af3e7f569631b1af5933b4d8a9412c23e',1,'QDjango']]], ['isin',['IsIn',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61a8141b3f1eb7e08118029260548d923fc',1,'QDjangoWhere']]], ['isnone',['isNone',['../classQDjangoWhere.html#a9bea36462cdac72a99b7ebd237fb7a2b',1,'QDjangoWhere']]], ['isnull',['IsNull',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61a873665d3b466c7315cbb80bb5bcb1d01',1,'QDjangoWhere']]], ['isnullable',['isNullable',['../classQDjangoMetaField.html#aa871f2f95d91ab9705510972633231d3',1,'QDjangoMetaField']]], ['isready',['isReady',['../classQDjangoHttpResponse.html#a332da8b361deeab1be1945f32b37830d',1,'QDjangoHttpResponse']]], ['isunique',['isUnique',['../classQDjangoMetaField.html#af971cecad6f1ed4d2b45ac065be26394',1,'QDjangoMetaField']]], ['isvalid',['isValid',['../classQDjangoMetaField.html#af796c5c13565804956be6f55f7c8bc9a',1,'QDjangoMetaField']]], ['iterator_5fcategory',['iterator_category',['../classQDjangoQuerySet_1_1const__iterator.html#a46f5df4dc01af4557418b2298837548b',1,'QDjangoQuerySet::const_iterator']]] ]; qdjango-0.4.0/doc/html/search/enumvalues_67.html0000644000175000007640000000177312163016767021443 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/functions_62.html0000644000175000007640000000177212163016767021261 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/classes_63.html0000644000175000007640000000177012163016767020705 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_61.html0000644000175000007640000000176412163016767020021 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/functions_6e.js0000644000175000007640000000035612163016767021011 0ustar sharkyjerrywebvar searchData= [ ['name',['name',['../classQDjangoMetaField.html#ae0c9e3e20586b5a9a1b3bcc39e92475a',1,'QDjangoMetaField']]], ['none',['none',['../classQDjangoQuerySet.html#a976f1184c6c036ce0d3c414761eb581c',1,'QDjangoQuerySet']]] ]; qdjango-0.4.0/doc/html/search/mag_sel.png0000644000175000007640000000106312163016767020162 0ustar sharkyjerrywebPNG  IHDR- pHYs   cHRMms8zʴ3Dv6*IDATx䔻"A:/xQL@7010|173sVD6@PTmPjٝu &X?9S%|~|Ʉrf!LT**PH)9Nr0`Y'CZh NS,"JQ*d2V+fɄH$B^d۶(T*4MPH*zƶm:Ha0jSS-bMiP(ka<`ˉDq']?cǘ4M1tZ>z|)tu]F
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/functions_66.js0000644000175000007640000000075312163016767020733 0ustar sharkyjerrywebvar searchData= [ ['filter',['filter',['../classQDjangoQuerySet.html#a5fc458cda1b34cad3d9f4f99224feae6',1,'QDjangoQuerySet']]], ['foreignfields',['foreignFields',['../classQDjangoMetaModel.html#aeb5c323f4f1e0925d00e2f081afdbe0c',1,'QDjangoMetaModel']]], ['foreignkey',['foreignKey',['../classQDjangoMetaModel.html#a22062f4798b05b42d40d260160581d2d',1,'QDjangoMetaModel::foreignKey()'],['../classQDjangoModel.html#a3b6d25d1ed112a154d6973f230427d1f',1,'QDjangoModel::foreignKey()']]] ]; qdjango-0.4.0/doc/html/search/functions_6f.js0000644000175000007640000000710012163016767021004 0ustar sharkyjerrywebvar searchData= [ ['operator_21',['operator!',['../classQDjangoWhere.html#a7864e26ca22e8274af19a5e35ca4eb57',1,'QDjangoWhere']]], ['operator_21_3d',['operator!=',['../classQDjangoQuerySet_1_1const__iterator.html#aa3fa99f1a42f8b2c2291d6ccc6ca54ec',1,'QDjangoQuerySet::const_iterator']]], ['operator_26_26',['operator&&',['../classQDjangoWhere.html#ae0eb74f65ccafa434114c3cab239342b',1,'QDjangoWhere']]], ['operator_2a',['operator*',['../classQDjangoQuerySet_1_1const__iterator.html#a38046822a199bbc57e0af0b0d12a2d5d',1,'QDjangoQuerySet::const_iterator']]], ['operator_2b',['operator+',['../classQDjangoQuerySet_1_1const__iterator.html#a64ba39560eb425f8707bc7cda484503e',1,'QDjangoQuerySet::const_iterator']]], ['operator_2b_2b',['operator++',['../classQDjangoQuerySet_1_1const__iterator.html#a4586b95448e357d0d0c130bdf02828c3',1,'QDjangoQuerySet::const_iterator::operator++()'],['../classQDjangoQuerySet_1_1const__iterator.html#aa5867530a282c0495e1ca94a8b0e91c0',1,'QDjangoQuerySet::const_iterator::operator++(int)']]], ['operator_2b_3d',['operator+=',['../classQDjangoQuerySet_1_1const__iterator.html#a4a27a70a4ac3297067b72c1adce0ca27',1,'QDjangoQuerySet::const_iterator']]], ['operator_2d',['operator-',['../classQDjangoQuerySet_1_1const__iterator.html#a2da11f955354da3b54c3229bc4b361dc',1,'QDjangoQuerySet::const_iterator::operator-(int i) const '],['../classQDjangoQuerySet_1_1const__iterator.html#ae9823aef8edbb6743808e6911bed3013',1,'QDjangoQuerySet::const_iterator::operator-(const const_iterator &other) const ']]], ['operator_2d_2d',['operator--',['../classQDjangoQuerySet_1_1const__iterator.html#aaf920cbb83a8b10f07ae5aa97cfe2967',1,'QDjangoQuerySet::const_iterator::operator--()'],['../classQDjangoQuerySet_1_1const__iterator.html#a136b54f84e64aba95d2c94bebb7d36dc',1,'QDjangoQuerySet::const_iterator::operator--(int)']]], ['operator_2d_3d',['operator-=',['../classQDjangoQuerySet_1_1const__iterator.html#ab5779a973afcb3b41e511f53dff47877',1,'QDjangoQuerySet::const_iterator']]], ['operator_2d_3e',['operator->',['../classQDjangoQuerySet_1_1const__iterator.html#a3688597272643cbad1f83bdeead0aa5c',1,'QDjangoQuerySet::const_iterator']]], ['operator_3c',['operator<',['../classQDjangoQuerySet_1_1const__iterator.html#a767881e04f2adca8f89af8d8feaeab1b',1,'QDjangoQuerySet::const_iterator']]], ['operator_3c_3d',['operator<=',['../classQDjangoQuerySet_1_1const__iterator.html#ad9df0911a6d732ffe9c9eb7fbd748bbc',1,'QDjangoQuerySet::const_iterator']]], ['operator_3d',['operator=',['../classQDjangoMetaField.html#aca59fd5bd4c95499c596037c7532a2d4',1,'QDjangoMetaField::operator=()'],['../classQDjangoMetaModel.html#a70b5ba3605906d98346d42fcb03f5101',1,'QDjangoMetaModel::operator=()'],['../classQDjangoQuerySet.html#a925d8556b195d84e8185ad71a6a4f270',1,'QDjangoQuerySet::operator=()'],['../classQDjangoWhere.html#a2f2db754297f822a86ed1d8932f552e0',1,'QDjangoWhere::operator=()']]], ['operator_3d_3d',['operator==',['../classQDjangoQuerySet_1_1const__iterator.html#a84c1bbe005e9ed1a8ff7903bd0872e2c',1,'QDjangoQuerySet::const_iterator']]], ['operator_3e',['operator>',['../classQDjangoQuerySet_1_1const__iterator.html#a2d4509375cfde3b21d1f91db0e6b4d2a',1,'QDjangoQuerySet::const_iterator']]], ['operator_3e_3d',['operator>=',['../classQDjangoQuerySet_1_1const__iterator.html#a0c8b2cbd1d6c106ace33c365634cf312',1,'QDjangoQuerySet::const_iterator']]], ['operator_7c_7c',['operator||',['../classQDjangoWhere.html#a1327719101d803c7f4854b5c13767278',1,'QDjangoWhere']]], ['orderby',['orderBy',['../classQDjangoQuerySet.html#a00d3683087d54cbf690b9e6f15969f47',1,'QDjangoQuerySet']]] ]; qdjango-0.4.0/doc/html/search/functions_64.js0000644000175000007640000000053012163016767020722 0ustar sharkyjerrywebvar searchData= [ ['database',['database',['../classQDjango.html#a944127defa81b71150ae052fe596720f',1,'QDjango']]], ['droptable',['dropTable',['../classQDjangoMetaModel.html#af3d2abee49df5f47d04e55c10df83abf',1,'QDjangoMetaModel']]], ['droptables',['dropTables',['../classQDjango.html#a048353657fcc85d02d136f0342da42c5',1,'QDjango']]] ]; qdjango-0.4.0/doc/html/search/functions_73.js0000644000175000007640000000510212163016767020722 0ustar sharkyjerrywebvar searchData= [ ['save',['save',['../classQDjangoMetaModel.html#a6837d4f7f1d89327516e2e9ad39bef32',1,'QDjangoMetaModel::save()'],['../classQDjangoModel.html#a74616d7699ea6f0156a7ad80955a484a',1,'QDjangoModel::save()']]], ['selectrelated',['selectRelated',['../classQDjangoQuerySet.html#ac9633a4c3e92d30411df2fdd39090dab',1,'QDjangoQuerySet']]], ['serveauthorizationrequired',['serveAuthorizationRequired',['../classQDjangoHttpController.html#a1fe68af15977005370ac23633b305b7b',1,'QDjangoHttpController']]], ['servebadrequest',['serveBadRequest',['../classQDjangoHttpController.html#a6bf1064236afe030b94fe779676cbbc8',1,'QDjangoHttpController']]], ['serveinternalservererror',['serveInternalServerError',['../classQDjangoHttpController.html#a0b5b7ec8be16b1012f9d09f95fc0469a',1,'QDjangoHttpController']]], ['servenotfound',['serveNotFound',['../classQDjangoHttpController.html#adbc2c527604240c1c23ad417533c81ae',1,'QDjangoHttpController']]], ['serveredirect',['serveRedirect',['../classQDjangoHttpController.html#a5aaa6c9a7fa7b925a60d6127c92e47e2',1,'QDjangoHttpController']]], ['servestatic',['serveStatic',['../classQDjangoHttpController.html#aff791959526b022f5f33d0e092d779c5',1,'QDjangoHttpController']]], ['set',['set',['../classQDjangoUrlResolver.html#adec43858d061198b245c4467a3d00e41',1,'QDjangoUrlResolver']]], ['setbody',['setBody',['../classQDjangoHttpResponse.html#a3e892d1bb7050c5afa169e8e654c406d',1,'QDjangoHttpResponse']]], ['setdatabase',['setDatabase',['../classQDjango.html#a9a6962db6d787d8bcadc525a01fa6a2d',1,'QDjango']]], ['setdebugenabled',['setDebugEnabled',['../classQDjango.html#a76320043c64f142e619122178659d69c',1,'QDjango']]], ['setforeignkey',['setForeignKey',['../classQDjangoMetaModel.html#a603c0ccdef63152602d4bcb1b79b1a82',1,'QDjangoMetaModel::setForeignKey()'],['../classQDjangoModel.html#a060e30783f3e08e7a2d0843c3d9e4c8f',1,'QDjangoModel::setForeignKey()']]], ['setheader',['setHeader',['../classQDjangoHttpResponse.html#afc690a773b570998b5aa7ec3ebbf5452',1,'QDjangoHttpResponse']]], ['setpk',['setPk',['../classQDjangoModel.html#a182d1bc9588e6707b31af03ef9feff25',1,'QDjangoModel']]], ['setstatuscode',['setStatusCode',['../classQDjangoHttpResponse.html#aa9e8e7be8f27d71ce50444cda267264d',1,'QDjangoHttpResponse']]], ['size',['size',['../classQDjangoQuerySet.html#a90a5cd47b75e0cee952461ab574b3f46',1,'QDjangoQuerySet']]], ['sql',['sql',['../classQDjangoWhere.html#a62a68d37e044cd5bbb0c53f4c8d5f4ba',1,'QDjangoWhere']]], ['statuscode',['statusCode',['../classQDjangoHttpResponse.html#aa1cdb7432f4c9fe5bdf29d8cf0f1a032',1,'QDjangoHttpResponse']]] ]; qdjango-0.4.0/doc/html/search/all_77.js0000644000175000007640000000020212163016767017462 0ustar sharkyjerrywebvar searchData= [ ['where',['where',['../classQDjangoQuerySet.html#aa822e676b19b9e92091561a914ff8b98',1,'QDjangoQuerySet']]] ]; qdjango-0.4.0/doc/html/search/functions_72.html0000644000175000007640000000177212163016767021262 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/functions_6d.html0000644000175000007640000000177212163016767021343 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/functions_6d.js0000644000175000007640000000056412163016767021011 0ustar sharkyjerrywebvar searchData= [ ['maxlength',['maxLength',['../classQDjangoMetaField.html#ac5b8fe43394eee0ed4ed1df490342835',1,'QDjangoMetaField']]], ['meta',['meta',['../classQDjangoHttpRequest.html#a5e1bcaef5f0e58275b25322b36423593',1,'QDjangoHttpRequest']]], ['method',['method',['../classQDjangoHttpRequest.html#af53ea376feeccd67fa2fe61ffb56fa26',1,'QDjangoHttpRequest']]] ]; qdjango-0.4.0/doc/html/search/functions_68.html0000644000175000007640000000177212163016767021267 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/pages_64.js0000644000175000007640000000025612163016767020016 0ustar sharkyjerrywebvar searchData= [ ['database_20configuration',['Database configuration',['../database.html',1,'']]], ['database_20models',['Database models',['../models.html',1,'']]] ]; qdjango-0.4.0/doc/html/search/all_61.js0000644000175000007640000000034612163016767017464 0ustar sharkyjerrywebvar searchData= [ ['all',['all',['../classQDjangoQuerySet.html#a287a68a0977e431b05f5e44493aac1bc',1,'QDjangoQuerySet']]], ['at',['at',['../classQDjangoQuerySet.html#a1bcfbffb6676f4ec19f9278c3f0adf4f',1,'QDjangoQuerySet']]] ]; qdjango-0.4.0/doc/html/search/all_65.js0000644000175000007640000000101212163016767017457 0ustar sharkyjerrywebvar searchData= [ ['end',['end',['../classQDjangoQuerySet.html#a9253266bf70525952344faac46b505c4',1,'QDjangoQuerySet']]], ['endswith',['EndsWith',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61a4f02ce9f7c3bc289621521682d730663',1,'QDjangoWhere']]], ['equals',['Equals',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61a7fe62ab85b26467aca41c4b4307a6a45',1,'QDjangoWhere']]], ['exclude',['exclude',['../classQDjangoQuerySet.html#af27220e6645f081348c99ff55a5d5ed6',1,'QDjangoQuerySet']]] ]; qdjango-0.4.0/doc/html/search/groups_64.js0000644000175000007640000000012212163016767020226 0ustar sharkyjerrywebvar searchData= [ ['database',['Database',['../group__Database.html',1,'']]] ]; qdjango-0.4.0/doc/html/search/enumvalues_65.js0000644000175000007640000000045612163016767021106 0ustar sharkyjerrywebvar searchData= [ ['endswith',['EndsWith',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61a4f02ce9f7c3bc289621521682d730663',1,'QDjangoWhere']]], ['equals',['Equals',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61a7fe62ab85b26467aca41c4b4307a6a45',1,'QDjangoWhere']]] ]; qdjango-0.4.0/doc/html/search/all_62.js0000644000175000007640000000072512163016767017466 0ustar sharkyjerrywebvar searchData= [ ['begin',['begin',['../classQDjangoQuerySet.html#a490a5a9b6f9672b35894529f9a5bad43',1,'QDjangoQuerySet']]], ['bindvalues',['bindValues',['../classQDjangoWhere.html#ab362b0e5287ab3f6b0a04c56517d49d7',1,'QDjangoWhere']]], ['body',['body',['../classQDjangoHttpRequest.html#a3f4c3313e6c50c05ae5202b7dd9c397e',1,'QDjangoHttpRequest::body()'],['../classQDjangoHttpResponse.html#ae73fac3d7e130af552d4c2418a64a4a6',1,'QDjangoHttpResponse::body()']]] ]; qdjango-0.4.0/doc/html/search/functions_66.html0000644000175000007640000000177212163016767021265 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/functions_6c.html0000644000175000007640000000177212163016767021342 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_71.html0000644000175000007640000000176412163016767020022 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_68.js0000644000175000007640000000116612163016767017474 0ustar sharkyjerrywebvar searchData= [ ['header',['header',['../classQDjangoHttpResponse.html#a251a0c772768a34f9b5486b2f71019d2',1,'QDjangoHttpResponse']]], ['http',['Http',['../group__Http.html',1,'']]], ['httpdatetime',['httpDateTime',['../classQDjangoHttpController.html#af3be408a12824b6ba0eb85567e6c476b',1,'QDjangoHttpController::httpDateTime(const QDateTime &dt)'],['../classQDjangoHttpController.html#ab0493f45d2a0ee5845078ba907695803',1,'QDjangoHttpController::httpDateTime(const QString &str)']]], ['httpstatus',['HttpStatus',['../classQDjangoHttpResponse.html#acba279eee56bd9fe488553a7e47a840e',1,'QDjangoHttpResponse']]] ]; qdjango-0.4.0/doc/html/search/search.css0000644000175000007640000001055512163016767020032 0ustar sharkyjerryweb/*---------------- Search Box */ #FSearchBox { float: left; } #MSearchBox { white-space : nowrap; position: absolute; float: none; display: inline; margin-top: 8px; right: 0px; width: 170px; z-index: 102; background-color: white; } #MSearchBox .left { display:block; position:absolute; left:10px; width:20px; height:19px; background:url('search_l.png') no-repeat; background-position:right; } #MSearchSelect { display:block; position:absolute; width:20px; height:19px; } .left #MSearchSelect { left:4px; } .right #MSearchSelect { right:5px; } #MSearchField { display:block; position:absolute; height:19px; background:url('search_m.png') repeat-x; border:none; width:111px; margin-left:20px; padding-left:4px; color: #909090; outline: none; font: 9pt Arial, Verdana, sans-serif; } #FSearchBox #MSearchField { margin-left:15px; } #MSearchBox .right { display:block; position:absolute; right:10px; top:0px; width:20px; height:19px; background:url('search_r.png') no-repeat; background-position:left; } #MSearchClose { display: none; position: absolute; top: 4px; background : none; border: none; margin: 0px 4px 0px 0px; padding: 0px 0px; outline: none; } .left #MSearchClose { left: 6px; } .right #MSearchClose { right: 2px; } .MSearchBoxActive #MSearchField { color: #000000; } /*---------------- Search filter selection */ #MSearchSelectWindow { display: none; position: absolute; left: 0; top: 0; border: 1px solid #90A5CE; background-color: #F9FAFC; z-index: 1; padding-top: 4px; padding-bottom: 4px; -moz-border-radius: 4px; -webkit-border-top-left-radius: 4px; -webkit-border-top-right-radius: 4px; -webkit-border-bottom-left-radius: 4px; -webkit-border-bottom-right-radius: 4px; -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); } .SelectItem { font: 8pt Arial, Verdana, sans-serif; padding-left: 2px; padding-right: 12px; border: 0px; } span.SelectionMark { margin-right: 4px; font-family: monospace; outline-style: none; text-decoration: none; } a.SelectItem { display: block; outline-style: none; color: #000000; text-decoration: none; padding-left: 6px; padding-right: 12px; } a.SelectItem:focus, a.SelectItem:active { color: #000000; outline-style: none; text-decoration: none; } a.SelectItem:hover { color: #FFFFFF; background-color: #3D578C; outline-style: none; text-decoration: none; cursor: pointer; display: block; } /*---------------- Search results window */ iframe#MSearchResults { width: 60ex; height: 15em; } #MSearchResultsWindow { display: none; position: absolute; left: 0; top: 0; border: 1px solid #000; background-color: #EEF1F7; } /* ----------------------------------- */ #SRIndex { clear:both; padding-bottom: 15px; } .SREntry { font-size: 10pt; padding-left: 1ex; } .SRPage .SREntry { font-size: 8pt; padding: 1px 5px; } body.SRPage { margin: 5px 2px; } .SRChildren { padding-left: 3ex; padding-bottom: .5em } .SRPage .SRChildren { display: none; } .SRSymbol { font-weight: bold; color: #425E97; font-family: Arial, Verdana, sans-serif; text-decoration: none; outline: none; } a.SRScope { display: block; color: #425E97; font-family: Arial, Verdana, sans-serif; text-decoration: none; outline: none; } a.SRSymbol:focus, a.SRSymbol:active, a.SRScope:focus, a.SRScope:active { text-decoration: underline; } span.SRScope { padding-left: 4px; } .SRPage .SRStatus { padding: 2px 5px; font-size: 8pt; font-style: italic; } .SRResult { display: none; } DIV.searchresults { margin-left: 10px; margin-right: 10px; } /*---------------- External search page results */ .searchresult { background-color: #F0F3F8; } .pages b { color: white; padding: 5px 5px 3px 5px; background-image: url("../tab_a.png"); background-repeat: repeat-x; text-shadow: 0 1px 1px #000000; } .pages { line-height: 17px; margin-left: 4px; text-decoration: none; } .hl { font-weight: bold; } #searchresults { margin-bottom: 20px; } .searchpages { margin-top: 10px; } qdjango-0.4.0/doc/html/search/search.js0000644000175000007640000005752412163016767017665 0ustar sharkyjerryweb// Search script generated by doxygen // Copyright (C) 2009 by Dimitri van Heesch. // The code in this file is loosly based on main.js, part of Natural Docs, // which is Copyright (C) 2003-2008 Greg Valure // Natural Docs is licensed under the GPL. var indexSectionsWithContent = { 0: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111001111111111110000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 1: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 2: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111001111111111110000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 3: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 4: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 5: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010101001010000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 6: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 7: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100010000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 8: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000100000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" }; var indexSectionNames = { 0: "all", 1: "classes", 2: "functions", 3: "typedefs", 4: "enums", 5: "enumvalues", 6: "properties", 7: "groups", 8: "pages" }; function convertToId(search) { var result = ''; for (i=0;i do a search { this.Search(); } } this.OnSearchSelectKey = function(evt) { var e = (evt) ? evt : window.event; // for IE if (e.keyCode==40 && this.searchIndex0) // Up { this.searchIndex--; this.OnSelectItem(this.searchIndex); } else if (e.keyCode==13 || e.keyCode==27) { this.OnSelectItem(this.searchIndex); this.CloseSelectionWindow(); this.DOMSearchField().focus(); } return false; } // --------- Actions // Closes the results window. this.CloseResultsWindow = function() { this.DOMPopupSearchResultsWindow().style.display = 'none'; this.DOMSearchClose().style.display = 'none'; this.Activate(false); } this.CloseSelectionWindow = function() { this.DOMSearchSelectWindow().style.display = 'none'; } // Performs a search. this.Search = function() { this.keyTimeout = 0; // strip leading whitespace var searchValue = this.DOMSearchField().value.replace(/^ +/, ""); var code = searchValue.toLowerCase().charCodeAt(0); var hexCode; if (code<16) { hexCode="0"+code.toString(16); } else { hexCode=code.toString(16); } var resultsPage; var resultsPageWithSearch; var hasResultsPage; if (indexSectionsWithContent[this.searchIndex].charAt(code) == '1') { resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html'; resultsPageWithSearch = resultsPage+'?'+escape(searchValue); hasResultsPage = true; } else // nothing available for this search term { resultsPage = this.resultsPath + '/nomatches.html'; resultsPageWithSearch = resultsPage; hasResultsPage = false; } window.frames.MSearchResults.location = resultsPageWithSearch; var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); if (domPopupSearchResultsWindow.style.display!='block') { var domSearchBox = this.DOMSearchBox(); this.DOMSearchClose().style.display = 'inline'; if (this.insideFrame) { var domPopupSearchResults = this.DOMPopupSearchResults(); domPopupSearchResultsWindow.style.position = 'relative'; domPopupSearchResultsWindow.style.display = 'block'; var width = document.body.clientWidth - 8; // the -8 is for IE :-( domPopupSearchResultsWindow.style.width = width + 'px'; domPopupSearchResults.style.width = width + 'px'; } else { var domPopupSearchResults = this.DOMPopupSearchResults(); var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth; var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1; domPopupSearchResultsWindow.style.display = 'block'; left -= domPopupSearchResults.offsetWidth; domPopupSearchResultsWindow.style.top = top + 'px'; domPopupSearchResultsWindow.style.left = left + 'px'; } } this.lastSearchValue = searchValue; this.lastResultsPage = resultsPage; } // -------- Activation Functions // Activates or deactivates the search panel, resetting things to // their default values if necessary. this.Activate = function(isActive) { if (isActive || // open it this.DOMPopupSearchResultsWindow().style.display == 'block' ) { this.DOMSearchBox().className = 'MSearchBoxActive'; var searchField = this.DOMSearchField(); if (searchField.value == this.searchLabel) // clear "Search" term upon entry { searchField.value = ''; this.searchActive = true; } } else if (!isActive) // directly remove the panel { this.DOMSearchBox().className = 'MSearchBoxInactive'; this.DOMSearchField().value = this.searchLabel; this.searchActive = false; this.lastSearchValue = '' this.lastResultsPage = ''; } } } // ----------------------------------------------------------------------- // The class that handles everything on the search results page. function SearchResults(name) { // The number of matches from the last run of . this.lastMatchCount = 0; this.lastKey = 0; this.repeatOn = false; // Toggles the visibility of the passed element ID. this.FindChildElement = function(id) { var parentElement = document.getElementById(id); var element = parentElement.firstChild; while (element && element!=parentElement) { if (element.nodeName == 'DIV' && element.className == 'SRChildren') { return element; } if (element.nodeName == 'DIV' && element.hasChildNodes()) { element = element.firstChild; } else if (element.nextSibling) { element = element.nextSibling; } else { do { element = element.parentNode; } while (element && element!=parentElement && !element.nextSibling); if (element && element!=parentElement) { element = element.nextSibling; } } } } this.Toggle = function(id) { var element = this.FindChildElement(id); if (element) { if (element.style.display == 'block') { element.style.display = 'none'; } else { element.style.display = 'block'; } } } // Searches for the passed string. If there is no parameter, // it takes it from the URL query. // // Always returns true, since other documents may try to call it // and that may or may not be possible. this.Search = function(search) { if (!search) // get search word from URL { search = window.location.search; search = search.substring(1); // Remove the leading '?' search = unescape(search); } search = search.replace(/^ +/, ""); // strip leading spaces search = search.replace(/ +$/, ""); // strip trailing spaces search = search.toLowerCase(); search = convertToId(search); var resultRows = document.getElementsByTagName("div"); var matches = 0; var i = 0; while (i < resultRows.length) { var row = resultRows.item(i); if (row.className == "SRResult") { var rowMatchName = row.id.toLowerCase(); rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_' if (search.length<=rowMatchName.length && rowMatchName.substr(0, search.length)==search) { row.style.display = 'block'; matches++; } else { row.style.display = 'none'; } } i++; } document.getElementById("Searching").style.display='none'; if (matches == 0) // no results { document.getElementById("NoMatches").style.display='block'; } else // at least one result { document.getElementById("NoMatches").style.display='none'; } this.lastMatchCount = matches; return true; } // return the first item with index index or higher that is visible this.NavNext = function(index) { var focusItem; while (1) { var focusName = 'Item'+index; focusItem = document.getElementById(focusName); if (focusItem && focusItem.parentNode.parentNode.style.display=='block') { break; } else if (!focusItem) // last element { break; } focusItem=null; index++; } return focusItem; } this.NavPrev = function(index) { var focusItem; while (1) { var focusName = 'Item'+index; focusItem = document.getElementById(focusName); if (focusItem && focusItem.parentNode.parentNode.style.display=='block') { break; } else if (!focusItem) // last element { break; } focusItem=null; index--; } return focusItem; } this.ProcessKeys = function(e) { if (e.type == "keydown") { this.repeatOn = false; this.lastKey = e.keyCode; } else if (e.type == "keypress") { if (!this.repeatOn) { if (this.lastKey) this.repeatOn = true; return false; // ignore first keypress after keydown } } else if (e.type == "keyup") { this.lastKey = 0; this.repeatOn = false; } return this.lastKey!=0; } this.Nav = function(evt,itemIndex) { var e = (evt) ? evt : window.event; // for IE if (e.keyCode==13) return true; if (!this.ProcessKeys(e)) return false; if (this.lastKey==38) // Up { var newIndex = itemIndex-1; var focusItem = this.NavPrev(newIndex); if (focusItem) { var child = this.FindChildElement(focusItem.parentNode.parentNode.id); if (child && child.style.display == 'block') // children visible { var n=0; var tmpElem; while (1) // search for last child { tmpElem = document.getElementById('Item'+newIndex+'_c'+n); if (tmpElem) { focusItem = tmpElem; } else // found it! { break; } n++; } } } if (focusItem) { focusItem.focus(); } else // return focus to search field { parent.document.getElementById("MSearchField").focus(); } } else if (this.lastKey==40) // Down { var newIndex = itemIndex+1; var focusItem; var item = document.getElementById('Item'+itemIndex); var elem = this.FindChildElement(item.parentNode.parentNode.id); if (elem && elem.style.display == 'block') // children visible { focusItem = document.getElementById('Item'+itemIndex+'_c0'); } if (!focusItem) focusItem = this.NavNext(newIndex); if (focusItem) focusItem.focus(); } else if (this.lastKey==39) // Right { var item = document.getElementById('Item'+itemIndex); var elem = this.FindChildElement(item.parentNode.parentNode.id); if (elem) elem.style.display = 'block'; } else if (this.lastKey==37) // Left { var item = document.getElementById('Item'+itemIndex); var elem = this.FindChildElement(item.parentNode.parentNode.id); if (elem) elem.style.display = 'none'; } else if (this.lastKey==27) // Escape { parent.searchBox.CloseResultsWindow(); parent.document.getElementById("MSearchField").focus(); } else if (this.lastKey==13) // Enter { return true; } return false; } this.NavChild = function(evt,itemIndex,childIndex) { var e = (evt) ? evt : window.event; // for IE if (e.keyCode==13) return true; if (!this.ProcessKeys(e)) return false; if (this.lastKey==38) // Up { if (childIndex>0) { var newIndex = childIndex-1; document.getElementById('Item'+itemIndex+'_c'+newIndex).focus(); } else // already at first child, jump to parent { document.getElementById('Item'+itemIndex).focus(); } } else if (this.lastKey==40) // Down { var newIndex = childIndex+1; var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex); if (!elem) // last child, jump to parent next parent { elem = this.NavNext(itemIndex+1); } if (elem) { elem.focus(); } } else if (this.lastKey==27) // Escape { parent.searchBox.CloseResultsWindow(); parent.document.getElementById("MSearchField").focus(); } else if (this.lastKey==13) // Enter { return true; } return false; } } function setKeyActions(elem,action) { elem.setAttribute('onkeydown',action); elem.setAttribute('onkeypress',action); elem.setAttribute('onkeyup',action); } function setClassAttr(elem,attr) { elem.setAttribute('class',attr); elem.setAttribute('className',attr); } function createResults() { var results = document.getElementById("SRResults"); for (var e=0; e
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/typedefs_69.html0000644000175000007640000000177112163016767021102 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/groups_73.js0000644000175000007640000000011412163016767020227 0ustar sharkyjerrywebvar searchData= [ ['script',['Script',['../group__Script.html',1,'']]] ]; qdjango-0.4.0/doc/html/search/functions_69.html0000644000175000007640000000177212163016767021270 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/properties_70.html0000644000175000007640000000177312163016767021445 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/functions_67.html0000644000175000007640000000177212163016767021266 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_6f.js0000644000175000007640000000726012163016767017553 0ustar sharkyjerrywebvar searchData= [ ['operation',['Operation',['../classQDjangoWhere.html#acd1b7a7d3e2367c6f4846dd9f0ebbd61',1,'QDjangoWhere']]], ['operator_21',['operator!',['../classQDjangoWhere.html#a7864e26ca22e8274af19a5e35ca4eb57',1,'QDjangoWhere']]], ['operator_21_3d',['operator!=',['../classQDjangoQuerySet_1_1const__iterator.html#aa3fa99f1a42f8b2c2291d6ccc6ca54ec',1,'QDjangoQuerySet::const_iterator']]], ['operator_26_26',['operator&&',['../classQDjangoWhere.html#ae0eb74f65ccafa434114c3cab239342b',1,'QDjangoWhere']]], ['operator_2a',['operator*',['../classQDjangoQuerySet_1_1const__iterator.html#a38046822a199bbc57e0af0b0d12a2d5d',1,'QDjangoQuerySet::const_iterator']]], ['operator_2b',['operator+',['../classQDjangoQuerySet_1_1const__iterator.html#a64ba39560eb425f8707bc7cda484503e',1,'QDjangoQuerySet::const_iterator']]], ['operator_2b_2b',['operator++',['../classQDjangoQuerySet_1_1const__iterator.html#a4586b95448e357d0d0c130bdf02828c3',1,'QDjangoQuerySet::const_iterator::operator++()'],['../classQDjangoQuerySet_1_1const__iterator.html#aa5867530a282c0495e1ca94a8b0e91c0',1,'QDjangoQuerySet::const_iterator::operator++(int)']]], ['operator_2b_3d',['operator+=',['../classQDjangoQuerySet_1_1const__iterator.html#a4a27a70a4ac3297067b72c1adce0ca27',1,'QDjangoQuerySet::const_iterator']]], ['operator_2d',['operator-',['../classQDjangoQuerySet_1_1const__iterator.html#a2da11f955354da3b54c3229bc4b361dc',1,'QDjangoQuerySet::const_iterator::operator-(int i) const '],['../classQDjangoQuerySet_1_1const__iterator.html#ae9823aef8edbb6743808e6911bed3013',1,'QDjangoQuerySet::const_iterator::operator-(const const_iterator &other) const ']]], ['operator_2d_2d',['operator--',['../classQDjangoQuerySet_1_1const__iterator.html#aaf920cbb83a8b10f07ae5aa97cfe2967',1,'QDjangoQuerySet::const_iterator::operator--()'],['../classQDjangoQuerySet_1_1const__iterator.html#a136b54f84e64aba95d2c94bebb7d36dc',1,'QDjangoQuerySet::const_iterator::operator--(int)']]], ['operator_2d_3d',['operator-=',['../classQDjangoQuerySet_1_1const__iterator.html#ab5779a973afcb3b41e511f53dff47877',1,'QDjangoQuerySet::const_iterator']]], ['operator_2d_3e',['operator->',['../classQDjangoQuerySet_1_1const__iterator.html#a3688597272643cbad1f83bdeead0aa5c',1,'QDjangoQuerySet::const_iterator']]], ['operator_3c',['operator<',['../classQDjangoQuerySet_1_1const__iterator.html#a767881e04f2adca8f89af8d8feaeab1b',1,'QDjangoQuerySet::const_iterator']]], ['operator_3c_3d',['operator<=',['../classQDjangoQuerySet_1_1const__iterator.html#ad9df0911a6d732ffe9c9eb7fbd748bbc',1,'QDjangoQuerySet::const_iterator']]], ['operator_3d',['operator=',['../classQDjangoMetaField.html#aca59fd5bd4c95499c596037c7532a2d4',1,'QDjangoMetaField::operator=()'],['../classQDjangoMetaModel.html#a70b5ba3605906d98346d42fcb03f5101',1,'QDjangoMetaModel::operator=()'],['../classQDjangoQuerySet.html#a925d8556b195d84e8185ad71a6a4f270',1,'QDjangoQuerySet::operator=()'],['../classQDjangoWhere.html#a2f2db754297f822a86ed1d8932f552e0',1,'QDjangoWhere::operator=()']]], ['operator_3d_3d',['operator==',['../classQDjangoQuerySet_1_1const__iterator.html#a84c1bbe005e9ed1a8ff7903bd0872e2c',1,'QDjangoQuerySet::const_iterator']]], ['operator_3e',['operator>',['../classQDjangoQuerySet_1_1const__iterator.html#a2d4509375cfde3b21d1f91db0e6b4d2a',1,'QDjangoQuerySet::const_iterator']]], ['operator_3e_3d',['operator>=',['../classQDjangoQuerySet_1_1const__iterator.html#a0c8b2cbd1d6c106ace33c365634cf312',1,'QDjangoQuerySet::const_iterator']]], ['operator_7c_7c',['operator||',['../classQDjangoWhere.html#a1327719101d803c7f4854b5c13767278',1,'QDjangoWhere']]], ['orderby',['orderBy',['../classQDjangoQuerySet.html#a00d3683087d54cbf690b9e6f15969f47',1,'QDjangoQuerySet']]] ]; qdjango-0.4.0/doc/html/search/enumvalues_69.html0000644000175000007640000000177312163016767021445 0ustar sharkyjerryweb
Loading...
Searching...
No Matches
qdjango-0.4.0/doc/html/search/all_75.js0000644000175000007640000000054512163016767017472 0ustar sharkyjerrywebvar searchData= [ ['update',['update',['../classQDjangoQuerySet.html#a467e97426c6f19a118d1ff77b59f9431',1,'QDjangoQuerySet']]], ['urls',['urls',['../classQDjangoFastCgiServer.html#a573ce8ce7f46d76e3bcdc90b455ecc67',1,'QDjangoFastCgiServer::urls()'],['../classQDjangoHttpServer.html#a07f654016ad6113e1c1ff50e345666ef',1,'QDjangoHttpServer::urls()']]] ]; qdjango-0.4.0/doc/html/search/typedefs_69.js0000644000175000007640000000027712163016767020552 0ustar sharkyjerrywebvar searchData= [ ['iterator_5fcategory',['iterator_category',['../classQDjangoQuerySet_1_1const__iterator.html#a46f5df4dc01af4557418b2298837548b',1,'QDjangoQuerySet::const_iterator']]] ]; qdjango-0.4.0/doc/html/ftv2cl.png0000644000175000007640000000070512163016767016510 0ustar sharkyjerrywebPNG  IHDR}\IDATx;H#Ao4ႇK ,m vڞJ XY B|drcvoİ 0Ò3ͤe״1X8nQ88֧3*rb-$P1@Z-#011HkK wO@!fuc;sB[EA\>]Pzf| +g5b i5mM_q,cod!,{Y,zT8H]𤕘7/8Q!F~6?Y A@Ũ.@TYr8*>?e[6xIENDB`qdjango-0.4.0/doc/html/nav_h.png0000644000175000007640000000014212163016767016376 0ustar sharkyjerrywebPNG  IHDR ,@)IDATxA @BQۛТ) ) aܿoRlIENDB`qdjango-0.4.0/doc/html/ftv2splitbar.png0000644000175000007640000000047212163016767017733 0ustar sharkyjerrywebPNG  IHDRMIDATxݡJCa( %4 bȘͶ3v^EL ,b;{Ï/aYկq:\IIIIIIIIIIIIIIIIII-l揊_t/ϻYQVYivk_ۣI@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$C[V=[fIENDB`qdjango-0.4.0/tests/0000755000175000007640000000000012163016632014220 5ustar sharkyjerrywebqdjango-0.4.0/tests/http/0000755000175000007640000000000012163016632015177 5ustar sharkyjerrywebqdjango-0.4.0/tests/http/http.pro0000644000175000007640000000010212163016632016671 0ustar sharkyjerrywebTEMPLATE = subdirs SUBDIRS = qdjangohttpserver qdjangourlresolver qdjango-0.4.0/tests/http/qdjangohttpserver/0000755000175000007640000000000012163016632020751 5ustar sharkyjerrywebqdjango-0.4.0/tests/http/qdjangohttpserver/qdjangohttpserver.pro0000644000175000007640000000033412163016632025245 0ustar sharkyjerrywebinclude(../../../qdjango.pri) QT -= gui QT += network testlib TARGET = tst_qdjangohttpserver SOURCES += tst_qdjangohttpserver.cpp INCLUDEPATH += $$QDJANGO_INCLUDEPATH LIBS += -L../../../src/http $$QDJANGO_HTTP_LIBS qdjango-0.4.0/tests/http/qdjangohttpserver/tst_qdjangohttpserver.cpp0000644000175000007640000001255712163016632026133 0ustar sharkyjerryweb/* * 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. */ #include #include #include #include #include #include "QDjangoHttpController.h" #include "QDjangoHttpRequest.h" #include "QDjangoHttpResponse.h" #include "QDjangoHttpServer.h" #include "QDjangoUrlResolver.h" /** Test QDjangoHttpServer class. */ class tst_QDjangoHttpServer : public QObject { Q_OBJECT private slots: void cleanupTestCase(); void initTestCase(); void testGet_data(); void testGet(); void testPost_data(); void testPost(); QDjangoHttpResponse* _q_index(const QDjangoHttpRequest &request); QDjangoHttpResponse* _q_error(const QDjangoHttpRequest &request); private: QDjangoHttpServer *httpServer; }; void tst_QDjangoHttpServer::cleanupTestCase() { delete httpServer; } void tst_QDjangoHttpServer::initTestCase() { httpServer = new QDjangoHttpServer; httpServer->urls()->set(QRegExp(QLatin1String(QLatin1String("^$"))), this, "_q_index"); httpServer->urls()->set(QRegExp(QLatin1String("^internal-server-error$")), this, "_q_error"); QCOMPARE(httpServer->listen(QHostAddress::LocalHost, 8123), true); } void tst_QDjangoHttpServer::testGet_data() { QTest::addColumn("path"); QTest::addColumn("err"); QTest::addColumn("body"); const QString errorTemplate = QLatin1String( "" "Error" "

%1

" ""); QTest::newRow("root") << "/" << int(QNetworkReply::NoError) << QByteArray("method=GET|path=/"); QTest::newRow("query-string") << "/?message=bar" << int(QNetworkReply::NoError) << QByteArray("method=GET|path=/|get=bar"); QTest::newRow("not-found") << "/not-found" << int(QNetworkReply::ContentNotFoundError) << errorTemplate.arg(QLatin1String("The document you requested was not found.")).toUtf8(); QTest::newRow("internal-server-error") << "/internal-server-error" << int(QNetworkReply::UnknownContentError) << errorTemplate.arg(QLatin1String("An internal server error was encountered.")).toUtf8(); } void tst_QDjangoHttpServer::testGet() { QFETCH(QString, path); QFETCH(int, err); QFETCH(QByteArray, body); QNetworkAccessManager network; QNetworkReply *reply = network.get(QNetworkRequest(QUrl(QLatin1String("http://127.0.0.1:8123") + path))); QEventLoop loop; QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); loop.exec(); QVERIFY(reply); QCOMPARE(int(reply->error()), err); QCOMPARE(reply->readAll(), body); delete reply; } void tst_QDjangoHttpServer::testPost_data() { QTest::addColumn("path"); QTest::addColumn("data"); QTest::addColumn("err"); QTest::addColumn("body"); QTest::newRow("empty") << "/" << QByteArray() << int(QNetworkReply::NoError) << QByteArray("method=POST|path=/"); QTest::newRow("simple") << "/" << QByteArray("message=bar") << int(QNetworkReply::NoError) << QByteArray("method=POST|path=/|post=bar"); QTest::newRow("multi") << "/" << QByteArray("bob=wiz&message=bar&zoo=wow") << int(QNetworkReply::NoError) << QByteArray("method=POST|path=/|post=bar"); } void tst_QDjangoHttpServer::testPost() { QFETCH(QString, path); QFETCH(QByteArray, data); QFETCH(int, err); QFETCH(QByteArray, body); QNetworkAccessManager network; QNetworkRequest req(QUrl(QLatin1String("http://127.0.0.1:8123") + path)); req.setRawHeader("Content-Type", "application/x-www-form-urlencoded"); QNetworkReply *reply = network.post(req, data); QEventLoop loop; QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); loop.exec(); QVERIFY(reply); QCOMPARE(int(reply->error()), err); QCOMPARE(reply->readAll(), body); delete reply; } QDjangoHttpResponse *tst_QDjangoHttpServer::_q_index(const QDjangoHttpRequest &request) { QDjangoHttpResponse *response = new QDjangoHttpResponse; response->setHeader(QLatin1String("Content-Type"), QLatin1String("text/plain")); QString output = QLatin1String("method=") + request.method(); output += QLatin1String("|path=") + request.path(); const QString getValue = request.get(QLatin1String("message")); if (!getValue.isEmpty()) output += QLatin1String("|get=") + getValue; const QString postValue = request.post(QLatin1String("message")); if (!postValue.isEmpty()) output += QLatin1String("|post=") + postValue; response->setBody(output.toUtf8()); return response; } QDjangoHttpResponse *tst_QDjangoHttpServer::_q_error(const QDjangoHttpRequest &request) { Q_UNUSED(request); return QDjangoHttpController::serveInternalServerError(request); } QTEST_MAIN(tst_QDjangoHttpServer) #include "tst_qdjangohttpserver.moc" qdjango-0.4.0/tests/http/qdjangourlresolver/0000755000175000007640000000000012163016632021127 5ustar sharkyjerrywebqdjango-0.4.0/tests/http/qdjangourlresolver/qdjangourlresolver.pro0000644000175000007640000000033612163016632025603 0ustar sharkyjerrywebinclude(../../../qdjango.pri) QT -= gui QT += network testlib TARGET = tst_qdjangourlresolver SOURCES += tst_qdjangourlresolver.cpp INCLUDEPATH += $$QDJANGO_INCLUDEPATH LIBS += -L../../../src/http $$QDJANGO_HTTP_LIBS qdjango-0.4.0/tests/http/qdjangourlresolver/tst_qdjangourlresolver.cpp0000644000175000007640000001522712163016632026464 0ustar sharkyjerryweb/* * 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. */ #include #include #include #include #include #include "QDjangoHttpController.h" #include "QDjangoHttpRequest.h" #include "QDjangoHttpResponse.h" #include "QDjangoUrlResolver.h" class tst_QDjangoUrlHelper : public QObject { Q_OBJECT private slots: QDjangoHttpResponse* _q_index(const QDjangoHttpRequest &request); QDjangoHttpResponse* _q_test(const QDjangoHttpRequest &request); }; class tst_QDjangoUrlResolver : public QObject { Q_OBJECT private slots: void cleanupTestCase(); void initTestCase(); void testRespond_data(); void testRespond(); void testReverse_data(); void testReverse(); QDjangoHttpResponse* _q_index(const QDjangoHttpRequest &request); QDjangoHttpResponse* _q_noArgs(const QDjangoHttpRequest &request); QDjangoHttpResponse* _q_oneArg(const QDjangoHttpRequest &request, const QString &id); QDjangoHttpResponse* _q_twoArgs(const QDjangoHttpRequest &request, const QString &id, const QString &action); private: tst_QDjangoUrlHelper *urlHelper; QDjangoUrlResolver *urlResolver; QDjangoUrlResolver *urlSub; }; QDjangoHttpResponse* tst_QDjangoUrlHelper::_q_index(const QDjangoHttpRequest &request) { Q_UNUSED(request); QDjangoHttpResponse *response = new QDjangoHttpResponse; response->setHeader(QLatin1String("Content-Type"), QLatin1String("text/plain")); response->setBody("sub index"); return response; } QDjangoHttpResponse* tst_QDjangoUrlHelper::_q_test(const QDjangoHttpRequest &request) { Q_UNUSED(request); QDjangoHttpResponse *response = new QDjangoHttpResponse; response->setHeader(QLatin1String("Content-Type"), QLatin1String("text/plain")); response->setBody("sub test"); return response; } void tst_QDjangoUrlResolver::cleanupTestCase() { delete urlResolver; } void tst_QDjangoUrlResolver::initTestCase() { urlHelper = new tst_QDjangoUrlHelper; urlSub = new QDjangoUrlResolver; QVERIFY(urlSub->set(QRegExp(QLatin1String("^$")), urlHelper, "_q_index")); QVERIFY(urlSub->set(QRegExp(QLatin1String("^test/$")), urlHelper, "_q_test")); urlResolver = new QDjangoUrlResolver; QVERIFY(urlResolver->set(QRegExp(QLatin1String("^$")), this, "_q_index")); QVERIFY(urlResolver->set(QRegExp(QLatin1String("^test/$")), this, "_q_noArgs")); QVERIFY(urlResolver->set(QRegExp(QLatin1String("^test/([0-9]+)/$")), this, "_q_oneArg")); QVERIFY(urlResolver->set(QRegExp(QLatin1String("^test/([0-9]+)/([a-z]+)/$")), this, "_q_twoArgs")); QVERIFY(urlResolver->include(QRegExp(QLatin1String("^recurse/")), urlSub)); } void tst_QDjangoUrlResolver::testRespond_data() { QTest::addColumn("path"); QTest::addColumn("err"); QTest::addColumn("body"); QTest::newRow("root") << "/" << 200 << ""; QTest::newRow("not-found") << "/non-existent/" << 404 << ""; QTest::newRow("no-args") << "/test/" << 200 << ""; QTest::newRow("one-args") << "/test/123/" << 200 << ""; QTest::newRow("two-args") << "/test/123/delete/" << 200 << ""; QTest::newRow("three-args") << "/test/123/delete/zoo/" << 404 << ""; QTest::newRow("recurse-not-found") << "/recurse/non-existent/" << 404 << ""; QTest::newRow("recurse-index") << "/recurse/" << 200 << ""; QTest::newRow("recurse-test") << "/recurse/test/" << 200 << ""; } void tst_QDjangoUrlResolver::testRespond() { QFETCH(QString, path); QFETCH(int, err); QFETCH(QString, body); QDjangoHttpTestRequest request(QLatin1String("GET"), path); QDjangoHttpResponse *response = urlResolver->respond(request, path); QVERIFY(response); QCOMPARE(int(response->statusCode()), err); } void tst_QDjangoUrlResolver::testReverse_data() { QTest::addColumn("path"); QTest::addColumn("receiver"); QTest::addColumn("member"); QTest::addColumn("args"); QTest::addColumn("warning"); QObject *receiver = this; QTest::newRow("root") << "/" << receiver << "_q_index" << "" << ""; QTest::newRow("no-args") << "/test/" << receiver << "_q_noArgs" << "" << ""; QTest::newRow("one-arg") << "/test/123/" << receiver << "_q_oneArg" << "123" << ""; QTest::newRow("two-args") << "/test/123/delete/" << receiver << "_q_twoArgs" << "123|delete" << ""; QTest::newRow("too-few-args") << "" << receiver << "_q_oneArg" << "" << "Too few arguments for '_q_oneArg'"; QTest::newRow("too-many-args") << "" << receiver << "_q_noArgs" << "123" << "Too many arguments for '_q_noArgs'"; receiver = urlHelper; QTest::newRow("recurse-index") << "/recurse/" << receiver << "_q_index" << "" << ""; QTest::newRow("recurse-test") << "/recurse/test/" << receiver << "_q_test" << "" << ""; } void tst_QDjangoUrlResolver::testReverse() { QFETCH(QString, path); QFETCH(QObject*, receiver); QFETCH(QString, member); QFETCH(QString, args); QFETCH(QString, warning); QVariantList varArgs; if (!args.isEmpty()) { foreach (const QString &bit, args.split(QLatin1Char('|'))) varArgs << bit; } if (!warning.isEmpty()) QTest::ignoreMessage(QtWarningMsg, warning.toLatin1()); QCOMPARE(urlResolver->reverse(receiver, member.toLatin1(), varArgs), path); } QDjangoHttpResponse* tst_QDjangoUrlResolver::_q_index(const QDjangoHttpRequest &request) { Q_UNUSED(request); return new QDjangoHttpResponse; } QDjangoHttpResponse* tst_QDjangoUrlResolver::_q_noArgs(const QDjangoHttpRequest &request) { Q_UNUSED(request); return new QDjangoHttpResponse; } QDjangoHttpResponse* tst_QDjangoUrlResolver::_q_oneArg(const QDjangoHttpRequest &request, const QString &id) { Q_UNUSED(request); Q_UNUSED(id); return new QDjangoHttpResponse; } QDjangoHttpResponse* tst_QDjangoUrlResolver::_q_twoArgs(const QDjangoHttpRequest &request, const QString &id, const QString &action) { Q_UNUSED(request); Q_UNUSED(id); Q_UNUSED(action); return new QDjangoHttpResponse; } QTEST_MAIN(tst_QDjangoUrlResolver) #include "tst_qdjangourlresolver.moc" qdjango-0.4.0/tests/run.py0000755000175000007640000000312612163016632015403 0ustar sharkyjerryweb#!/usr/bin/python import getopt import os import platform import subprocess import sys components = ['db', 'http', 'script'] root = os.path.dirname(__file__) report_path = None def usage(): print "Usage: run.py [options]" # parse options try: opts, args = getopt.getopt(sys.argv[1:], 'hvx:') except getopt.GetoptError, err: print err usage() sys.exit(2) for opt, optarg in opts: if opt == '-h': usage() sys.exit() elif opt == '-v': os.environ['QDJANGO_DB_DEBUG'] = '1' elif opt == '-x': report_path = optarg if not os.path.exists(report_path): os.mkdir(report_path) # set library path path = [] for component in components: path.append(os.path.join(root, '..', 'src', component)) if platform.system() == 'Darwin': os.environ['DYLD_LIBRARY_PATH'] = ':'.join(path) else: os.environ['LD_LIBRARY_PATH'] = ':'.join(path) # run tests for component in components: component_path = os.path.join(root, component) for test in os.listdir(component_path): test_path = os.path.join(component_path, test) if os.path.isdir(test_path): if platform.system() == 'Darwin': prog = os.path.join(test_path, 'tst_' + test + '.app', 'Contents', 'MacOS', 'tst_' + test) else: prog = os.path.join(test_path, 'tst_' + test) if not os.path.exists(prog): continue cmd = [ prog ] if report_path: cmd += ['-xunitxml', '-o', os.path.join(report_path, test + '.xml') ] subprocess.call(cmd) qdjango-0.4.0/tests/db/0000755000175000007640000000000012163016632014605 5ustar sharkyjerrywebqdjango-0.4.0/tests/db/shares/0000755000175000007640000000000012163016632016072 5ustar sharkyjerrywebqdjango-0.4.0/tests/db/shares/tst_shares.cpp0000644000175000007640000000662112163016632020762 0ustar sharkyjerryweb/* * 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. */ #include "QDjangoQuerySet.h" #include "util.h" /** Tests for the File class. */ class tst_Shares : public QObject { Q_OBJECT private slots: void initTestCase(); void testFile(); void cleanup(); void cleanupTestCase(); }; class File : public QDjangoModel { Q_OBJECT Q_PROPERTY(QDateTime date READ date WRITE setDate) Q_PROPERTY(QByteArray hash READ hash WRITE setHash) Q_PROPERTY(QString path READ path WRITE setPath) Q_PROPERTY(qint64 size READ size WRITE setSize) Q_CLASSINFO("path", "max_length=255 primary_key=true") Q_CLASSINFO("hash", "max_length=32") public: File(QObject *parent = 0); QDateTime date() const; void setDate(const QDateTime &date); QByteArray hash() const; void setHash(const QByteArray &hash); QString path() const; void setPath(const QString &path); qint64 size() const; void setSize(qint64 size); private: QDateTime m_date; QByteArray m_hash; QString m_path; qint64 m_size; }; File::File(QObject *parent) : QDjangoModel(parent), m_size(0) { } QDateTime File::date() const { return m_date; } void File::setDate(const QDateTime &date) { m_date = date; } QByteArray File::hash() const { return m_hash; } void File::setHash(const QByteArray &hash) { m_hash = hash; } QString File::path() const { return m_path; } void File::setPath(const QString &path) { m_path = path; } qint64 File::size() const { return m_size; } void File::setSize(qint64 size) { m_size = size; } /** Create database table before running tests. */ void tst_Shares::initTestCase() { QVERIFY(initialiseDatabase()); QCOMPARE(QDjango::registerModel().createTable(), true); } void tst_Shares::testFile() { // create a file File file; file.setDate(QDateTime(QDate(2010, 6, 1), QTime(10, 5, 14))); file.setHash(QByteArray("\0\1\2\3\4", 5)); file.setPath("foo/bar.txt"); file.setSize(1234); QCOMPARE(file.save(), true); File *other = QDjangoQuerySet().get(QDjangoWhere("path", QDjangoWhere::Equals, "foo/bar.txt")); QVERIFY(other != 0); QCOMPARE(other->date(), QDateTime(QDate(2010, 6, 1), QTime(10, 5, 14))); QCOMPARE(other->hash(), QByteArray("\0\1\2\3\4", 5)); QCOMPARE(other->path(), QLatin1String("foo/bar.txt")); QCOMPARE(other->size(), qint64(1234)); delete other; // update the file file.setSize(5678); QCOMPARE(file.save(), true); } /** Clear database table after each test. */ void tst_Shares::cleanup() { QCOMPARE(QDjangoQuerySet().remove(), true); } /** Drop database table after running tests. */ void tst_Shares::cleanupTestCase() { QCOMPARE(QDjango::registerModel().dropTable(), true); } QTEST_MAIN(tst_Shares) #include "tst_shares.moc" qdjango-0.4.0/tests/db/shares/shares.pro0000644000175000007640000000010212163016632020072 0ustar sharkyjerrywebinclude(../db.pri) TARGET = tst_shares SOURCES += tst_shares.cpp qdjango-0.4.0/tests/db/qdjangomodel/0000755000175000007640000000000012163016632017251 5ustar sharkyjerrywebqdjango-0.4.0/tests/db/qdjangomodel/tst_qdjangomodel.cpp0000644000175000007640000001672112163016632023322 0ustar sharkyjerryweb/* * Copyright (C) 2010-2013 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. */ #include "QDjango.h" #include "QDjangoModel.h" #include "QDjangoQuerySet.h" #include "QDjangoWhere.h" #include "util.h" class TestModel : public QDjangoModel { public: TestModel(QObject *parent = 0) : QDjangoModel(parent) {} // expose foreign key methods so they can be tested QObject *foreignKey(const char *name) const { return QDjangoModel::foreignKey(name); } void setForeignKey(const char *name, QObject *value) { QDjangoModel::setForeignKey(name, value); } }; class Author : public TestModel { Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName) public: Author(QObject *parent = 0) : TestModel(parent) {} QString name() const { return m_name; } void setName(const QString &name) { m_name = name; } private: QString m_name; }; class Book : public TestModel { Q_OBJECT Q_PROPERTY(Author* author READ author WRITE setAuthor) Q_PROPERTY(QString title READ title WRITE setTitle) Q_CLASSINFO("author", "on_delete=cascade") public: Book(QObject *parent = 0) : TestModel(parent) { setForeignKey("author", new Author(this)); } Author *author() const { return qobject_cast(foreignKey("author")); } void setAuthor(Author *author) { setForeignKey("author", author); } QString title() const { return m_title; } void setTitle(const QString &title) { m_title = title; } private: QString m_title; }; class BookWithNullAuthor : public TestModel { Q_OBJECT Q_PROPERTY(Author* author READ author WRITE setAuthor) Q_PROPERTY(QString title READ title WRITE setTitle) Q_CLASSINFO("author", "null=true") public: BookWithNullAuthor(QObject *parent = 0) : TestModel(parent) {} Author *author() const { return qobject_cast(foreignKey("author")); } void setAuthor(Author *author) { setForeignKey("author", author); } QString title() const { return m_title; } void setTitle(const QString &title) { m_title = title; } private: QString m_title; }; /** Test QDjangoModel class. */ class tst_QDjangoModel : public QObject { Q_OBJECT private slots: void initTestCase(); void init(); void deleteCascade(); void foreignKey(); void foreignKey_null(); void setForeignKey(); void filterRelated(); void selectRelated(); void selectRelated_null(); void cleanup(); void cleanupTestCase(); }; /** Create database tables before running tests. */ void tst_QDjangoModel::initTestCase() { QVERIFY(initialiseDatabase()); QCOMPARE(QDjango::registerModel().createTable(), true); QCOMPARE(QDjango::registerModel().createTable(), true); QCOMPARE(QDjango::registerModel().createTable(), true); } /** Load fixtures. */ void tst_QDjangoModel::init() { Author author1; author1.setName("First author"); QCOMPARE(author1.save(), true); Author author2; author2.setName("Second author"); QCOMPARE(author2.save(), true); Book book; book.setAuthor(&author1); book.setTitle("Some book"); QCOMPARE(book.save(), true); Book book2; book2.setAuthor(&author2); book2.setTitle("Other book"); QCOMPARE(book2.save(), true); BookWithNullAuthor book3; book3.setTitle("Book with null author"); QCOMPARE(book3.save(), true); } void tst_QDjangoModel::deleteCascade() { const QDjangoQuerySet authors; const QDjangoQuerySet books; QCOMPARE(authors.count(), 2); QCOMPARE(books.count(), 2); QVERIFY(authors.filter(QDjangoWhere("name", QDjangoWhere::Equals, "First author")).remove()); QCOMPARE(authors.count(), 1); QCOMPARE(books.count(), 1); } void tst_QDjangoModel::foreignKey() { QTest::ignoreMessage(QtWarningMsg, "QDjangoMetaModel cannot get foreign model for invalid key 'bad'"); Book book; QVERIFY(!book.foreignKey("bad")); QVERIFY(book.foreignKey("author")); } void tst_QDjangoModel::foreignKey_null() { QTest::ignoreMessage(QtWarningMsg, "QDjangoMetaModel cannot get foreign model for invalid key 'bad'"); BookWithNullAuthor book; QVERIFY(!book.foreignKey("bad")); QVERIFY(!book.foreignKey("author")); } void tst_QDjangoModel::setForeignKey() { QTest::ignoreMessage(QtWarningMsg, "QDjangoMetaModel cannot set foreign model for invalid key 'bad'"); Book book; book.setForeignKey("bad", 0); book.setForeignKey("author", 0); } /** Perform filtering on foreign keys. */ void tst_QDjangoModel::filterRelated() { QDjangoQuerySet books; QDjangoQuerySet qs = books.filter( QDjangoWhere("author__name", QDjangoWhere::Equals, "First author")); CHECKWHERE(qs.where(), QLatin1String("T0.\"name\" = ?"), QVariantList() << "First author"); QCOMPARE(qs.count(), 1); QCOMPARE(qs.size(), 1); Book *book = qs.at(0); QVERIFY(book != 0); QCOMPARE(book->title(), QLatin1String("Some book")); delete book; } /** Test eager loading of foreign keys. */ void tst_QDjangoModel::selectRelated() { // without eager loading QDjangoQuerySet qs; Book *book = qs.get(QDjangoWhere("title", QDjangoWhere::Equals, "Some book")); QVERIFY(book != 0); QCOMPARE(book->title(), QLatin1String("Some book")); QVERIFY(book->author() != 0); QCOMPARE(book->author()->name(), QLatin1String("First author")); delete book; // with eager loading book = qs.selectRelated().get(QDjangoWhere("title", QDjangoWhere::Equals, "Some book")); QVERIFY(book != 0); QCOMPARE(book->title(), QLatin1String("Some book")); QVERIFY(book->author() != 0); QCOMPARE(book->author()->name(), QLatin1String("First author")); delete book; } void tst_QDjangoModel::selectRelated_null() { // without eager loading QDjangoQuerySet qs; BookWithNullAuthor *book = qs.get(QDjangoWhere("title", QDjangoWhere::Equals, "Book with null author")); QVERIFY(book != 0); QCOMPARE(book->title(), QLatin1String("Book with null author")); QVERIFY(!book->author()); delete book; // with eager loading book = qs.selectRelated().get(QDjangoWhere("title", QDjangoWhere::Equals, "Book with null author")); QVERIFY(book != 0); QCOMPARE(book->title(), QLatin1String("Book with null author")); QVERIFY(!book->author()); delete book; } /** Clear database tables after each test. */ void tst_QDjangoModel::cleanup() { QCOMPARE(QDjangoQuerySet().remove(), true); QCOMPARE(QDjangoQuerySet().remove(), true); QCOMPARE(QDjangoQuerySet().remove(), true); } /** Drop database tables after running tests. */ void tst_QDjangoModel::cleanupTestCase() { QCOMPARE(QDjango::registerModel().dropTable(), true); QCOMPARE(QDjango::registerModel().dropTable(), true); QCOMPARE(QDjango::registerModel().dropTable(), true); } QTEST_MAIN(tst_QDjangoModel) #include "tst_qdjangomodel.moc" qdjango-0.4.0/tests/db/qdjangomodel/qdjangomodel.pro0000644000175000007640000000011612163016632022435 0ustar sharkyjerrywebinclude(../db.pri) TARGET = tst_qdjangomodel SOURCES += tst_qdjangomodel.cpp qdjango-0.4.0/tests/db/auth-models.cpp0000644000175000007640000000671612163016632017545 0ustar sharkyjerryweb/* * 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. */ #include "QDjangoQuerySet.h" #include "auth-models.h" User::User(QObject *parent) : QDjangoModel(parent), m_isActive(true), m_isStaff(false), m_isSuperUser(false) { // initialise dates m_dateJoined = QDateTime::currentDateTime(); m_lastLogin = QDateTime::currentDateTime(); } QString User::username() const { return m_username; } void User::setUsername(const QString &username) { m_username = username; } QString User::firstName() const { return m_firstName; } void User::setFirstName(const QString &firstName) { m_firstName = firstName; } QString User::lastName() const { return m_lastName; } void User::setLastName(const QString &lastName) { m_lastName = lastName; } QString User::email() const { return m_email; } void User::setEmail(const QString &email) { m_email = email; } QString User::password() const { return m_password; } void User::setPassword(const QString &password) { m_password = password; } bool User::isActive() const { return m_isActive; } void User::setIsActive(bool isActive) { m_isActive = isActive; } bool User::isStaff() const { return m_isStaff; } void User::setIsStaff(bool isStaff) { m_isStaff = isStaff; } bool User::isSuperUser() const { return m_isSuperUser; } void User::setIsSuperUser(bool isSuperUser) { m_isSuperUser = isSuperUser; } QDateTime User::dateJoined() const { return m_dateJoined; } void User::setDateJoined(const QDateTime &dateJoined) { m_dateJoined = dateJoined; } QDateTime User::lastLogin() const { return m_lastLogin; } void User::setLastLogin(const QDateTime &lastLogin) { m_lastLogin = lastLogin; } Group::Group(QObject *parent) : QDjangoModel(parent) { } QString Group::name() const { return m_name; } void Group::setName(const QString &name) { m_name = name; } UserGroups::UserGroups(QObject *parent) : QDjangoModel(parent) { setForeignKey("user", new User(this)); setForeignKey("group", new Group(this)); } User *UserGroups::user() const { return qobject_cast(foreignKey("user")); } void UserGroups::setUser(User *user) { setForeignKey("user", user); } Group *UserGroups::group() const { return qobject_cast(foreignKey("group")); } void UserGroups::setGroup(Group *group) { setForeignKey("group", group); } Message::Message(QObject *parent) : QDjangoModel(parent) { setForeignKey("user", new User(this)); } /** Returns the User associated with this Message. */ User *Message::user() const { return qobject_cast(foreignKey("user")); } void Message::setUser(User *user) { setForeignKey("user", user); } QString Message::message() const { return m_message; } void Message::setMessage(const QString &message) { m_message = message; } Q_DECLARE_METATYPE(Group*) Q_DECLARE_METATYPE(User*) qdjango-0.4.0/tests/db/qdjangocompiler/0000755000175000007640000000000012163016632017763 5ustar sharkyjerrywebqdjango-0.4.0/tests/db/qdjangocompiler/qdjangocompiler.pro0000644000175000007640000000012312163016632023657 0ustar sharkyjerrywebinclude(../db.pri) TARGET = tst_qdjangocompiler SOURCES += tst_qdjangocompiler.cpp qdjango-0.4.0/tests/db/qdjangocompiler/tst_qdjangocompiler.cpp0000644000175000007640000002433212163016632024543 0ustar sharkyjerryweb/* * Copyright (C) 2010-2013 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. */ #include #include "QDjango.h" #include "QDjangoQuerySet.h" #include "QDjangoWhere.h" #include "util.h" static QString escapeField(const QSqlDatabase &db, const QString &name) { return db.driver()->escapeIdentifier(name, QSqlDriver::FieldName); } static QString escapeTable(const QSqlDatabase &db, const QString &name) { return db.driver()->escapeIdentifier(name, QSqlDriver::TableName); } class Item : public QDjangoModel { Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName) public: Item(QObject *parent = 0); QString name() const; void setName(const QString &name); private: QString m_name; }; class Owner : public QDjangoModel { Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(Item* item1 READ item1 WRITE setItem1) Q_PROPERTY(Item* item2 READ item2 WRITE setItem2) public: Owner(QObject *parent = 0); QString name() const; void setName(const QString &name); Item *item1() const; void setItem1(Item *item1); Item *item2() const; void setItem2(Item *item2); private: QString m_name; }; class OwnerWithNullableItem : public QDjangoModel { Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(Item* item1 READ item1 WRITE setItem1) Q_PROPERTY(Item* item2 READ item2 WRITE setItem2) Q_CLASSINFO("item2", "null=true") public: OwnerWithNullableItem(QObject *parent = 0); QString name() const; void setName(const QString &name); Item *item1() const; void setItem1(Item *item1); Item *item2() const; void setItem2(Item *item2); private: QString m_name; }; class tst_QDjangoCompiler : public QObject { Q_OBJECT private slots: void initTestCase(); void fieldNames(); void fieldNamesRecursive(); void fieldNamesNullable(); void orderLimit(); void resolve(); }; Item::Item(QObject *parent) : QDjangoModel(parent) { } QString Item::name() const { return m_name; } void Item::setName(const QString &name) { m_name = name; } Owner::Owner(QObject *parent) : QDjangoModel(parent) { setForeignKey("item1", new Item(this)); setForeignKey("item2", new Item(this)); } QString Owner::name() const { return m_name; } void Owner::setName(const QString &name) { m_name = name; } Item* Owner::item1() const { return qobject_cast(foreignKey("item1")); } void Owner::setItem1(Item *item1) { setForeignKey("item1", item1); } Item* Owner::item2() const { return qobject_cast(foreignKey("item2")); } void Owner::setItem2(Item *item2) { setForeignKey("item2", item2); } OwnerWithNullableItem::OwnerWithNullableItem(QObject *parent) : QDjangoModel(parent) { setForeignKey("item1", new Item(this)); setForeignKey("item2", new Item(this)); } QString OwnerWithNullableItem::name() const { return m_name; } void OwnerWithNullableItem::setName(const QString &name) { m_name = name; } Item* OwnerWithNullableItem::item1() const { return qobject_cast(foreignKey("item1")); } void OwnerWithNullableItem::setItem1(Item *item1) { setForeignKey("item1", item1); } Item* OwnerWithNullableItem::item2() const { return qobject_cast(foreignKey("item2")); } void OwnerWithNullableItem::setItem2(Item *item2) { setForeignKey("item2", item2); } void tst_QDjangoCompiler::initTestCase() { QVERIFY(initialiseDatabase()); QDjango::registerModel(); QDjango::registerModel(); QDjango::registerModel(); } void tst_QDjangoCompiler::fieldNames() { QSqlDatabase db = QDjango::database(); QDjangoCompiler compiler("Owner", db); QCOMPARE(compiler.fieldNames(false), QStringList() << escapeTable(db, "owner") + "." + escapeField(db, "id") << escapeTable(db, "owner") + "." + escapeField(db, "name") << escapeTable(db, "owner") + "." + escapeField(db, "item1_id") << escapeTable(db, "owner") + "." + escapeField(db, "item2_id")); QCOMPARE(compiler.fromSql(), escapeTable(db, "owner")); } void tst_QDjangoCompiler::fieldNamesRecursive() { QSqlDatabase db = QDjango::database(); QDjangoCompiler compiler("Owner", db); QCOMPARE(compiler.fieldNames(true), QStringList() << escapeTable(db, "owner") + "." + escapeField(db, "id") << escapeTable(db, "owner") + "." + escapeField(db, "name") << escapeTable(db, "owner") + "." + escapeField(db, "item1_id") << escapeTable(db, "owner") + "." + escapeField(db, "item2_id") << "T0." + escapeField(db, "id") << "T0." + escapeField(db, "name") << "T1." + escapeField(db, "id") << "T1." + escapeField(db, "name")); QCOMPARE(compiler.fromSql(), QString("%1 INNER JOIN %2 T0 ON T0.%3 = %4.%5 INNER JOIN %6 T1 ON T1.%7 = %8.%9").arg( escapeTable(db, "owner"), escapeTable(db, "item"), escapeField(db, "id"), escapeTable(db, "owner"), escapeField(db, "item1_id"), escapeTable(db, "item"), escapeField(db, "id"), escapeTable(db, "owner"), escapeField(db, "item2_id"))); } void tst_QDjangoCompiler::fieldNamesNullable() { QSqlDatabase db = QDjango::database(); QDjangoCompiler compiler("OwnerWithNullableItem", db); QCOMPARE(compiler.fieldNames(true), QStringList() << escapeTable(db, "ownerwithnullableitem") + "." + escapeField(db, "id") << escapeTable(db, "ownerwithnullableitem") + "." + escapeField(db, "name") << escapeTable(db, "ownerwithnullableitem") + "." + escapeField(db, "item1_id") << escapeTable(db, "ownerwithnullableitem") + "." + escapeField(db, "item2_id") << "T0." + escapeField(db, "id") << "T0." + escapeField(db, "name") << "T1." + escapeField(db, "id") << "T1." + escapeField(db, "name")); QCOMPARE(compiler.fromSql(), QString("%1 INNER JOIN %2 T0 ON T0.%3 = %4.%5 LEFT OUTER JOIN %6 T1 ON T1.%7 = %8.%9").arg( escapeTable(db, "ownerwithnullableitem"), escapeTable(db, "item"), escapeField(db, "id"), escapeTable(db, "ownerwithnullableitem"), escapeField(db, "item1_id"), escapeTable(db, "item"), escapeField(db, "id"), escapeTable(db, "ownerwithnullableitem"), escapeField(db, "item2_id"))); } void tst_QDjangoCompiler::orderLimit() { QSqlDatabase db = QDjango::database(); QDjangoCompiler compiler("Owner", db); QCOMPARE(compiler.orderLimitSql(QStringList("name"), 0, 0), QString(" ORDER BY %1.%2 ASC").arg( escapeTable(db, "owner"), escapeField(db, "name"))); QCOMPARE(compiler.fromSql(), escapeTable(db, "owner")); compiler = QDjangoCompiler("Owner", db); QCOMPARE(compiler.orderLimitSql(QStringList("-name"), 0, 0), QString(" ORDER BY %1.%2 DESC").arg( escapeTable(db, "owner"), escapeField(db, "name"))); QCOMPARE(compiler.fromSql(), escapeTable(db, "owner")); compiler = QDjangoCompiler("Owner", db); QCOMPARE(compiler.orderLimitSql(QStringList("item1__name"), 0, 0), QString(" ORDER BY T0.%1 ASC").arg( escapeField(db, "name"))); QCOMPARE(compiler.fromSql(), QString("%1 INNER JOIN %2 T0 ON T0.%3 = %4.%5").arg( escapeTable(db, "owner"), escapeTable(db, "item"), escapeField(db, "id"), escapeTable(db, "owner"), escapeField(db, "item1_id"))); compiler = QDjangoCompiler("Owner", db); QCOMPARE(compiler.orderLimitSql(QStringList() << "item1__name" << "item2__name", 0, 0), QString(" ORDER BY T0.%1 ASC, T1.%2 ASC").arg( escapeField(db, "name"), escapeField(db, "name"))); QCOMPARE(compiler.fromSql(), QString("%1 INNER JOIN %2 T0 ON T0.%3 = %4.%5 INNER JOIN %6 T1 ON T1.%7 = %8.%9").arg( escapeTable(db, "owner"), escapeTable(db, "item"), escapeField(db, "id"), escapeTable(db, "owner"), escapeField(db, "item1_id"), escapeTable(db, "item"), escapeField(db, "id"), escapeTable(db, "owner"), escapeField(db, "item2_id"))); } void tst_QDjangoCompiler::resolve() { QSqlDatabase db = QDjango::database(); QDjangoCompiler compiler("Owner", db); QDjangoWhere where("name", QDjangoWhere::Equals, "foo"); compiler.resolve(where); CHECKWHERE(where, QLatin1String("\"owner\".\"name\" = ?"), QVariantList() << "foo"); QCOMPARE(compiler.fromSql(), escapeTable(db, "owner")); compiler = QDjangoCompiler("Owner", db); where = QDjangoWhere("item1__name", QDjangoWhere::Equals, "foo"); compiler.resolve(where); CHECKWHERE(where, QLatin1String("T0.\"name\" = ?"), QVariantList() << "foo"); QCOMPARE(compiler.fromSql(), QString("%1 INNER JOIN %2 T0 ON T0.%3 = %4.%5").arg( escapeTable(db, "owner"), escapeTable(db, "item"), escapeField(db, "id"), escapeTable(db, "owner"), escapeField(db, "item1_id"))); compiler = QDjangoCompiler("Owner", db); where = QDjangoWhere("item1__name", QDjangoWhere::Equals, "foo") && QDjangoWhere("item2__name", QDjangoWhere::Equals, "bar"); compiler.resolve(where); CHECKWHERE(where, QLatin1String("T0.\"name\" = ? AND T1.\"name\" = ?"), QVariantList() << "foo" << "bar"); QCOMPARE(compiler.fromSql(), QString("%1 INNER JOIN %2 T0 ON T0.%3 = %4.%5 INNER JOIN %6 T1 ON T1.%7 = %8.%9").arg( escapeTable(db, "owner"), escapeTable(db, "item"), escapeField(db, "id"), escapeTable(db, "owner"), escapeField(db, "item1_id"), escapeTable(db, "item"), escapeField(db, "id"), escapeTable(db, "owner"), escapeField(db, "item2_id"))); } QTEST_MAIN(tst_QDjangoCompiler) #include "tst_qdjangocompiler.moc" qdjango-0.4.0/tests/db/qdjangoqueryset/0000755000175000007640000000000012163016632020032 5ustar sharkyjerrywebqdjango-0.4.0/tests/db/qdjangoqueryset/tst_qdjangoqueryset.cpp0000644000175000007640000001033012163016632024652 0ustar sharkyjerryweb/* * 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. */ #include "QDjango.h" #include "QDjangoQuerySet.h" #include "QDjangoWhere.h" #include "auth-models.h" #include "util.h" class Object : public QObject { Q_OBJECT Q_PROPERTY(QString foo READ foo WRITE setFoo) Q_PROPERTY(int bar READ bar WRITE setBar) Q_CLASSINFO("__meta__", "db_table=foo_table") Q_CLASSINFO("foo", "max_length=255") Q_CLASSINFO("bar", "db_column=bar_column") public: QString foo() const { return m_foo; }; void setFoo(const QString &foo) { m_foo = foo; }; int bar() const { return m_bar; }; void setBar(int bar) { m_bar = bar; }; private: QString m_foo; int m_bar; }; /** Test QDjangoQuerySetPrivate class. */ class tst_QDjangoQuerySetPrivate : public QObject { Q_OBJECT private slots: void initTestCase(); void countQuery(); void deleteQuery(); void insertQuery(); void updateQuery(); void cleanupTestCase(); private: QDjangoMetaModel metaModel; }; void tst_QDjangoQuerySetPrivate::initTestCase() { QVERIFY(initialiseDatabase()); metaModel = QDjango::registerModel(); QCOMPARE(metaModel.createTable(), true); } void tst_QDjangoQuerySetPrivate::countQuery() { QDjangoQuerySetPrivate qs("Object"); qs.addFilter(QDjangoWhere("pk", QDjangoWhere::Equals, 1)); QDjangoQuery query = qs.countQuery(); QCOMPARE(normalizeSql(QDjango::database(), query.lastQuery()), QLatin1String("SELECT COUNT(*) FROM \"foo_table\" WHERE \"foo_table\".\"id\" = ?")); QCOMPARE(query.boundValues().size(), 1); QCOMPARE(query.boundValue(0), QVariant(1)); } void tst_QDjangoQuerySetPrivate::deleteQuery() { QDjangoQuerySetPrivate qs("Object"); qs.addFilter(QDjangoWhere("pk", QDjangoWhere::Equals, 1)); QDjangoQuery query = qs.deleteQuery(); QCOMPARE(normalizeSql(QDjango::database(), query.lastQuery()), QLatin1String("DELETE FROM \"foo_table\" WHERE \"foo_table\".\"id\" = ?")); QCOMPARE(query.boundValues().size(), 1); QCOMPARE(query.boundValue(0), QVariant(1)); } void tst_QDjangoQuerySetPrivate::insertQuery() { QVariantMap data; data.insert("foo", "abc"); QDjangoQuerySetPrivate qs("Object"); QDjangoQuery query = qs.insertQuery(data); QCOMPARE(normalizeSql(QDjango::database(), query.lastQuery()), QLatin1String("INSERT INTO \"foo_table\" (\"foo\") VALUES(?)")); QCOMPARE(query.boundValues().size(), 1); QCOMPARE(query.boundValue(0), QVariant("abc")); } void tst_QDjangoQuerySetPrivate::updateQuery() { QVariantMap data; data.insert("foo", "abc"); { QDjangoQuerySetPrivate qs("Object"); qs.addFilter(QDjangoWhere("pk", QDjangoWhere::Equals, 1)); QDjangoQuery query = qs.updateQuery(data); QCOMPARE(normalizeSql(QDjango::database(), query.lastQuery()), QLatin1String("UPDATE \"foo_table\" SET \"foo\" = ? WHERE \"foo_table\".\"id\" = ?")); QCOMPARE(query.boundValues().size(), 2); QCOMPARE(query.boundValue(0), QVariant("abc")); QCOMPARE(query.boundValue(1), QVariant(1)); } { QDjangoQuerySetPrivate qs("Object"); qs.addFilter(QDjangoWhere("bar", QDjangoWhere::Equals, 3)); QDjangoQuery query = qs.updateQuery(data); QCOMPARE(normalizeSql(QDjango::database(), query.lastQuery()), QLatin1String("UPDATE \"foo_table\" SET \"foo\" = ? WHERE \"foo_table\".\"bar_column\" = ?")); QCOMPARE(query.boundValue(0), QVariant("abc")); QCOMPARE(query.boundValue(1), QVariant(3)); } } void tst_QDjangoQuerySetPrivate::cleanupTestCase() { metaModel.dropTable(); } QTEST_MAIN(tst_QDjangoQuerySetPrivate) #include "tst_qdjangoqueryset.moc" qdjango-0.4.0/tests/db/qdjangoqueryset/qdjangoqueryset.pro0000644000175000007640000000024712163016632024004 0ustar sharkyjerrywebinclude(../db.pri) TARGET = tst_qdjangoqueryset SOURCES += tst_qdjangoqueryset.cpp INCLUDEPATH += $$QDJANGO_INCLUDEPATH LIBS += -L../../../src/db $$QDJANGO_DB_LIBS qdjango-0.4.0/tests/db/qdjangowhere/0000755000175000007640000000000012163016632017263 5ustar sharkyjerrywebqdjango-0.4.0/tests/db/qdjangowhere/tst_qdjangowhere.cpp0000644000175000007640000002236412163016632023346 0ustar sharkyjerryweb/* * 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. */ #include "QDjangoWhere.h" #include "util.h" /** Test QDjangoWhere class. */ class tst_QDjangoWhere : public QObject { Q_OBJECT private slots: void initTestCase(); void emptyWhere(); void equalsWhere(); void notEqualsWhere(); void greaterThan(); void greaterOrEquals(); void lessThan(); void lessOrEquals(); void isIn(); void isNull(); void startsWith(); void endsWith(); void contains(); void andWhere(); void orWhere(); void complexWhere(); }; void tst_QDjangoWhere::initTestCase() { QVERIFY(initialiseDatabase()); } /** Test empty where clause. */ void tst_QDjangoWhere::emptyWhere() { // construct empty where clause QDjangoWhere testQuery; QCOMPARE(testQuery.isAll(), true); QCOMPARE(testQuery.isNone(), false); CHECKWHERE(testQuery, QString(), QVariantList()); // negate the where clause testQuery = !QDjangoWhere(); QCOMPARE(testQuery.isAll(), false); QCOMPARE(testQuery.isNone(), true); CHECKWHERE(testQuery, QLatin1String("1 != 0"), QVariantList()); } /** Test "=" comparison. */ void tst_QDjangoWhere::equalsWhere() { QDjangoWhere testQuery; // construct an "equals" where clause testQuery = QDjangoWhere("id", QDjangoWhere::Equals, 1); CHECKWHERE(testQuery, QLatin1String("id = ?"), QVariantList() << 1); // negate the where clause testQuery = !QDjangoWhere("id", QDjangoWhere::Equals, 1); CHECKWHERE(testQuery, QLatin1String("id != ?"), QVariantList() << 1); } /** Test "!=" comparison. */ void tst_QDjangoWhere::notEqualsWhere() { QDjangoWhere testQuery; // construct a "not equals" where clause testQuery = QDjangoWhere("id", QDjangoWhere::NotEquals, 1); CHECKWHERE(testQuery, QLatin1String("id != ?"), QVariantList() << 1); // negate the where clause testQuery = !QDjangoWhere("id", QDjangoWhere::NotEquals, 1); CHECKWHERE(testQuery, QLatin1String("id = ?"), QVariantList() << 1); } /** Test ">" comparison. */ void tst_QDjangoWhere::greaterThan() { QDjangoWhere testQuery; testQuery = QDjangoWhere("id", QDjangoWhere::GreaterThan, 1); CHECKWHERE(testQuery, QLatin1String("id > ?"), QVariantList() << 1); testQuery = !QDjangoWhere("id", QDjangoWhere::GreaterThan, 1); CHECKWHERE(testQuery, QLatin1String("id <= ?"), QVariantList() << 1); } /** Test ">=" comparison. */ void tst_QDjangoWhere::greaterOrEquals() { QDjangoWhere testQuery; testQuery = QDjangoWhere("id", QDjangoWhere::GreaterOrEquals, 1); CHECKWHERE(testQuery, QLatin1String("id >= ?"), QVariantList() << 1); testQuery = !QDjangoWhere("id", QDjangoWhere::GreaterOrEquals, 1); CHECKWHERE(testQuery, QLatin1String("id < ?"), QVariantList() << 1); } /** Test "<" comparison. */ void tst_QDjangoWhere::lessThan() { QDjangoWhere testQuery; testQuery = QDjangoWhere("id", QDjangoWhere::LessThan, 1); CHECKWHERE(testQuery, QLatin1String("id < ?"), QVariantList() << 1); testQuery = !QDjangoWhere("id", QDjangoWhere::LessThan, 1); CHECKWHERE(testQuery, QLatin1String("id >= ?"), QVariantList() << 1); } /** Test "<=" comparison. */ void tst_QDjangoWhere::lessOrEquals() { QDjangoWhere testQuery; testQuery = QDjangoWhere("id", QDjangoWhere::LessOrEquals, 1); CHECKWHERE(testQuery, QLatin1String("id <= ?"), QVariantList() << 1); testQuery = !QDjangoWhere("id", QDjangoWhere::LessOrEquals, 1); CHECKWHERE(testQuery, QLatin1String("id > ?"), QVariantList() << 1); } /** Test "in" comparison. */ void tst_QDjangoWhere::isIn() { QDjangoWhere testQuery = QDjangoWhere("id", QDjangoWhere::IsIn, QVariantList() << 1 << 2); CHECKWHERE(testQuery, QLatin1String("id IN (?, ?)"), QVariantList() << 1 << 2); testQuery = !QDjangoWhere("id", QDjangoWhere::IsIn, QVariantList() << 1 << 2); CHECKWHERE(testQuery, QLatin1String("id NOT IN (?, ?)"), QVariantList() << 1 << 2); } /** Test "isnull" comparison. */ void tst_QDjangoWhere::isNull() { QDjangoWhere testQuery = QDjangoWhere("id", QDjangoWhere::IsNull, true); CHECKWHERE(testQuery, QLatin1String("id IS NULL"), QVariantList()); testQuery = QDjangoWhere("id", QDjangoWhere::IsNull, false); CHECKWHERE(testQuery, QLatin1String("id IS NOT NULL"), QVariantList()); testQuery = !QDjangoWhere("id", QDjangoWhere::IsNull, true); CHECKWHERE(testQuery, QLatin1String("id IS NOT NULL"), QVariantList()); } /** Test "startswith" comparison. */ void tst_QDjangoWhere::startsWith() { QDjangoWhere testQuery = QDjangoWhere("name", QDjangoWhere::StartsWith, "abc"); CHECKWHERE(testQuery, QLatin1String("name LIKE ?"), QVariantList() << "abc%"); testQuery = !QDjangoWhere("name", QDjangoWhere::StartsWith, "abc"); CHECKWHERE(testQuery, QLatin1String("name NOT LIKE ?"), QVariantList() << "abc%"); } /** Test "endswith" comparison. */ void tst_QDjangoWhere::endsWith() { QDjangoWhere testQuery = QDjangoWhere("name", QDjangoWhere::EndsWith, "abc"); CHECKWHERE(testQuery, QLatin1String("name LIKE ?"), QVariantList() << "%abc"); testQuery = !QDjangoWhere("name", QDjangoWhere::EndsWith, "abc"); CHECKWHERE(testQuery, QLatin1String("name NOT LIKE ?"), QVariantList() << "%abc"); } /** Test "contains" comparison. */ void tst_QDjangoWhere::contains() { QDjangoWhere testQuery = QDjangoWhere("name", QDjangoWhere::Contains, "abc"); CHECKWHERE(testQuery, QLatin1String("name LIKE ?"), QVariantList() << "%abc%"); testQuery = !QDjangoWhere("name", QDjangoWhere::Contains, "abc"); CHECKWHERE(testQuery, QLatin1String("name NOT LIKE ?"), QVariantList() << "%abc%"); } /** Test compound where clause, using the AND operator. */ void tst_QDjangoWhere::andWhere() { QDjangoWhere testQuery; const QDjangoWhere queryId("id", QDjangoWhere::Equals, 1); const QDjangoWhere queryUsername("username", QDjangoWhere::Equals, "foo"); testQuery = queryId && queryUsername; CHECKWHERE(testQuery, QLatin1String("id = ? AND username = ?"), QVariantList() << 1 << "foo"); // and with "all" queryset testQuery = QDjangoWhere() && queryId; CHECKWHERE(testQuery, QLatin1String("id = ?"), QVariantList() << 1); testQuery = queryId && QDjangoWhere(); CHECKWHERE(testQuery, QLatin1String("id = ?"), QVariantList() << 1); // and with "none" queryset testQuery = !QDjangoWhere() && queryId; QCOMPARE(testQuery.isNone(), true); CHECKWHERE(testQuery, QLatin1String("1 != 0"), QVariantList()); testQuery = queryId && !QDjangoWhere(); QCOMPARE(testQuery.isNone(), true); CHECKWHERE(testQuery, QLatin1String("1 != 0"), QVariantList()); // negation testQuery = !(queryId && queryUsername); CHECKWHERE(testQuery, QLatin1String("NOT (id = ? AND username = ?)"), QVariantList() << 1 << "foo"); } /** Test compound where clause, using the OR operator. */ void tst_QDjangoWhere::orWhere() { QDjangoWhere testQuery; const QDjangoWhere queryId("id", QDjangoWhere::Equals, 1); const QDjangoWhere queryUsername("username", QDjangoWhere::Equals, "foo"); testQuery = queryId || queryUsername; CHECKWHERE(testQuery, QLatin1String("id = ? OR username = ?"), QVariantList() << 1 << "foo"); // or with "all" queryset testQuery = QDjangoWhere() || queryId; QCOMPARE(testQuery.isAll(), true); CHECKWHERE(testQuery, QString(), QVariantList()); testQuery = queryId || QDjangoWhere(); QCOMPARE(testQuery.isAll(), true); CHECKWHERE(testQuery, QString(), QVariantList()); // or with "none" queryset testQuery = !QDjangoWhere() || queryId; CHECKWHERE(testQuery, QLatin1String("id = ?"), QVariantList() << 1); testQuery = queryId || !QDjangoWhere(); CHECKWHERE(testQuery, QLatin1String("id = ?"), QVariantList() << 1); // negation testQuery = !(queryId || queryUsername); CHECKWHERE(testQuery, QLatin1String("NOT (id = ? OR username = ?)"), QVariantList() << 1 << "foo"); } /** Test compound where clause, using both the AND and the OR operators. */ void tst_QDjangoWhere::complexWhere() { QDjangoWhere testQuery; const QDjangoWhere queryId("id", QDjangoWhere::Equals, 1); const QDjangoWhere queryUsername("username", QDjangoWhere::Equals, "foouser"); const QDjangoWhere queryPassword("password", QDjangoWhere::Equals, "foopass"); testQuery = (queryId || queryUsername) && queryPassword; CHECKWHERE(testQuery, QLatin1String("(id = ? OR username = ?) AND password = ?"), QVariantList() << 1 << "foouser" << "foopass"); testQuery = queryId || (queryUsername && queryPassword); CHECKWHERE(testQuery, QLatin1String("id = ? OR (username = ? AND password = ?)"), QVariantList() << 1 << "foouser" << "foopass"); } QTEST_MAIN(tst_QDjangoWhere) #include "tst_qdjangowhere.moc" qdjango-0.4.0/tests/db/qdjangowhere/qdjangowhere.pro0000644000175000007640000000011612163016632022461 0ustar sharkyjerrywebinclude(../db.pri) TARGET = tst_qdjangowhere SOURCES += tst_qdjangowhere.cpp qdjango-0.4.0/tests/db/qdjangometamodel/0000755000175000007640000000000012163016632020120 5ustar sharkyjerrywebqdjango-0.4.0/tests/db/qdjangometamodel/tst_qdjangometamodel.h0000644000175000007640000001345312163016632024504 0ustar sharkyjerryweb/* * 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. */ #include #include "QDjangoModel.h" #include "auth-models.h" class tst_QDjangoMetaModel : public QObject { Q_OBJECT private slots: void initTestCase(); void testBool(); void testByteArray(); void testDate(); void testDateTime(); void testDouble(); void testInteger(); void testLongLong(); void testString(); void testTime(); void testOptions(); void testConstraints(); }; class tst_Bool : public QDjangoModel { Q_OBJECT Q_PROPERTY(bool value READ value WRITE setValue) public: bool value() const { return m_value; } void setValue(bool value) { m_value = value; } private: bool m_value; }; class tst_ByteArray : public QDjangoModel { Q_OBJECT Q_PROPERTY(QByteArray value READ value WRITE setValue) public: QByteArray value() const { return m_value; } void setValue(const QByteArray &value) { m_value = value; } private: QByteArray m_value; }; class tst_Date : public QDjangoModel { Q_OBJECT Q_PROPERTY(QDate value READ value WRITE setValue) public: QDate value() const { return m_value; } void setValue(const QDate &value) { m_value = value; } private: QDate m_value; }; class tst_DateTime : public QDjangoModel { Q_OBJECT Q_PROPERTY(QDateTime value READ value WRITE setValue) public: QDateTime value() const { return m_value; } void setValue(const QDateTime &value) { m_value = value; } private: QDateTime m_value; }; class tst_Double : public QDjangoModel { Q_OBJECT Q_PROPERTY(double value READ value WRITE setValue) public: double value() const { return m_value; } void setValue(double value) { m_value = value; } private: double m_value; }; class tst_Integer : public QDjangoModel { Q_OBJECT Q_PROPERTY(int value READ value WRITE setValue) public: int value() const { return m_value; } void setValue(int value) { m_value = value; } private: int m_value; }; class tst_LongLong : public QDjangoModel { Q_OBJECT Q_PROPERTY(qlonglong value READ value WRITE setValue) public: qlonglong value() const { return m_value; } void setValue(qlonglong value) { m_value = value; } private: qlonglong m_value; }; class tst_String : public QDjangoModel { Q_OBJECT Q_PROPERTY(QString value READ value WRITE setValue) Q_CLASSINFO("value", "max_length=255") public: QString value() const { return m_value; } void setValue(const QString &value) { m_value = value; } private: QString m_value; }; class tst_Time : public QDjangoModel { Q_OBJECT Q_PROPERTY(QTime value READ value WRITE setValue) public: QTime value() const { return m_value; } void setValue(const QTime &value) { m_value = value; } private: QTime m_value; }; class tst_Options : public QDjangoModel { Q_OBJECT Q_PROPERTY(int aField READ aField WRITE setAField) Q_PROPERTY(int bField READ bField WRITE setBField) Q_PROPERTY(int blankField READ blankField WRITE setBlankField) Q_PROPERTY(int indexField READ indexField WRITE setIndexField) Q_PROPERTY(int nullField READ nullField WRITE setNullField) Q_PROPERTY(int uniqueField READ uniqueField WRITE setUniqueField) Q_CLASSINFO("__meta__", "db_table=some_table unique_together=aField,bField") Q_CLASSINFO("bField", "db_column=b_field") Q_CLASSINFO("blankField", "blank=true") Q_CLASSINFO("indexField", "db_index=true") Q_CLASSINFO("nullField", "null=true") Q_CLASSINFO("uniqueField", "unique=true") public: int aField() const { return m_aField; } void setAField(int value) { m_aField = value; } int bField() const { return m_bField; } void setBField(int value) { m_bField = value; } int blankField() const { return m_blankField; } void setBlankField(int value) { m_blankField = value; } int indexField() const { return m_indexField; } void setIndexField(int value) { m_indexField = value; } int nullField() const { return m_nullField; } void setNullField(int value) { m_nullField = value; } int uniqueField() const { return m_uniqueField; } void setUniqueField(int value) { m_uniqueField = value; } private: int m_aField; int m_bField; int m_blankField; int m_indexField; int m_nullField; int m_uniqueField; }; class tst_FkConstraint : public QDjangoModel { Q_OBJECT Q_PROPERTY(User *noConstraint READ noConstraint WRITE setNoConstraint) Q_PROPERTY(User *cascadeConstraint READ cascadeConstraint WRITE setCascadeConstraint) Q_PROPERTY(User *restrictConstraint READ restrictConstraint WRITE setRestrictConstraint) Q_PROPERTY(User *nullConstraint READ nullConstraint WRITE setNullConstraint) Q_CLASSINFO("cascadeConstraint", "on_delete=cascade") Q_CLASSINFO("restrictConstraint", "on_delete=restrict") Q_CLASSINFO("nullConstraint", "null=true on_delete=set_null") public: tst_FkConstraint(QObject *parent = 0); User *noConstraint() const; void setNoConstraint(User *user); User *cascadeConstraint() const; void setCascadeConstraint(User *user); User *restrictConstraint() const; void setRestrictConstraint(User *user); User *nullConstraint() const; void setNullConstraint(User *user); }; qdjango-0.4.0/tests/db/qdjangometamodel/tst_qdjangometamodel.cpp0000644000175000007640000003077212163016632025042 0ustar sharkyjerryweb/* * 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. */ #include "QDjango.h" #include "QDjango_p.h" #include "QDjangoModel.h" #include "QDjangoQuerySet.h" #include "QDjangoWhere.h" #include "tst_qdjangometamodel.h" #include "util.h" #define Q QDjangoWhere template void init(const QStringList &sql) { const QDjangoMetaModel metaModel = QDjango::registerModel(); QCOMPARE(metaModel.createTableSql(), sql); QCOMPARE(metaModel.createTable(), true); } template void setAndGet(const K &value) { // save object T v1; v1.setValue(value); QCOMPARE(v1.save(), true); QVERIFY(!v1.pk().isNull()); // save again QCOMPARE(v1.save(), true); // get object T v2; QVERIFY(QDjangoQuerySet().get(Q(QLatin1String("pk"), Q::Equals, v1.pk()), &v2) != 0); QCOMPARE(v2.value(), value); } template void cleanup() { const QDjangoMetaModel metaModel = QDjango::registerModel(); QCOMPARE(metaModel.dropTable(), true); } tst_FkConstraint::tst_FkConstraint(QObject *parent) : QDjangoModel(parent) { setForeignKey("noConstraint", new User(this)); setForeignKey("cascadeConstraint", new User(this)); setForeignKey("restrictConstraint", new User(this)); setForeignKey("nullConstraint", new User(this)); } User *tst_FkConstraint::noConstraint() const { return qobject_cast(foreignKey("noConstraint")); } void tst_FkConstraint::setNoConstraint(User *user) { setForeignKey("noConstraint", user); } User *tst_FkConstraint::cascadeConstraint() const { return qobject_cast(foreignKey("cascadeConstraint")); } void tst_FkConstraint::setCascadeConstraint(User *user) { setForeignKey("cascadeConstraint", user); } User *tst_FkConstraint::restrictConstraint() const { return qobject_cast(foreignKey("restrictConstraint")); } void tst_FkConstraint::setRestrictConstraint(User *user) { setForeignKey("restrictConstraint", user); } User *tst_FkConstraint::nullConstraint() const { return qobject_cast(foreignKey("nullConstraint")); } void tst_FkConstraint::setNullConstraint(User *user) { setForeignKey("nullConstraint", user); } void tst_QDjangoMetaModel::initTestCase() { QVERIFY(initialiseDatabase()); } void tst_QDjangoMetaModel::testBool() { QStringList sql; if (QDjango::database().driverName() == QLatin1String("QPSQL")) sql << QLatin1String("CREATE TABLE \"tst_bool\" (\"id\" serial PRIMARY KEY, \"value\" boolean NOT NULL)"); else sql << QLatin1String("CREATE TABLE \"tst_bool\" (\"id\" integer NOT NULL PRIMARY KEY AUTOINCREMENT, \"value\" bool NOT NULL)"); init(sql); setAndGet(true); setAndGet(false); cleanup(); } void tst_QDjangoMetaModel::testByteArray() { QStringList sql; if (QDjango::database().driverName() == QLatin1String("QPSQL")) sql << QLatin1String("CREATE TABLE \"tst_bytearray\" (\"id\" serial PRIMARY KEY, \"value\" bytea NOT NULL)"); else sql << QLatin1String("CREATE TABLE \"tst_bytearray\" (\"id\" integer NOT NULL PRIMARY KEY AUTOINCREMENT, \"value\" blob NOT NULL)"); init(sql); setAndGet(QByteArray("01234567", 8)); setAndGet(QByteArray("\x00\x01\x02\x03\x04\x05\x06\x07", 8)); cleanup(); } void tst_QDjangoMetaModel::testDate() { QStringList sql; if (QDjango::database().driverName() == QLatin1String("QPSQL")) sql << QLatin1String("CREATE TABLE \"tst_date\" (\"id\" serial PRIMARY KEY, \"value\" date NOT NULL)"); else sql << QLatin1String("CREATE TABLE \"tst_date\" (\"id\" integer NOT NULL PRIMARY KEY AUTOINCREMENT, \"value\" date NOT NULL)"); init(sql); setAndGet(QDate(2012, 1, 8)); cleanup(); } void tst_QDjangoMetaModel::testDateTime() { QStringList sql; if (QDjango::database().driverName() == QLatin1String("QPSQL")) sql << QLatin1String("CREATE TABLE \"tst_datetime\" (\"id\" serial PRIMARY KEY, \"value\" timestamp NOT NULL)"); else sql << QLatin1String("CREATE TABLE \"tst_datetime\" (\"id\" integer NOT NULL PRIMARY KEY AUTOINCREMENT, \"value\" datetime NOT NULL)"); init(sql); setAndGet(QDateTime(QDate(2012, 1, 8), QTime(3, 4, 5))); cleanup(); } void tst_QDjangoMetaModel::testDouble() { QStringList sql; if (QDjango::database().driverName() == QLatin1String("QPSQL")) sql << QLatin1String("CREATE TABLE \"tst_double\" (\"id\" serial PRIMARY KEY, \"value\" real NOT NULL)"); else sql << QLatin1String("CREATE TABLE \"tst_double\" (\"id\" integer NOT NULL PRIMARY KEY AUTOINCREMENT, \"value\" real NOT NULL)"); init(sql); setAndGet(double(3.14159));; cleanup(); } void tst_QDjangoMetaModel::testInteger() { QStringList sql; if (QDjango::database().driverName() == QLatin1String("QPSQL")) sql << QLatin1String("CREATE TABLE \"tst_integer\" (\"id\" serial PRIMARY KEY, \"value\" integer NOT NULL)"); else sql << QLatin1String("CREATE TABLE \"tst_integer\" (\"id\" integer NOT NULL PRIMARY KEY AUTOINCREMENT, \"value\" integer NOT NULL)"); init(sql); setAndGet(0); setAndGet(-2147483647); setAndGet(2147483647); cleanup(); } void tst_QDjangoMetaModel::testLongLong() { QStringList sql; if (QDjango::database().driverName() == QLatin1String("QPSQL")) sql << QLatin1String("CREATE TABLE \"tst_longlong\" (\"id\" serial PRIMARY KEY, \"value\" bigint NOT NULL)"); else sql << QLatin1String("CREATE TABLE \"tst_longlong\" (\"id\" integer NOT NULL PRIMARY KEY AUTOINCREMENT, \"value\" bigint NOT NULL)"); init(sql); setAndGet(qlonglong(0)); setAndGet(qlonglong(-9223372036854775807ll)); setAndGet(qlonglong(9223372036854775807ll)); cleanup(); } void tst_QDjangoMetaModel::testString() { QStringList sql; if (QDjango::database().driverName() == QLatin1String("QPSQL")) sql << QLatin1String("CREATE TABLE \"tst_string\" (\"id\" serial PRIMARY KEY, \"value\" varchar(255) NOT NULL)"); else sql << QLatin1String("CREATE TABLE \"tst_string\" (\"id\" integer NOT NULL PRIMARY KEY AUTOINCREMENT, \"value\" varchar(255) NOT NULL)"); init(sql); setAndGet(QLatin1String("foo bar")); cleanup(); } void tst_QDjangoMetaModel::testTime() { QStringList sql; if (QDjango::database().driverName() == QLatin1String("QPSQL")) sql << QLatin1String("CREATE TABLE \"tst_time\" (\"id\" serial PRIMARY KEY, \"value\" time NOT NULL)"); else sql << QLatin1String("CREATE TABLE \"tst_time\" (\"id\" integer NOT NULL PRIMARY KEY AUTOINCREMENT, \"value\" time NOT NULL)"); init(sql); setAndGet(QTime(3, 4, 5)); cleanup(); } void tst_QDjangoMetaModel::testOptions() { QStringList sql; if (QDjango::database().driverName() == QLatin1String("QPSQL")) sql << QLatin1String( "CREATE TABLE \"some_table\" (" "\"id\" serial PRIMARY KEY, " "\"aField\" integer NOT NULL, " "\"b_field\" integer NOT NULL, " "\"blankField\" integer NOT NULL, " "\"indexField\" integer NOT NULL, " "\"nullField\" integer, " "\"uniqueField\" integer NOT NULL UNIQUE, " "UNIQUE (\"aField\", \"b_field\")" ")"); else sql << QLatin1String( "CREATE TABLE \"some_table\" (" "\"id\" integer NOT NULL PRIMARY KEY AUTOINCREMENT, " "\"aField\" integer NOT NULL, " "\"b_field\" integer NOT NULL, " "\"blankField\" integer NOT NULL, " "\"indexField\" integer NOT NULL, " "\"nullField\" integer, " "\"uniqueField\" integer NOT NULL UNIQUE, " "UNIQUE (\"aField\", \"b_field\")" ")"); sql << QLatin1String("CREATE INDEX \"some_table_ac243651\" ON \"some_table\" (\"indexField\")"); init(sql); QDjangoMetaField metaField; const QDjangoMetaModel metaModel = QDjango::registerModel(); metaField = metaModel.localField("aField"); QCOMPARE(metaField.isAutoIncrement(), false); QCOMPARE(metaField.isBlank(), false); QCOMPARE(metaField.isNullable(), false); QCOMPARE(metaField.isUnique(), false); QCOMPARE(metaField.isValid(), true); metaField = metaModel.localField("bField"); QCOMPARE(metaField.isAutoIncrement(), false); QCOMPARE(metaField.isBlank(), false); QCOMPARE(metaField.isNullable(), false); QCOMPARE(metaField.isUnique(), false); QCOMPARE(metaField.isValid(), true); metaField = metaModel.localField("blankField"); QCOMPARE(metaField.isAutoIncrement(), false); QCOMPARE(metaField.isBlank(), true); QCOMPARE(metaField.isNullable(), false); QCOMPARE(metaField.isUnique(), false); QCOMPARE(metaField.isValid(), true); metaField = metaModel.localField("nullField"); QCOMPARE(metaField.isAutoIncrement(), false); QCOMPARE(metaField.isBlank(), false); QCOMPARE(metaField.isNullable(), true); QCOMPARE(metaField.isUnique(), false); QCOMPARE(metaField.isValid(), true); metaField = metaModel.localField("uniqueField"); QCOMPARE(metaField.isAutoIncrement(), false); QCOMPARE(metaField.isBlank(), false); QCOMPARE(metaField.isNullable(), false); QCOMPARE(metaField.isUnique(), true); QCOMPARE(metaField.isValid(), true); cleanup(); } /** Test foreign key constraint sql generation */ void tst_QDjangoMetaModel::testConstraints() { QStringList sql; if (QDjango::database().driverName() == QLatin1String("QPSQL")) sql << QLatin1String("CREATE TABLE \"tst_fkconstraint\" (" "\"id\" serial PRIMARY KEY, " "\"noConstraint_id\" integer NOT NULL REFERENCES \"user\" (\"id\") DEFERRABLE INITIALLY DEFERRED, " "\"cascadeConstraint_id\" integer NOT NULL REFERENCES \"user\" (\"id\") ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, " "\"restrictConstraint_id\" integer NOT NULL REFERENCES \"user\" (\"id\") ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED, " "\"nullConstraint_id\" integer REFERENCES \"user\" (\"id\") ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED" ")"); else sql << QLatin1String("CREATE TABLE \"tst_fkconstraint\" (" "\"id\" integer NOT NULL PRIMARY KEY AUTOINCREMENT, " "\"noConstraint_id\" integer NOT NULL REFERENCES \"user\" (\"id\"), " "\"cascadeConstraint_id\" integer NOT NULL REFERENCES \"user\" (\"id\") ON DELETE CASCADE, " "\"restrictConstraint_id\" integer NOT NULL REFERENCES \"user\" (\"id\") ON DELETE RESTRICT, " "\"nullConstraint_id\" integer REFERENCES \"user\" (\"id\") ON DELETE SET NULL" ")"); sql << QLatin1String("CREATE INDEX \"tst_fkconstraint_f388fc3c\" ON \"tst_fkconstraint\" (\"noConstraint_id\")"); sql << QLatin1String("CREATE INDEX \"tst_fkconstraint_4634d592\" ON \"tst_fkconstraint\" (\"cascadeConstraint_id\")"); sql << QLatin1String("CREATE INDEX \"tst_fkconstraint_728cefe1\" ON \"tst_fkconstraint\" (\"restrictConstraint_id\")"); sql << QLatin1String("CREATE INDEX \"tst_fkconstraint_44c71620\" ON \"tst_fkconstraint\" (\"nullConstraint_id\")"); // create tables QDjangoMetaModel userModel = QDjango::registerModel(); QCOMPARE(userModel.createTable(), true); QDjangoMetaModel metaModel = QDjango::registerModel(); QCOMPARE(metaModel.createTableSql(), sql); QCOMPARE(metaModel.createTable(), true); // drop tables QCOMPARE(metaModel.dropTable(), true); QCOMPARE(userModel.dropTable(), true); } QTEST_MAIN(tst_QDjangoMetaModel) qdjango-0.4.0/tests/db/qdjangometamodel/qdjangometamodel.pro0000644000175000007640000000023412163016632024154 0ustar sharkyjerrywebinclude(../db.pri) TARGET = tst_qdjangometamodel HEADERS += ../auth-models.h tst_qdjangometamodel.h SOURCES += ../auth-models.cpp tst_qdjangometamodel.cpp qdjango-0.4.0/tests/db/util.h0000644000175000007640000000255412163016632015741 0ustar sharkyjerryweb/* * 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. */ #include #include "QDjango.h" #include "QDjangoModel.h" bool initialiseDatabase(); QString normalizeSql(const QSqlDatabase &db, const QString &sql); #define CHECKWHERE(_where, s, v) { \ QSqlDatabase _sql_db(QDjango::database()); \ QDjangoQuery _sql_query(_sql_db); \ QString _sql_stmt = _where.sql(_sql_db); \ if (!_sql_stmt.isEmpty()) _sql_query.prepare(_sql_stmt); \ _where.bindValues(_sql_query); \ const QVariantList _sql_values = v; \ QCOMPARE(normalizeSql(_sql_db, _sql_query.lastQuery()), s); \ QCOMPARE(_sql_query.boundValues().size(), _sql_values.size()); \ for(int _i = 0; _i < _sql_values.size(); ++_i) QCOMPARE(_sql_query.boundValue(_i), _sql_values[_i]); \ } qdjango-0.4.0/tests/db/auth/0000755000175000007640000000000012163016632015546 5ustar sharkyjerrywebqdjango-0.4.0/tests/db/auth/auth.pro0000644000175000007640000000015512163016632017232 0ustar sharkyjerrywebinclude(../db.pri) TARGET = tst_auth HEADERS += ../auth-models.h SOURCES += ../auth-models.cpp tst_auth.cpp qdjango-0.4.0/tests/db/auth/tst_auth.cpp0000644000175000007640000005736412163016632020124 0ustar sharkyjerryweb/* * 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. */ #include "QDjangoQuerySet.h" #include "QDjangoWhere.h" #include "auth-models.h" #include "util.h" /** Tests for the User class. */ class tst_Auth: public QObject { Q_OBJECT private slots: void initTestCase(); void create(); void remove(); void removeFilter(); void removeLimit(); void get(); void filter(); void filterLike(); void exclude(); void limit(); void subLimit(); void orderBy(); void update(); void values(); void valuesList(); void constIterator(); void testGroups(); void testRelated(); void filterRelated(); void cleanup(); void cleanupTestCase(); private: void loadFixtures(); }; /** Create database table before running tests. */ void tst_Auth::initTestCase() { QVERIFY(initialiseDatabase()); QCOMPARE(QDjango::registerModel().createTable(), true); QCOMPARE(QDjango::registerModel().createTable(), true); QCOMPARE(QDjango::registerModel().createTable(), true); QCOMPARE(QDjango::registerModel().createTable(), true); } /** Load fixtures consisting of 3 users. */ void tst_Auth::loadFixtures() { User foo; foo.setUsername("foouser"); foo.setPassword("foopass"); foo.setLastLogin(QDateTime(QDate(2010, 6, 1), QTime(10, 5, 14))); QCOMPARE(foo.save(), true); User bar; bar.setUsername("baruser"); bar.setPassword("barpass"); bar.setLastLogin(QDateTime(QDate(2010, 6, 1), QTime(10, 6, 31))); QCOMPARE(bar.save(), true); User wiz; wiz.setUsername("wizuser"); wiz.setPassword("wizpass"); wiz.setLastLogin(QDateTime(QDate(2010, 6, 1), QTime(10, 7, 18))); QCOMPARE(wiz.save(), true); QCOMPARE(QDjangoQuerySet().count(), 3); QCOMPARE(QDjangoQuerySet().size(), 3); } void tst_Auth::create() { const QDjangoQuerySet users; User *other; // create User user; user.setUsername("foouser"); user.setPassword("foopass"); user.setLastLogin(QDateTime(QDate(2010, 6, 1), QTime(10, 5, 14))); QCOMPARE(user.save(), true); QCOMPARE(users.all().size(), 1); // get by id other = users.get(QDjangoWhere("id", QDjangoWhere::Equals, 1)); QVERIFY(other != 0); QCOMPARE(other->pk(), QVariant(1)); QCOMPARE(other->username(), QLatin1String("foouser")); QCOMPARE(other->password(), QLatin1String("foopass")); delete other; // get by pk other = users.get(QDjangoWhere("pk", QDjangoWhere::Equals, 1)); QVERIFY(other != 0); QCOMPARE(other->pk(), QVariant(1)); QCOMPARE(other->username(), QLatin1String("foouser")); QCOMPARE(other->password(), QLatin1String("foopass")); delete other; // get by username other = users.get(QDjangoWhere("username", QDjangoWhere::Equals, "foouser")); QVERIFY(other != 0); QCOMPARE(other->pk(), QVariant(1)); QCOMPARE(other->username(), QLatin1String("foouser")); QCOMPARE(other->password(), QLatin1String("foopass")); QCOMPARE(other->lastLogin(), QDateTime(QDate(2010, 6, 1), QTime(10, 5, 14))); delete other; // update user.setPassword("foopass2"); QCOMPARE(user.save(), true); QCOMPARE(users.all().size(), 1); other = users.get(QDjangoWhere("username", QDjangoWhere::Equals, "foouser")); QVERIFY(other != 0); QCOMPARE(other->pk(), QVariant(1)); QCOMPARE(other->username(), QLatin1String("foouser")); QCOMPARE(other->password(), QLatin1String("foopass2")); delete other; User user2; user2.setUsername("baruser"); user2.setPassword("barpass"); user2.setLastLogin(QDateTime(QDate(2010, 6, 1), QTime(10, 6, 31))); QCOMPARE(user2.save(), true); QCOMPARE(users.all().size(), 2); other = users.get(QDjangoWhere("username", QDjangoWhere::Equals, "baruser")); QVERIFY(other != 0); QCOMPARE(other->pk(), QVariant(2)); QCOMPARE(other->username(), QLatin1String("baruser")); QCOMPARE(other->password(), QLatin1String("barpass")); QCOMPARE(other->lastLogin(), QDateTime(QDate(2010, 6, 1), QTime(10, 6, 31))); delete other; } /** Test removing a single user. */ void tst_Auth::remove() { const QDjangoQuerySet users; User user; user.setUsername("foouser"); user.setPassword("foopass"); QCOMPARE(user.save(), true); QCOMPARE(users.all().size(), 1); QCOMPARE(user.remove(), true); QCOMPARE(users.all().size(), 0); } /** Test removing multiple users. */ void tst_Auth::removeFilter() { loadFixtures(); // remove "foouser" and "baruser" const QDjangoQuerySet users; QDjangoQuerySet qs = users.filter(QDjangoWhere("username", QDjangoWhere::IsIn, QStringList() << "foouser" << "baruser")); QCOMPARE(qs.remove(), true); // check remaining user qs = users.all(); QCOMPARE(qs.size(), 1); User *other = qs.at(0); QVERIFY(other != 0); QCOMPARE(other->username(), QLatin1String("wizuser")); delete other; } /** Test removing multiple users with a LIMIT clause. */ void tst_Auth::removeLimit() { loadFixtures(); // FIXME : remove the first two entries fails const QDjangoQuerySet users; QCOMPARE(users.limit(0, 2).remove(), false); QCOMPARE(users.all().size(), 3); } /** Test retrieving a single user. */ void tst_Auth::get() { loadFixtures(); // get an inexistent user const QDjangoQuerySet users; User *other = users.get(QDjangoWhere("username", QDjangoWhere::Equals, "does_not_exist")); QVERIFY(other == 0); // get multiple users other = users.get(QDjangoWhere()); QVERIFY(other == 0); // get an existing user other = users.get(QDjangoWhere("username", QDjangoWhere::Equals, "foouser")); QVERIFY(other != 0); QCOMPARE(other->username(), QLatin1String("foouser")); QCOMPARE(other->password(), QLatin1String("foopass")); delete other; } /** Test filtering users with a "=" comparison. */ void tst_Auth::filter() { loadFixtures(); // all users const QDjangoQuerySet users; QDjangoQuerySet qs = users.all(); CHECKWHERE(qs.where(), QString(), QVariantList()); QCOMPARE(qs.size(), 3); // invalid username qs = users.filter(QDjangoWhere("username", QDjangoWhere::Equals, "doesnotexist")); CHECKWHERE(qs.where(), QLatin1String("\"user\".\"username\" = ?"), QVariantList() << "doesnotexist"); QCOMPARE(qs.size(), 0); // valid username qs = users.filter(QDjangoWhere("username", QDjangoWhere::Equals, "foouser")); CHECKWHERE(qs.where(), QLatin1String("\"user\".\"username\" = ?"), QVariantList() << "foouser"); QCOMPARE(qs.size(), 1); User *other = qs.at(0); QVERIFY(other != 0); QCOMPARE(other->username(), QLatin1String("foouser")); QCOMPARE(other->password(), QLatin1String("foopass")); delete other; // chain filters qs = qs.filter(QDjangoWhere("password", QDjangoWhere::Equals, "foopass")); CHECKWHERE(qs.where(), QLatin1String("\"user\".\"username\" = ? AND \"user\".\"password\" = ?"), QVariantList() << "foouser" << "foopass"); QCOMPARE(qs.size(), 1); // username in list qs = users.filter(QDjangoWhere("username", QDjangoWhere::IsIn, QVariantList() << "foouser" << "wizuser")); CHECKWHERE(qs.where(), QLatin1String("\"user\".\"username\" IN (?, ?)"), QVariantList() << "foouser" << "wizuser"); QCOMPARE(qs.size(), 2); // two tests on username qs = users.filter(QDjangoWhere("username", QDjangoWhere::Equals, "foouser") || QDjangoWhere("username", QDjangoWhere::Equals, "baruser")); CHECKWHERE(qs.where(), QLatin1String("\"user\".\"username\" = ? OR \"user\".\"username\" = ?"), QVariantList() << "foouser" << "baruser"); QCOMPARE(qs.size(), 2); } /** Test filtering users with a "like" condition. */ void tst_Auth::filterLike() { loadFixtures(); // username starts with "foo" const QDjangoQuerySet users; QDjangoQuerySet qs = users.filter(QDjangoWhere("username", QDjangoWhere::StartsWith, "foo")); QCOMPARE(qs.size(), 1); User *other = qs.at(0); QVERIFY(other != 0); QCOMPARE(other->username(), QLatin1String("foouser")); QCOMPARE(other->password(), QLatin1String("foopass")); delete other; // username ends with "ouser" qs = users.filter(QDjangoWhere("username", QDjangoWhere::EndsWith, "ouser")); QCOMPARE(qs.size(), 1); other = qs.at(0); QVERIFY(other != 0); QCOMPARE(other->username(), QLatin1String("foouser")); QCOMPARE(other->password(), QLatin1String("foopass")); delete other; // username contains "ou" qs = users.filter(QDjangoWhere("username", QDjangoWhere::Contains, "ou")); QCOMPARE(qs.size(), 1); other = qs.at(0); QVERIFY(other != 0); QCOMPARE(other->username(), QLatin1String("foouser")); QCOMPARE(other->password(), QLatin1String("foopass")); delete other; } /** Test excluding users with an "=" condition. */ void tst_Auth::exclude() { loadFixtures(); const QDjangoQuerySet users; QDjangoQuerySet qs = users.all(); CHECKWHERE(qs.where(), QString(), QVariantList()); QCOMPARE(users.all().size(), 3); qs = users.exclude(QDjangoWhere("username", QDjangoWhere::Equals, "doesnotexist")); CHECKWHERE(qs.where(), QLatin1String("\"user\".\"username\" != ?"), QVariantList() << "doesnotexist"); QCOMPARE(qs.size(), 3); qs = users.exclude(QDjangoWhere("username", QDjangoWhere::Equals, "baruser")); CHECKWHERE(qs.where(), QLatin1String("\"user\".\"username\" != ?"), QVariantList() << "baruser"); QCOMPARE(qs.size(), 2); User *other = qs.at(0); QVERIFY(other != 0); QCOMPARE(other->username(), QLatin1String("foouser")); QCOMPARE(other->password(), QLatin1String("foopass")); delete other; qs = qs.exclude(QDjangoWhere("password", QDjangoWhere::Equals, "barpass")); CHECKWHERE(qs.where(), QLatin1String("\"user\".\"username\" != ? AND \"user\".\"password\" != ?"), QVariantList() << "baruser" << "barpass"); QCOMPARE(qs.size(), 2); } /** Test limiting user results. */ void tst_Auth::limit() { const QDjangoQuerySet users; for (int i = 0; i < 10; i++) { User user; user.setUsername(QString("foouser%1").arg(i)); user.setPassword(QString("foopass%1").arg(i)); QCOMPARE(user.save(), true); } // all results QDjangoQuerySet qs = users.limit(0, -1); QCOMPARE(qs.size(), 10); // all results from offset 1 qs = users.limit(1, -1); QCOMPARE(qs.size(), 9); User *other = qs.at(0); QCOMPARE(other->username(), QLatin1String("foouser1")); delete other; other = qs.at(8); QCOMPARE(other->username(), QLatin1String("foouser9")); delete other; // 5 results from offset 0 qs = users.limit(0, 5); QCOMPARE(qs.size(), 5); other = qs.at(0); QCOMPARE(other->username(), QLatin1String("foouser0")); delete other; other = qs.at(4); QCOMPARE(other->username(), QLatin1String("foouser4")); delete other; // 6 results from offset 1 qs = users.limit(1, 8); QCOMPARE(qs.size(), 8); other = qs.at(0); QCOMPARE(other->username(), QLatin1String("foouser1")); delete other; other = qs.at(7); QCOMPARE(other->username(), QLatin1String("foouser8")); delete other; } /** Test chaining limit statements. */ void tst_Auth::subLimit() { const QDjangoQuerySet users; for (int i = 0; i < 10; i++) { User user; user.setUsername(QString("foouser%1").arg(i)); user.setPassword(QString("foopass%1").arg(i)); QCOMPARE(user.save(), true); } // base query : 8 results from offset 1 QDjangoQuerySet refQs = users.limit(1, 8); // all sub-results from offset 2 QDjangoQuerySet qs = refQs.limit(2, -1); QCOMPARE(qs.size(), 6); User *other = qs.at(0); QCOMPARE(other->username(), QLatin1String("foouser3")); delete other; other = qs.at(5); QCOMPARE(other->username(), QLatin1String("foouser8")); delete other; // 4 sub-results from offset 0 qs = refQs.limit(0, 4); QCOMPARE(qs.size(), 4); other = qs.at(0); QCOMPARE(other->username(), QLatin1String("foouser1")); delete other; other = qs.at(3); QCOMPARE(other->username(), QLatin1String("foouser4")); delete other; // 3 sub-results from offset 2 qs = refQs.limit(2, 3); QCOMPARE(qs.size(), 3); other = qs.at(0); QCOMPARE(other->username(), QLatin1String("foouser3")); delete other; other = qs.at(2); QCOMPARE(other->username(), QLatin1String("foouser5")); delete other; } /** Test ordering. */ void tst_Auth::orderBy() { loadFixtures(); User user; const QDjangoQuerySet users; // sort ascending QDjangoQuerySet qs = users.orderBy(QStringList() << "username"); QCOMPARE(qs.count(), 3); QCOMPARE(qs.size(), 3); QVERIFY(qs.at(0, &user)); QCOMPARE(user.username(), QLatin1String("baruser")); QVERIFY(qs.at(1, &user)); QCOMPARE(user.username(), QLatin1String("foouser")); QVERIFY(qs.at(2, &user)); QCOMPARE(user.username(), QLatin1String("wizuser")); // sort descending qs = users.orderBy(QStringList() << "-username"); QCOMPARE(qs.count(), 3); QCOMPARE(qs.size(), 3); QVERIFY(qs.at(0, &user)); QCOMPARE(user.username(), QLatin1String("wizuser")); QVERIFY(qs.at(1, &user)); QCOMPARE(user.username(), QLatin1String("foouser")); QVERIFY(qs.at(2, &user)); QCOMPARE(user.username(), QLatin1String("baruser")); } /** Test updating. */ void tst_Auth::update() { loadFixtures(); QVariantMap fields; fields.insert("password", "xxx"); // update no fields QCOMPARE(QDjangoQuerySet().update(QVariantMap()), 0); // update none QCOMPARE(QDjangoQuerySet().none().update(fields), 0); // update all QDjangoQuerySet qs; QCOMPARE(qs.update(fields), 3); QDjangoQuerySet all; foreach (const User &user, all) QCOMPARE(user.password(), QLatin1String("xxx")); // update one fields.insert("password", "yyy"); qs = qs.filter(QDjangoWhere("username", QDjangoWhere::Equals, "baruser")); QCOMPARE(qs.update(fields), 1); all = QDjangoQuerySet(); foreach (const User &user, all) { if (user.username() == "baruser") QCOMPARE(user.password(), QLatin1String("yyy")); else QCOMPARE(user.password(), QLatin1String("xxx")); } } /** Test retrieving maps of values. */ void tst_Auth::values() { loadFixtures(); const QDjangoQuerySet users; // FIXME : test last_login QList< QMap > map = users.all().values(); QCOMPARE(map.size(), 3); QCOMPARE(map[0].keys(), QList() << "date_joined" << "email" << "first_name" << "id" << "is_active" << "is_staff" << "is_superuser" << "last_login" << "last_name" << "password" << "username"); QCOMPARE(map[0]["username"], QVariant("foouser")); QCOMPARE(map[0]["password"], QVariant("foopass")); QCOMPARE(map[1].keys(), QList() << "date_joined" << "email" << "first_name" << "id" << "is_active" << "is_staff" << "is_superuser" << "last_login" << "last_name" << "password" << "username"); QCOMPARE(map[1]["username"], QVariant("baruser")); QCOMPARE(map[1]["password"], QVariant("barpass")); QCOMPARE(map[2].keys(), QList() << "date_joined" << "email" << "first_name" << "id" << "is_active" << "is_staff" << "is_superuser" << "last_login" << "last_name" << "password" << "username"); QCOMPARE(map[2]["username"], QVariant("wizuser")); QCOMPARE(map[2]["password"], QVariant("wizpass")); // FIXME : test last_login map = users.all().values(QStringList() << "username" << "password"); QCOMPARE(map.size(), 3); QCOMPARE(map[0].keys(), QList() << "password" << "username"); QCOMPARE(map[0]["username"], QVariant("foouser")); QCOMPARE(map[0]["password"], QVariant("foopass")); QCOMPARE(map[1].keys(), QList() << "password" << "username"); QCOMPARE(map[1]["username"], QVariant("baruser")); QCOMPARE(map[1]["password"], QVariant("barpass")); QCOMPARE(map[2].keys(), QList() << "password" << "username"); QCOMPARE(map[2]["username"], QVariant("wizuser")); QCOMPARE(map[2]["password"], QVariant("wizpass")); } /** Test retrieving lists of values. */ void tst_Auth::valuesList() { loadFixtures(); const QDjangoQuerySet users; // FIXME : test last_login QList< QVariantList > list = users.all().valuesList(); QCOMPARE(list.size(), 3); QCOMPARE(list[0].size(), 11); QCOMPARE(list[0][1], QVariant("foouser")); QCOMPARE(list[0][5], QVariant("foopass")); QCOMPARE(list[1].size(), 11); QCOMPARE(list[1][1], QVariant("baruser")); QCOMPARE(list[1][5], QVariant("barpass")); QCOMPARE(list[2].size(), 11); QCOMPARE(list[2][1], QVariant("wizuser")); QCOMPARE(list[2][5], QVariant("wizpass")); // FIXME : test last_login list = users.all().valuesList(QStringList() << "username" << "password"); QCOMPARE(list.size(), 3); QCOMPARE(list[0].size(), 2); QCOMPARE(list[0][0], QVariant("foouser")); QCOMPARE(list[0][1], QVariant("foopass")); QCOMPARE(list[1].size(), 2); QCOMPARE(list[1][0], QVariant("baruser")); QCOMPARE(list[1][1], QVariant("barpass")); QCOMPARE(list[2].size(), 2); QCOMPARE(list[2][0], QVariant("wizuser")); QCOMPARE(list[2][1], QVariant("wizpass")); } void tst_Auth::constIterator() { loadFixtures(); QVERIFY(!QTest::currentTestFailed()); const QDjangoQuerySet users = QDjangoQuerySet().orderBy(QStringList("username")); const QDjangoQuerySet::ConstIterator first = users.constBegin(); const QDjangoQuerySet::ConstIterator last = users.constEnd(); QVERIFY(first != last); QVERIFY(first < last); QVERIFY(first <= last); QVERIFY(last >= first); QVERIFY(last > first); QCOMPARE(int(last - first), +3); QCOMPARE(int(first - last), -3); QDjangoQuerySet::ConstIterator it = first; QVERIFY(it != last); QVERIFY(it == first); QCOMPARE(int(last - it), 3); QCOMPARE(int(it - first), 0); QCOMPARE(it->username(), QLatin1String("baruser")); QCOMPARE((++it)->username(), QLatin1String("foouser")); QCOMPARE(it->username(), QLatin1String("foouser")); QCOMPARE((it++)->username(), QLatin1String("foouser")); QCOMPARE(it->username(), QLatin1String("wizuser")); QVERIFY((it - 2) == first); QCOMPARE(int(it - first), 2); QCOMPARE(int(last - it), 1); QVERIFY((it -= 2) == first); QCOMPARE(int(it - first), 0); QCOMPARE(int(last - it), 3); QCOMPARE((*it).username(), QLatin1String("baruser")); QCOMPARE((*(it + 2)).username(), QLatin1String("wizuser")); QVERIFY(it == first); QCOMPARE((*(it += 1)).username(), QLatin1String("foouser")); QCOMPARE(int(it - first), 1); QTest::ignoreMessage(QtWarningMsg, "QDjangoQuerySet out of bounds"); QVERIFY(&*(it += 2) == 0); QCOMPARE(int(last - it), 0); QVERIFY(it == last); QCOMPARE((it += -3)->username(), QLatin1String("baruser")); QVERIFY(it == first); QCOMPARE((it -= -2)->username(), QLatin1String("wizuser")); QCOMPARE(int(last - it), 1); QCOMPARE((it--)->username(), QLatin1String("wizuser")); QCOMPARE(it->username(), QLatin1String("foouser")); QCOMPARE(int(last - it), 2); QCOMPARE((--it)->username(), QLatin1String("baruser")); QCOMPARE(it->username(), QLatin1String("baruser")); QCOMPARE(int(last - it), 3); } /** Clear database table after each test. */ void tst_Auth::cleanup() { QCOMPARE(QDjangoQuerySet().remove(), true); QCOMPARE(QDjangoQuerySet().remove(), true); QCOMPARE(QDjangoQuerySet().remove(), true); QCOMPARE(QDjangoQuerySet().remove(), true); } /** Drop database table after running tests. */ void tst_Auth::cleanupTestCase() { QCOMPARE(QDjango::registerModel().dropTable(), true); QCOMPARE(QDjango::registerModel().dropTable(), true); QCOMPARE(QDjango::registerModel().dropTable(), true); QCOMPARE(QDjango::registerModel().dropTable(), true); } /** Set and get foreign key on a Message object. */ void tst_Auth::testRelated() { const QDjangoQuerySet messages; // load fixtures QVariant userPk; { User user; user.setUsername("foouser"); user.setPassword("foopass"); QCOMPARE(user.save(), true); userPk = user.pk(); Message message; message.setUser(&user); message.setMessage("test message"); QCOMPARE(message.save(), true); } // retrieve message, then user (2 SQL queries) Message *uncached = messages.get( QDjangoWhere("id", QDjangoWhere::Equals, 1)); QVERIFY(uncached != 0); QCOMPARE(uncached->property("user_id"), userPk); // check related user User *uncachedUser = uncached->user(); QVERIFY(uncachedUser != 0); QCOMPARE(uncachedUser->pk(), userPk); QCOMPARE(uncachedUser->username(), QLatin1String("foouser")); QCOMPARE(uncachedUser->password(), QLatin1String("foopass")); delete uncached; // retrieve message and user (1 SQL query) Message *cached = messages.selectRelated().get( QDjangoWhere("id", QDjangoWhere::Equals, 1)); QVERIFY(cached != 0); QCOMPARE(cached->property("user_id"), userPk); // check related user User *cachedUser = cached->user(); QVERIFY(cachedUser != 0); QCOMPARE(cachedUser->pk(), userPk); QCOMPARE(cachedUser->username(), QLatin1String("foouser")); QCOMPARE(cachedUser->password(), QLatin1String("foopass")); delete cached; } /** Perform filtering on a foreign field. */ void tst_Auth::filterRelated() { const QDjangoQuerySet messages; // load fixtures QVariant userPk; { User user; user.setUsername("foouser"); user.setPassword("foopass"); QCOMPARE(user.save(), true); userPk = user.pk(); Message message; message.setUser(&user); message.setMessage("test message"); QCOMPARE(message.save(), true); } // perform filtering QDjangoQuerySet qs = messages.filter( QDjangoWhere("user__username", QDjangoWhere::Equals, "foouser")); CHECKWHERE(qs.where(), QLatin1String("T0.\"username\" = ?"), QVariantList() << "foouser"); QCOMPARE(qs.size(), 1); Message *msg = qs.at(0); QVERIFY(msg != 0); QCOMPARE(msg->message(), QLatin1String("test message")); QCOMPARE(msg->property("user_id"), userPk); delete msg; } /** Test many-to-many relationships using an intermediate table. */ void tst_Auth::testGroups() { const QDjangoQuerySet userGroups; User user; user.setUsername("foouser"); user.setPassword("foopass"); QCOMPARE(user.save(), true); Group group; group.setName("foogroup"); QCOMPARE(group.save(), true); UserGroups userGroup; userGroup.setUser(&user); userGroup.setGroup(&group); QCOMPARE(userGroup.save(), true); UserGroups *ug = userGroups.selectRelated().get( QDjangoWhere("id", QDjangoWhere::Equals, 1)); QVERIFY(ug != 0); QCOMPARE(ug->property("user_id"), user.pk()); QCOMPARE(ug->property("group_id"), group.pk()); delete ug; } QTEST_MAIN(tst_Auth) #include "tst_auth.moc" qdjango-0.4.0/tests/db/db.pri0000644000175000007640000000030312163016632015702 0ustar sharkyjerrywebinclude(../../qdjango.pri) QT -= gui QT += sql testlib HEADERS += $$PWD/util.h SOURCES += $$PWD/util.cpp INCLUDEPATH += $$PWD $$QDJANGO_INCLUDEPATH LIBS += -L../../../src/db $$QDJANGO_DB_LIBS qdjango-0.4.0/tests/db/db.pro0000644000175000007640000000023712163016632015716 0ustar sharkyjerrywebTEMPLATE = subdirs SUBDIRS = \ qdjangocompiler \ qdjangometamodel \ qdjangomodel \ qdjangoqueryset \ qdjangowhere \ auth \ shares qdjango-0.4.0/tests/db/auth-models.h0000644000175000007640000000767612163016632017220 0ustar sharkyjerryweb/* * 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_AUTH_MODELS_H #define QDJANGO_AUTH_MODELS_H #include #include "QDjangoModel.h" /** The User class represents a user in the authentication system. * * It has a many-to-many relationship with the Group class. */ class User : public QDjangoModel { Q_OBJECT Q_PROPERTY(QString username READ username WRITE setUsername) Q_PROPERTY(QString first_name READ firstName WRITE setFirstName) Q_PROPERTY(QString last_name READ lastName WRITE setLastName) Q_PROPERTY(QString email READ email WRITE setEmail) Q_PROPERTY(QString password READ password WRITE setPassword) Q_PROPERTY(bool is_active READ isActive WRITE setIsActive) Q_PROPERTY(bool is_staff READ isStaff WRITE setIsStaff) Q_PROPERTY(bool is_superuser READ isSuperUser WRITE setIsSuperUser) Q_PROPERTY(QDateTime date_joined READ dateJoined WRITE setDateJoined) Q_PROPERTY(QDateTime last_login READ lastLogin WRITE setLastLogin) Q_CLASSINFO("username", "max_length=30") Q_CLASSINFO("first_name", "max_length=30") Q_CLASSINFO("last_name", "max_length=30") Q_CLASSINFO("password", "max_length=128") public: User(QObject *parent = 0); QString username() const; void setUsername(const QString &username); QString firstName() const; void setFirstName(const QString &firstName); QString lastName() const; void setLastName(const QString &lastName); QString email() const; void setEmail(const QString &email); QString password() const; void setPassword(const QString &password); // flags bool isActive() const; void setIsActive(bool isActive); bool isStaff() const; void setIsStaff(bool isStaff); bool isSuperUser() const; void setIsSuperUser(bool isSuperUser); // dates QDateTime dateJoined() const; void setDateJoined(const QDateTime &dateJoined); QDateTime lastLogin() const; void setLastLogin(const QDateTime &lastLogin); private: QString m_username; QString m_firstName; QString m_lastName; QString m_email; QString m_password; bool m_isActive; bool m_isStaff; bool m_isSuperUser; QDateTime m_dateJoined; QDateTime m_lastLogin; }; /** The Group class represents a group in the authentication system. * * It has a many-to-many relationship with the User class. */ class Group : public QDjangoModel { Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName) public: Group(QObject *parent = 0); QString name() const; void setName(const QString &name); private: QString m_name; }; class UserGroups : public QDjangoModel { Q_OBJECT Q_PROPERTY(User* user READ user WRITE setUser); Q_PROPERTY(Group* group READ group WRITE setGroup); public: UserGroups(QObject *parent = 0); User *user() const; void setUser(User *user); Group *group() const; void setGroup(Group *group); }; /** The Message class represents a message for a given User. */ class Message : public QDjangoModel { Q_OBJECT Q_PROPERTY(User* user READ user WRITE setUser); Q_PROPERTY(QString message READ message WRITE setMessage) public: Message(QObject *parent = 0); User *user() const; void setUser(User *user); QString message() const; void setMessage(const QString &message); private: QString m_message; }; #endif qdjango-0.4.0/tests/db/util.cpp0000644000175000007640000000403112163016632016264 0ustar sharkyjerryweb/* * 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. */ #include #include "QDjango.h" #include "util.h" bool initialiseDatabase() { char *p; // enable SQL debugging if ((p = getenv("QDJANGO_DB_DEBUG")) != 0) QDjango::setDebugEnabled(true); // open database QString databaseDriver = "QSQLITE"; if ((p = getenv("QDJANGO_DB_DRIVER")) != 0) databaseDriver = QString::fromLocal8Bit(p); QSqlDatabase db = QSqlDatabase::addDatabase(databaseDriver); if ((p = getenv("QDJANGO_DB_NAME")) != 0) db.setDatabaseName(QString::fromLocal8Bit(p)); else if (databaseDriver == "QSQLITE") db.setDatabaseName(":memory:"); if ((p = getenv("QDJANGO_DB_USER")) != 0) db.setUserName(QString::fromLocal8Bit(p)); if ((p = getenv("QDJANGO_DB_PASSWORD")) != 0) db.setPassword(QString::fromLocal8Bit(p)); if ((p = getenv("QDJANGO_DB_HOST")) != 0) db.setHostName(QString::fromLocal8Bit(p)); if (db.open()) { QDjango::setDatabase(db); return true; } else { return false; } } QString normalizeSql(const QSqlDatabase &db, const QString &sql) { const QString driverName = db.driverName(); QString modSql(sql); if (driverName == "QMYSQL") modSql.replace("`", "\""); else if (driverName == "QSQLITE" || driverName == "QSQLITE2") modSql.replace("LIKE ? ESCAPE '\\'", "LIKE ?"); return modSql; } qdjango-0.4.0/tests/tests.pro0000644000175000007640000000005412163016632016103 0ustar sharkyjerrywebTEMPLATE = subdirs SUBDIRS = db http script qdjango-0.4.0/tests/script/0000755000175000007640000000000012163016632015524 5ustar sharkyjerrywebqdjango-0.4.0/tests/script/qdjangoscript/0000755000175000007640000000000012163016632020374 5ustar sharkyjerrywebqdjango-0.4.0/tests/script/qdjangoscript/qdjangoscript.pro0000644000175000007640000000056112163016632023770 0ustar sharkyjerrywebinclude(../../../qdjango.pri) QT -= gui QT += script sql testlib TARGET = tst_qdjangoscript HEADERS += ../../db/auth-models.h ../../db/util.h SOURCES += ../../db/auth-models.cpp ../../db/util.cpp tst_qdjangoscript.cpp INCLUDEPATH += ../../db $$QDJANGO_INCLUDEPATH LIBS += \ -L../../../src/db $$QDJANGO_DB_LIBS \ -L../../../src/script $$QDJANGO_SCRIPT_LIBS qdjango-0.4.0/tests/script/qdjangoscript/tst_qdjangoscript.cpp0000644000175000007640000001155212163016632024646 0ustar sharkyjerryweb/* * 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. */ #include "QDjangoScript.h" #include "auth-models.h" #include "util.h" Q_DECLARE_METATYPE(QDjangoQuerySet) /** Test QDjango scripting. */ class tst_QDjangoScript : public QObject { Q_OBJECT private slots: void initTestCase(); void testWhereConstructor(); void testWhereOperators(); void testModel(); void cleanupTestCase(); private: QDjangoMetaModel metaModel; QScriptEngine *engine; }; void tst_QDjangoScript::cleanupTestCase() { metaModel.dropTable(); delete engine; } void tst_QDjangoScript::initTestCase() { initialiseDatabase(); metaModel = QDjango::registerModel(); QCOMPARE(metaModel.createTable(), true); engine = new QScriptEngine(this); QDjangoScript::registerWhere(engine); QDjangoScript::registerModel(engine); } void tst_QDjangoScript::testWhereConstructor() { QScriptValue result; QDjangoWhere where; // equals result = engine->evaluate("Q({'username': 'foobar'})"); where = engine->fromScriptValue(result); CHECKWHERE(where, QLatin1String("username = ?"), QVariantList() << "foobar"); // less than result = engine->evaluate("Q({'username__lt': 'foobar'})"); where = engine->fromScriptValue(result); CHECKWHERE(where, QLatin1String("username < ?"), QVariantList() << "foobar"); // less than or equal to result = engine->evaluate("Q({'username__lte': 'foobar'})"); where = engine->fromScriptValue(result); CHECKWHERE(where, QLatin1String("username <= ?"), QVariantList() << "foobar"); // greater than result = engine->evaluate("Q({'username__gt': 'foobar'})"); where = engine->fromScriptValue(result); CHECKWHERE(where, QLatin1String("username > ?"), QVariantList() << "foobar"); // greater than or equal to result = engine->evaluate("Q({'username__gte': 'foobar'})"); where = engine->fromScriptValue(result); CHECKWHERE(where, QLatin1String("username >= ?"), QVariantList() << "foobar"); // starts with result = engine->evaluate("Q({'username__startswith': 'foobar'})"); where = engine->fromScriptValue(result); CHECKWHERE(where, QLatin1String("username LIKE ?"), QVariantList() << "foobar%"); // ends with result = engine->evaluate("Q({'username__endswith': 'foobar'})"); where = engine->fromScriptValue(result); CHECKWHERE(where, QLatin1String("username LIKE ?"), QVariantList() << "%foobar"); // contains result = engine->evaluate("Q({'username__contains': 'foobar'})"); where = engine->fromScriptValue(result); CHECKWHERE(where, QLatin1String("username LIKE ?"), QVariantList() << "%foobar%"); // in result = engine->evaluate("Q({'username__in': ['foobar', 'wiz']})"); where = engine->fromScriptValue(result); CHECKWHERE(where, QLatin1String("username IN (?, ?)"), QVariantList() << "foobar" << "wiz"); // double constructor result = engine->evaluate("Q(Q({'username': 'foobar'}))"); where = engine->fromScriptValue(result); CHECKWHERE(where, QLatin1String("username = ?"), QVariantList() << "foobar"); } void tst_QDjangoScript::testWhereOperators() { QScriptValue result; QDjangoWhere where; // AND operator result = engine->evaluate("Q({'username': 'foobar'}).and(Q({'password': 'foopass'}))"); where = engine->fromScriptValue(result); CHECKWHERE(where, QLatin1String("username = ? AND password = ?"), QVariantList() << "foobar" << "foopass"); // OR operator result = engine->evaluate("Q({'username': 'foobar'}).or(Q({'password': 'foopass'}))"); where = engine->fromScriptValue(result); CHECKWHERE(where, QLatin1String("username = ? OR password = ?"), QVariantList() << "foobar" << "foopass"); } void tst_QDjangoScript::testModel() { // create model instance QScriptValue result = engine->evaluate("user = User();"); User *user = qobject_cast(result.toQObject()); QVERIFY(user != 0); // set properties engine->evaluate("user.username = 'foobar';"); QCOMPARE(user->username(), QLatin1String("foobar")); } QTEST_MAIN(tst_QDjangoScript) #include "tst_qdjangoscript.moc" qdjango-0.4.0/tests/script/script.pro0000644000175000007640000000005312163016632017550 0ustar sharkyjerrywebTEMPLATE = subdirs SUBDIRS = qdjangoscript qdjango-0.4.0/tests/main.js0000644000175000007640000000217112163016632015503 0ustar sharkyjerryweb/* * 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. */ function fail(msg) { print(msg); quit(); } load("qdjango.test"); syncdb(); /* create a user */ u = new User(); u.username = "foouser"; u.password = "foopass"; u.save(); /* create a message */ m = new Message(); m.text = "some message"; m.user_id = u.pk; m.save(); /* find message */ qs = Message.objects.filter({"pk": 1}); if (qs.size() != 1) fail("Wrong number of messages"); m2 = qs.at(0) if (m2.text != "some message") fail("Wrong message text"); /* quit */ quit(); qdjango-0.4.0/qdjango.pri0000644000175000007640000000200112163016632015206 0ustar sharkyjerryweb# Common definitions QDJANGO_VERSION=0.4.0 # Determine library type (shared or staticlib) isEmpty(QDJANGO_LIBRARY_TYPE) { android { QDJANGO_LIBRARY_TYPE = staticlib } else { QDJANGO_LIBRARY_TYPE = shared } } # Libraries for apps which use QDjango QDJANGO_INCLUDEPATH = $$PWD/src/db $$PWD/src/http $$PWD/src/script QDJANGO_DB_LIBS = -lqdjango-db QDJANGO_HTTP_LIBS = -lqdjango-http QDJANGO_SCRIPT_LIBS = -lqdjango-script contains(QDJANGO_LIBRARY_TYPE,staticlib) { DEFINES += QDJANGO_STATIC } else { # Windows needs the major library version win32 { QDJANGO_DB_LIBS = -lqdjango-db0 QDJANGO_HTTP_LIBS = -lqdjango-http0 QDJANGO_SCRIPT_LIBS = -lqdjango-script0 } DEFINES += QDJANGO_SHARED } # Installation prefix and library directory isEmpty(PREFIX) { contains(MEEGO_EDITION,harmattan) { PREFIX = /usr } else:unix { PREFIX = /usr/local } else { PREFIX = $$[QT_INSTALL_PREFIX] } } isEmpty(LIBDIR) { LIBDIR=lib } qdjango-0.4.0/README0000644000175000007640000000212612163016632013737 0ustar sharkyjerrywebQDjango License ======= 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. Requirements ============ On Debian ---------- $ sudo aptitude install libqt4-dev libqt4-sql-sqlite On Mac OS X ----------- $ sudo port install qt4-mac Building QDjango ================ $ mkdir build $ cd build $ qmake .. $ make You can pass the following arguments to qmake: PREFIX= to change the install prefix default: unix: /usr/local on unix other: $$[QT_INSTALL_PREFIX] QDJANGO_LIBRARY_TYPE=staticlib to build a static version of QDjango