Herunterladen als
root/samples/simple/main.cpp @ 409ca288
b7446f4c | Christian Ehringfeld | #include <QCoreApplication>
|
|
#include <QDir>
|
|||
#include <QDebug>
|
|||
#include "artikel.h"
|
|||
#include "../../src/entitymanager.h"
|
|||
#include "../../src/entityinstancefactory.h"
|
|||
0ec1cbfb | Christian Ehringfeld | ||
b7446f4c | Christian Ehringfeld | using namespace CuteEntityManager;
|
|
int main(int argc, char *argv[]) {
|
|||
Q_UNUSED(argc) Q_UNUSED(argv)
|
|||
EntityInstanceFactory::registerClass<Artikel>();
|
|||
CuteEntityManager::EntityManager *e = new
|
|||
CuteEntityManager::EntityManager("QSQLITE",
|
|||
QDir::currentPath() + "/db.sqlite");
|
|||
0ec1cbfb | Christian Ehringfeld | EntityInstanceFactory::registerClass<Artikel>();
|
|
b7446f4c | Christian Ehringfeld | QStringList inits = QStringList() << "Artikel";
|
|
e->startup("0.1", inits);
|
|||
QSharedPointer<Artikel> a = QSharedPointer<Artikel>(new Artikel(20.0,
|
|||
"Müsli"));
|
|||
0ec1cbfb | Christian Ehringfeld | auto ep = a.objectCast<CuteEntityManager::Entity>();
|
|
qDebug() << e->create(ep, true, true);
|
|||
b7446f4c | Christian Ehringfeld | return 0;
|
|
}
|