Herunterladen als
root/example/main.cpp @ b0e92bc6
81c23b56 | Christian Ehringfeld | #include <QCoreApplication>
|
|
#include <typeinfo>
|
|||
#include <QDir>
|
|||
#include <QDebug>
|
|||
9d05e414 | Christian Ehringfeld | #include "models/artikel.h"
|
|
#include "models/person.h"
|
|||
#include <typeinfo>
|
|||
#include <QMetaMethod>
|
|||
#include <QMetaProperty>
|
|||
#include "models/group.h"
|
|||
bb5e9339 | SebastianDiel | #include "../src/entity.h"
|
|
#include "../src/entitymanager.h"
|
|||
2d9fab10 | Christian Ehringfeld | #include "../src/relation.h"
|
|
9d05e414 | Christian Ehringfeld | #include <QGenericReturnArgument>
|
|
2d9fab10 | Christian Ehringfeld | #include "entityinstancefactory.h"
|
|
ba6f6521 | Christian Ehringfeld | #include <exception>
|
|
#include "models/pupil.h"
|
|||
81c23b56 | Christian Ehringfeld | /**
|
|
* create,remove und merge funktionieren
|
|||
*/
|
|||
2d9fab10 | Christian Ehringfeld | using namespace CuteEntityManager;
|
|
9d05e414 | Christian Ehringfeld | int main(int argc, char *argv[]) {
|
|
2d9fab10 | Christian Ehringfeld | // Q_UNUSED(argc) Q_UNUSED(argv)
|
|
ba6f6521 | Christian Ehringfeld | CuteEntityManager::EntityManager *e = new CuteEntityManager::EntityManager("QSQLITE",
|
|
QDir::currentPath() + "/db.sqlite");
|
|||
2d9fab10 | Christian Ehringfeld | // QSharedPointer<Artikel> a = QSharedPointer<Artikel>(new Artikel(20.0, "Müsli"));
|
|
// auto ep = a.dynamicCast<CuteEntityManager::Entity>();
|
|||
// qDebug() << e;
|
|||
// qDebug() << "Tabelle artikel erstellt:" << e->createTable(ep);
|
|||
// e->create(ep);
|
|||
81c23b56 | Christian Ehringfeld | ||
2d9fab10 | Christian Ehringfeld | // QSharedPointer<CuteEntityManager::Entity> p = QSharedPointer<CuteEntityManager::Entity>(new Person("Max", "Mustermann", Person::MALE, "", "", "",
|
|
// QDate::currentDate()));
|
|||
// auto pptr = p.dynamicCast<CuteEntityManager::Entity>();
|
|||
// e->createTable(pptr);
|
|||
// e->create(pptr);
|
|||
//e->createTable(grp.dynamicCast<CuteEntityManager::Entity>());
|
|||
586bb527 | Christian Ehringfeld | ||
ba6f6521 | Christian Ehringfeld | // QTime t;
|
|
// t.start();
|
|||
// e->createTable(QSharedPointer<Artikel>(new Artikel()));
|
|||
// for (int var = 0; var < 10; ++var) {
|
|||
// QSharedPointer<Entity> a = QSharedPointer<Artikel>(new Artikel(var,QString("a")+QString::number(var)));
|
|||
// e->save(a);
|
|||
// }
|
|||
// qDebug() << "Dauer:" << t.elapsed();
|
|||
2d9fab10 | Christian Ehringfeld | ||
ba6f6521 | Christian Ehringfeld | Pupil *p = new Pupil();
|
|
auto hash = p->getMetaProperties();
|
|||
1a3b37ba | Christian Ehringfeld | // auto iterator = hash.constBegin();
|
|
// while(iterator != hash.constEnd()) {
|
|||
// qDebug() << iterator.key() << " Value:" << iterator.value().read(p);
|
|||
2d9fab10 | Christian Ehringfeld | ||
1a3b37ba | Christian Ehringfeld | // iterator++;
|
|
// }
|
|||
qDebug() << p->metaObject()->superClass()->className();
|
|||
ba6f6521 | Christian Ehringfeld | ||
81c23b56 | Christian Ehringfeld | return 0;
|
|
}
|