Projekt

Allgemein

Profil

Herunterladen als
Herunterladen (1,41 KB) Statistiken
| Zweig: | Revision:
#include <QCoreApplication>
#include <typeinfo>
#include <QDir>
#include <QDebug>
#include "models/artikel.h"
#include "models/person.h"
#include <typeinfo>
#include <QMetaMethod>
#include <QMetaProperty>
#include "models/group.h"
#include "../src/entity.h"
#include "../src/entitymanager.h"
#include <QGenericReturnArgument>
/**
* create,remove und merge funktionieren
*/

int main(int argc, char *argv[]) {
Q_UNUSED(argc) Q_UNUSED(argv)
CuteEntityManager::EntityManager *e = new CuteEntityManager::EntityManager("QSQLITE",
QDir::currentPath() + "/db.sqlite");
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);

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);

QSharedPointer<Group> grp = QSharedPointer<Group>(new Group());
e->createTable(grp.dynamicCast<CuteEntityManager::Entity>());
grp.data()->setTeacher(new Person("Test", "Test12345"));
grp.data()->setTeacherP(QSharedPointer<Person>(new Person("Max", "Mustermann")));
return 0;
}
(3-3/3)