Revision 10cc871a
Von Christian Ehringfeld vor etwa 10 Jahren hinzugefügt
| EntityManager.pro | ||
|---|---|---|
|
include (EntityManager.pri)
|
||
|
QT += core
|
||
|
QT += sql
|
||
|
#if you need Image Validation you must compile with += gui
|
||
|
#QT += gui
|
||
|
QT -= gui
|
||
|
include(EntityManager.pri)
|
||
|
|
||
|
TARGET = CuteEntityManager
|
||
|
TEMPLATE = lib
|
||
|
CONFIG += $$EM_LIBRARY_TYPE
|
||
|
VERSION = $$EM_VERSION
|
||
|
TEMPLATE = subdirs
|
||
|
|
||
|
HEADERS += \
|
||
|
src/entity.h \
|
||
|
src/entitymanager.h \
|
||
|
src/database.h \
|
||
|
src/enums/databasetype.h \
|
||
|
src/schema.h \
|
||
|
src/schema/sqlitequerybuilder.h \
|
||
|
src/schema/sqliteschema.h \
|
||
|
src/tableschema.h \
|
||
|
src/schema/pgsqlschema.h \
|
||
|
src/schema/mysqlschema.h \
|
||
|
src/databasemigration.h \
|
||
|
src/querybuilder.h \
|
||
|
src/relation.h \
|
||
|
src/entityinstancefactory.h \
|
||
|
src/cache.h \
|
||
|
src/entityhelper.h \
|
||
|
src/logger.h \
|
||
|
src/query.h \
|
||
|
src/join.h \
|
||
|
src/queryinterpreter.h \
|
||
|
src/expression.h \
|
||
|
src/orderby.h \
|
||
|
src/validators/validator.h \
|
||
|
src/validators/param.h \
|
||
|
src/validators/errormsg.h \
|
||
|
src/validators/defaultvalidator.h \
|
||
|
src/validators/validatorfactory.h \
|
||
|
src/validators/validatorrule.h \
|
||
|
src/validators/requiredvalidator.h \
|
||
|
src/validators/numbervalidator.h \
|
||
|
src/validators/urlvalidator.h \
|
||
|
src/validators/comparevalidator.h \
|
||
|
src/validators/datevalidator.h \
|
||
|
src/validators/emailvalidator.h \
|
||
|
src/validators/existvalidator.h \
|
||
|
src/validators/filevalidator.h \
|
||
|
src/validators/imagevalidator.h \
|
||
|
src/validators/uniquevalidator.h \
|
||
|
src/validators/patternvalidator.h \
|
||
|
src/validators/lengthvalidator.h \
|
||
|
src/schema/mysqlquerybuilder.h \
|
||
|
src/entityinspector.h
|
||
|
SUBDIRS = src
|
||
|
|
||
|
SOURCES += \
|
||
|
src/entity.cpp \
|
||
|
src/entitymanager.cpp \
|
||
|
src/database.cpp \
|
||
|
src/schema.cpp \
|
||
|
src/schema/sqliteschema.cpp \
|
||
|
src/tableschema.cpp \
|
||
|
src/schema/pgsqlschema.cpp \
|
||
|
src/schema/mysqlschema.cpp \
|
||
|
src/databasemigration.cpp \
|
||
|
src/querybuilder.cpp \
|
||
|
src/schema/sqlitequerybuilder.cpp \
|
||
|
src/relation.cpp \
|
||
|
src/entityinstancefactory.cpp \
|
||
|
src/cache.cpp \
|
||
|
src/entityhelper.cpp \
|
||
|
src/logger.cpp \
|
||
|
src/query.cpp \
|
||
|
src/join.cpp \
|
||
|
src/queryinterpreter.cpp \
|
||
|
src/expression.cpp \
|
||
|
src/orderby.cpp \
|
||
|
src/validators/validator.cpp \
|
||
|
src/validators/param.cpp \
|
||
|
src/validators/errormsg.cpp \
|
||
|
src/validators/defaultvalidator.cpp \
|
||
|
src/validators/validatorfactory.cpp \
|
||
|
src/validators/validatorrule.cpp \
|
||
|
src/validators/requiredvalidator.cpp \
|
||
|
src/validators/numbervalidator.cpp \
|
||
|
src/validators/urlvalidator.cpp \
|
||
|
src/validators/comparevalidator.cpp \
|
||
|
src/validators/datevalidator.cpp \
|
||
|
src/validators/emailvalidator.cpp \
|
||
|
src/validators/existvalidator.cpp \
|
||
|
src/validators/filevalidator.cpp \
|
||
|
src/validators/imagevalidator.cpp \
|
||
|
src/validators/uniquevalidator.cpp \
|
||
|
src/validators/patternvalidator.cpp \
|
||
|
src/validators/lengthvalidator.cpp \
|
||
|
src/schema/mysqlquerybuilder.cpp \
|
||
|
src/entityinspector.cpp
|
||
|
|
||
|
!win32 { # looks bad.
|
||
|
HEADERS += \
|
||
|
src/sqlitebackupprocessor.h
|
||
|
SOURCES += \
|
||
|
src/sqlitebackupprocessor.cpp
|
||
|
LIBS += -lsqlite3
|
||
|
android {
|
||
|
} else {
|
||
|
SUBDIRS += tests samples
|
||
|
}
|
||
|
|
||
|
CONFIG += c++14
|
||
|
QMAKE_CXXFLAGS += -Wall -Wextra -Wunsafe-loop-optimizations -pedantic -Wfloat-equal -Wundef -Wpointer-arith -Wcast-align -Wunreachable-code
|
||
|
#headers.path = $$PREFIX/include/cuteEntityManager
|
||
|
#headers.files = $$HEADERS
|
||
|
#target.path = $$PREFIX/$$LIBDIR
|
||
|
#INSTALLS += target
|
||
|
|
||
|
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
|
||
|
CONFIG += ordered
|
||
|
|
||
|
DISTFILES += \
|
||
|
README.md \
|
||
|
LICENSE \
|
||
|
AUTHORS \
|
||
|
Doxyfile
|
||
|
tests.depends = src
|
||
|
samples.depends = tests
|
||
| samples/example/Example.pro | ||
|---|---|---|
|
QT += core
|
||
|
QT += sql
|
||
|
QT -= gui
|
||
|
|
||
|
#TARGET = EntityManager
|
||
|
CONFIG += console
|
||
|
CONFIG -= app_bundle
|
||
|
|
||
|
TEMPLATE = app
|
||
|
|
||
|
HEADERS += \
|
||
|
models/person.h \
|
||
|
models/group.h \
|
||
|
models/pupil.h \
|
||
|
models/address.h \
|
||
|
models/contact.h \
|
||
|
models/faker/createfakemodeldata.h
|
||
|
|
||
|
SOURCES += \
|
||
|
main.cpp \
|
||
|
models/person.cpp \
|
||
|
models/group.cpp \
|
||
|
models/pupil.cpp \
|
||
|
models/address.cpp \
|
||
|
models/contact.cpp \
|
||
|
models/faker/createfakemodeldata.cpp
|
||
|
|
||
|
unix:!macx:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Debug -lCuteEntityManager
|
||
|
else:unix:!macx:CONFIG(release, release|debug): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Release/ -lCuteEntityManager
|
||
|
CONFIG += c++14
|
||
|
|
||
|
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Release/release/ -lCuteEntityManager
|
||
|
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Debug/debug/ -lCuteEntityManager
|
||
|
|
||
|
INCLUDEPATH += $$PWD/../../src
|
||
|
DEPENDPATH += $$PWD/../../src
|
||
|
|
||
|
unix {
|
||
|
QMAKE_CXXFLAGS += -Wall -Wextra -Wmaybe-uninitialized -Wsuggest-final-types -Wsuggest-final-methods -Wsuggest-override -Wunsafe-loop-optimizations -pedantic -Wfloat-equal -Wundef -Wpointer-arith -Wcast-align -Wunreachable-code -O -Winit-self
|
||
|
}
|
||
|
|
||
|
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
|
||
| samples/example/example.pro | ||
|---|---|---|
|
QT += core
|
||
|
QT += sql
|
||
|
QT -= gui
|
||
|
|
||
|
#TARGET = EntityManager
|
||
|
CONFIG += console
|
||
|
CONFIG -= app_bundle
|
||
|
CONFIG += c++14
|
||
|
|
||
|
TEMPLATE = app
|
||
|
|
||
|
HEADERS += \
|
||
|
models/person.h \
|
||
|
models/group.h \
|
||
|
models/pupil.h \
|
||
|
models/address.h \
|
||
|
models/contact.h \
|
||
|
models/faker/createfakemodeldata.h
|
||
|
|
||
|
SOURCES += \
|
||
|
main.cpp \
|
||
|
models/person.cpp \
|
||
|
models/group.cpp \
|
||
|
models/pupil.cpp \
|
||
|
models/address.cpp \
|
||
|
models/contact.cpp \
|
||
|
models/faker/createfakemodeldata.cpp
|
||
|
|
||
|
unix:!macx:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Debug -lCuteEntityManager
|
||
|
else:unix:!macx:CONFIG(release, release|debug): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Release/ -lCuteEntityManager
|
||
|
|
||
|
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Release/release/ -lCuteEntityManager
|
||
|
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Debug/debug/ -lCuteEntityManager
|
||
|
|
||
|
INCLUDEPATH += $$PWD/../../src
|
||
|
DEPENDPATH += $$PWD/../../src
|
||
|
|
||
|
unix {
|
||
|
QMAKE_CXXFLAGS += -Wall -Wextra -Wmaybe-uninitialized -Wsuggest-final-types -Wsuggest-final-methods -Wsuggest-override -Wunsafe-loop-optimizations -pedantic -Wfloat-equal -Wundef -Wpointer-arith -Wcast-align -Wunreachable-code -O -Winit-self
|
||
|
}
|
||
|
|
||
|
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
|
||
| samples/samples.pro | ||
|---|---|---|
|
TEMPLATE = subdirs
|
||
|
SUBDIRS = example simple validators
|
||
| samples/simple/Simple.pro | ||
|---|---|---|
|
#-------------------------------------------------
|
||
|
#
|
||
|
# Project created by QtCreator 2013-08-01T15:03:24
|
||
|
#
|
||
|
#-------------------------------------------------
|
||
|
|
||
|
QT += core
|
||
|
QT += sql
|
||
|
|
||
|
QT -= gui
|
||
|
|
||
|
#TARGET = EntityManager
|
||
|
CONFIG += console
|
||
|
CONFIG -= app_bundle
|
||
|
|
||
|
TEMPLATE = app
|
||
|
|
||
|
HEADERS += \
|
||
|
artikel.h
|
||
|
|
||
|
SOURCES += \
|
||
|
main.cpp \
|
||
|
artikel.cpp
|
||
|
|
||
|
unix:!macx:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Debug -lCuteEntityManager
|
||
|
else:unix:!macx:CONFIG(release, release|debug): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Release/ -lCuteEntityManager
|
||
|
unix:INCLUDEPATH += $$PWD/../../src
|
||
|
unix:DEPENDPATH += $$PWD/../../src
|
||
|
CONFIG += c++14
|
||
|
QMAKE_CXXFLAGS += -std=c++14
|
||
|
|
||
|
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Release/release/ -lCuteEntityManager
|
||
|
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Debug/debug/ -lCuteEntityManager
|
||
|
|
||
|
win32:INCLUDEPATH += $$PWD/../../../build-EntityManager-Desktop-Debug/debug
|
||
|
win32:DEPENDPATH += $$PWD/../../../build-EntityManager-Desktop-Debug/debug
|
||
|
|
||
|
INCLUDEPATH += $$PWD/../../src
|
||
|
DEPENDPATH += $$PWD/../../src
|
||
|
|
||
|
unix {
|
||
|
QMAKE_CXXFLAGS += -Wall -Wextra -Wmaybe-uninitialized -Wsuggest-final-types -Wsuggest-final-methods -Wsuggest-override -Wunsafe-loop-optimizations -pedantic -Wfloat-equal -Wundef -Wpointer-arith -Wcast-align -Wunreachable-code -O -Winit-self
|
||
|
}
|
||
|
|
||
|
win32-g++ {
|
||
|
CONFIG += c++11
|
||
|
QMAKE_CXXFLAGS += -std=c++11 -Wall
|
||
|
}
|
||
|
|
||
|
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
|
||
| samples/simple/main.cpp | ||
|---|---|---|
|
i++;
|
||
|
}
|
||
|
qDebug() << i;
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
| samples/simple/simple.pro | ||
|---|---|---|
|
#-------------------------------------------------
|
||
|
#
|
||
|
# Project created by QtCreator 2013-08-01T15:03:24
|
||
|
#
|
||
|
#-------------------------------------------------
|
||
|
|
||
|
QT += core
|
||
|
QT += sql
|
||
|
|
||
|
QT -= gui
|
||
|
|
||
|
#TARGET = EntityManager
|
||
|
CONFIG += console
|
||
|
CONFIG -= app_bundle
|
||
|
|
||
|
TEMPLATE = app
|
||
|
|
||
|
HEADERS += \
|
||
|
artikel.h
|
||
|
|
||
|
SOURCES += \
|
||
|
main.cpp \
|
||
|
artikel.cpp
|
||
|
|
||
|
unix:!macx:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Debug -lCuteEntityManager
|
||
|
else:unix:!macx:CONFIG(release, release|debug): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Release/ -lCuteEntityManager
|
||
|
unix:INCLUDEPATH += $$PWD/../../src
|
||
|
unix:DEPENDPATH += $$PWD/../../src
|
||
|
CONFIG += c++14
|
||
|
QMAKE_CXXFLAGS += -std=c++14
|
||
|
|
||
|
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Release/release/ -lCuteEntityManager
|
||
|
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Debug/debug/ -lCuteEntityManager
|
||
|
|
||
|
win32:INCLUDEPATH += $$PWD/../../../build-EntityManager-Desktop-Debug/debug
|
||
|
win32:DEPENDPATH += $$PWD/../../../build-EntityManager-Desktop-Debug/debug
|
||
|
|
||
|
INCLUDEPATH += $$PWD/../../src
|
||
|
DEPENDPATH += $$PWD/../../src
|
||
|
|
||
|
unix {
|
||
|
QMAKE_CXXFLAGS += -Wall -Wextra -Wmaybe-uninitialized -Wsuggest-final-types -Wsuggest-final-methods -Wsuggest-override -Wunsafe-loop-optimizations -pedantic -Wfloat-equal -Wundef -Wpointer-arith -Wcast-align -Wunreachable-code -O -Winit-self
|
||
|
}
|
||
|
|
||
|
win32-g++ {
|
||
|
CONFIG += c++11
|
||
|
QMAKE_CXXFLAGS += -std=c++11 -Wall
|
||
|
}
|
||
|
|
||
|
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
|
||
| samples/validators/Validators.pro | ||
|---|---|---|
|
#-------------------------------------------------
|
||
|
#
|
||
|
# Project created by QtCreator 2013-08-01T15:03:24
|
||
|
#
|
||
|
#-------------------------------------------------
|
||
|
|
||
|
QT += core
|
||
|
QT += sql
|
||
|
|
||
|
QT -= gui
|
||
|
|
||
|
#TARGET = EntityManager
|
||
|
CONFIG += console
|
||
|
CONFIG -= app_bundle
|
||
|
|
||
|
TEMPLATE = app
|
||
|
|
||
|
HEADERS += \
|
||
|
address.h \
|
||
|
person.h
|
||
|
|
||
|
SOURCES += \
|
||
|
main.cpp \
|
||
|
address.cpp \
|
||
|
person.cpp
|
||
|
|
||
|
unix:!macx:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Debug -lCuteEntityManager
|
||
|
else:unix:!macx:CONFIG(release, release|debug): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Release/ -lCuteEntityManager
|
||
|
unix:INCLUDEPATH += $$PWD/../../src
|
||
|
unix:DEPENDPATH += $$PWD/../../src
|
||
|
CONFIG += c++14
|
||
|
QMAKE_CXXFLAGS += -std=c++14
|
||
|
|
||
|
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Release/release/ -lCuteEntityManager
|
||
|
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Debug/debug/ -lCuteEntityManager
|
||
|
|
||
|
win32:INCLUDEPATH += $$PWD/../../../build-EntityManager-Desktop-Debug/debug
|
||
|
win32:DEPENDPATH += $$PWD/../../../build-EntityManager-Desktop-Debug/debug
|
||
|
|
||
|
INCLUDEPATH += $$PWD/../../src
|
||
|
DEPENDPATH += $$PWD/../../src
|
||
|
|
||
|
unix {
|
||
|
QMAKE_CXXFLAGS += -Wall -Wextra -Wmaybe-uninitialized -Wsuggest-final-types -Wsuggest-final-methods -Wsuggest-override -Wunsafe-loop-optimizations -pedantic -Wfloat-equal -Wundef -Wpointer-arith -Wcast-align -Wunreachable-code -O -Winit-self
|
||
|
}
|
||
|
|
||
|
win32-g++ {
|
||
|
CONFIG += c++11
|
||
|
QMAKE_CXXFLAGS += -std=c++11 -Wall
|
||
|
}
|
||
|
|
||
|
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
|
||
| samples/validators/validators.pro | ||
|---|---|---|
|
#-------------------------------------------------
|
||
|
#
|
||
|
# Project created by QtCreator 2013-08-01T15:03:24
|
||
|
#
|
||
|
#-------------------------------------------------
|
||
|
|
||
|
QT += core
|
||
|
QT += sql
|
||
|
|
||
|
QT -= gui
|
||
|
|
||
|
#TARGET = EntityManager
|
||
|
CONFIG += console
|
||
|
CONFIG -= app_bundle
|
||
|
|
||
|
TEMPLATE = app
|
||
|
|
||
|
HEADERS += \
|
||
|
address.h \
|
||
|
person.h
|
||
|
|
||
|
SOURCES += \
|
||
|
main.cpp \
|
||
|
address.cpp \
|
||
|
person.cpp
|
||
|
|
||
|
unix:!macx:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Debug -lCuteEntityManager
|
||
|
else:unix:!macx:CONFIG(release, release|debug): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Release/ -lCuteEntityManager
|
||
|
unix:INCLUDEPATH += $$PWD/../../src
|
||
|
unix:DEPENDPATH += $$PWD/../../src
|
||
|
CONFIG += c++14
|
||
|
QMAKE_CXXFLAGS += -std=c++14
|
||
|
|
||
|
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Release/release/ -lCuteEntityManager
|
||
|
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../build-EntityManager-Desktop-Debug/debug/ -lCuteEntityManager
|
||
|
|
||
|
win32:INCLUDEPATH += $$PWD/../../../build-EntityManager-Desktop-Debug/debug
|
||
|
win32:DEPENDPATH += $$PWD/../../../build-EntityManager-Desktop-Debug/debug
|
||
|
|
||
|
INCLUDEPATH += $$PWD/../../src
|
||
|
DEPENDPATH += $$PWD/../../src
|
||
|
|
||
|
unix {
|
||
|
QMAKE_CXXFLAGS += -Wall -Wextra -Wmaybe-uninitialized -Wsuggest-final-types -Wsuggest-final-methods -Wsuggest-override -Wunsafe-loop-optimizations -pedantic -Wfloat-equal -Wundef -Wpointer-arith -Wcast-align -Wunreachable-code -O -Winit-self
|
||
|
}
|
||
|
|
||
|
win32-g++ {
|
||
|
CONFIG += c++11
|
||
|
QMAKE_CXXFLAGS += -std=c++11 -Wall
|
||
|
}
|
||
|
|
||
|
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
|
||
| src/entityinspector.cpp | ||
|---|---|---|
|
QString msg = "";
|
||
|
if (entity) {
|
||
|
msg = name + " is instantiable.";
|
||
|
this->logger->logMsg(msg, MsgType::INFO);
|
||
|
this->logger->logMsg(msg, MsgType::DEBUG);
|
||
|
} else {
|
||
|
msg = name + " is NOT instantiable!";
|
||
|
this->logger->logMsg(msg, MsgType::CRITICAL);
|
||
| src/src.pro | ||
|---|---|---|
|
include (../EntityManager.pri)
|
||
|
QT += core
|
||
|
QT += sql
|
||
|
#if you need Image Validation you must compile with += gui
|
||
|
#QT += gui
|
||
|
QT -= gui
|
||
|
|
||
|
TARGET = CuteEntityManager
|
||
|
TEMPLATE = lib
|
||
|
CONFIG += $$EM_LIBRARY_TYPE
|
||
|
VERSION = $$EM_VERSION
|
||
|
|
||
|
HEADERS += \
|
||
|
entity.h \
|
||
|
entitymanager.h \
|
||
|
database.h \
|
||
|
enums/databasetype.h \
|
||
|
schema.h \
|
||
|
schema/sqlitequerybuilder.h \
|
||
|
schema/sqliteschema.h \
|
||
|
tableschema.h \
|
||
|
schema/pgsqlschema.h \
|
||
|
schema/mysqlschema.h \
|
||
|
databasemigration.h \
|
||
|
querybuilder.h \
|
||
|
relation.h \
|
||
|
entityinstancefactory.h \
|
||
|
cache.h \
|
||
|
entityhelper.h \
|
||
|
logger.h \
|
||
|
query.h \
|
||
|
join.h \
|
||
|
queryinterpreter.h \
|
||
|
expression.h \
|
||
|
orderby.h \
|
||
|
validators/validator.h \
|
||
|
validators/param.h \
|
||
|
validators/errormsg.h \
|
||
|
validators/defaultvalidator.h \
|
||
|
validators/validatorfactory.h \
|
||
|
validators/validatorrule.h \
|
||
|
validators/requiredvalidator.h \
|
||
|
validators/numbervalidator.h \
|
||
|
validators/urlvalidator.h \
|
||
|
validators/comparevalidator.h \
|
||
|
validators/datevalidator.h \
|
||
|
validators/emailvalidator.h \
|
||
|
validators/existvalidator.h \
|
||
|
validators/filevalidator.h \
|
||
|
validators/imagevalidator.h \
|
||
|
validators/uniquevalidator.h \
|
||
|
validators/patternvalidator.h \
|
||
|
validators/lengthvalidator.h \
|
||
|
schema/mysqlquerybuilder.h \
|
||
|
entityinspector.h
|
||
|
|
||
|
SOURCES += \
|
||
|
entity.cpp \
|
||
|
entitymanager.cpp \
|
||
|
database.cpp \
|
||
|
schema.cpp \
|
||
|
schema/sqliteschema.cpp \
|
||
|
tableschema.cpp \
|
||
|
schema/pgsqlschema.cpp \
|
||
|
schema/mysqlschema.cpp \
|
||
|
databasemigration.cpp \
|
||
|
querybuilder.cpp \
|
||
|
schema/sqlitequerybuilder.cpp \
|
||
|
relation.cpp \
|
||
|
entityinstancefactory.cpp \
|
||
|
cache.cpp \
|
||
|
entityhelper.cpp \
|
||
|
logger.cpp \
|
||
|
query.cpp \
|
||
|
join.cpp \
|
||
|
queryinterpreter.cpp \
|
||
|
expression.cpp \
|
||
|
orderby.cpp \
|
||
|
validators/validator.cpp \
|
||
|
validators/param.cpp \
|
||
|
validators/errormsg.cpp \
|
||
|
validators/defaultvalidator.cpp \
|
||
|
validators/validatorfactory.cpp \
|
||
|
validators/validatorrule.cpp \
|
||
|
validators/requiredvalidator.cpp \
|
||
|
validators/numbervalidator.cpp \
|
||
|
validators/urlvalidator.cpp \
|
||
|
validators/comparevalidator.cpp \
|
||
|
validators/datevalidator.cpp \
|
||
|
validators/emailvalidator.cpp \
|
||
|
validators/existvalidator.cpp \
|
||
|
validators/filevalidator.cpp \
|
||
|
validators/imagevalidator.cpp \
|
||
|
validators/uniquevalidator.cpp \
|
||
|
validators/patternvalidator.cpp \
|
||
|
validators/lengthvalidator.cpp \
|
||
|
schema/mysqlquerybuilder.cpp \
|
||
|
entityinspector.cpp
|
||
|
|
||
|
!win32 { # looks bad.
|
||
|
HEADERS += \
|
||
|
sqlitebackupprocessor.h
|
||
|
SOURCES += \
|
||
|
sqlitebackupprocessor.cpp
|
||
|
LIBS += -lsqlite3
|
||
|
}
|
||
|
|
||
|
CONFIG += c++14
|
||
|
QMAKE_CXXFLAGS += -Wall -Wextra -Wunsafe-loop-optimizations -pedantic -Wfloat-equal -Wundef -Wpointer-arith -Wcast-align -Wunreachable-code
|
||
|
#headers.path = $$PREFIX/include/cuteEntityManager
|
||
|
#headers.files = $$HEADERS
|
||
|
#target.path = $$PREFIX/$$LIBDIR
|
||
|
#INSTALLS += target
|
||
|
|
||
|
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
|
||
| src/validators/uniquevalidator.cpp | ||
|---|---|---|
|
#include "uniquevalidator.h"
|
||
|
#include "src/entitymanager.h"
|
||
|
#include "entitymanager.h"
|
||
|
using namespace CuteEntityManager;
|
||
|
UniqueValidator::UniqueValidator() : Validator() {
|
||
|
}
|
||
| tests/Tests.pri | ||
|---|---|---|
|
include(../EntityManager.pri)
|
||
|
|
||
|
QT += core
|
||
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||
|
|
||
|
CONFIG += c++11
|
||
|
|
||
|
QT += testlib
|
||
|
CONFIG -= app_bundle
|
||
|
CONFIG += testcase
|
||
| tests/Tests.pro | ||
|---|---|---|
|
TEMPLATE = subdirs
|
||
|
SUBDIRS = tables
|
||
| tests/models.cpp | ||
|---|---|---|
|
|
||
|
Person::Person(QObject *parent): Entity(parent) {
|
||
|
}
|
||
|
|
||
|
Person::Person(QString firstName, QString familyName, Gender gender,
|
||
|
QString customPictureFileName, QString namePrefix, QString nickName,
|
||
|
QDate birthday, QObject *parent): Entity(parent) {
|
||
| ... | ... | |
|
groups = value;
|
||
|
}
|
||
|
|
||
|
void Person::addContact(Contact *contact) {
|
||
|
this->contacts.append(QSharedPointer<Contact>(contact));
|
||
|
}
|
||
|
|
||
|
void Person::addAddress(Address *address) {
|
||
|
this->addresses.append(QSharedPointer<Address>(address));
|
||
|
}
|
||
|
|
||
|
QList<QSharedPointer<Group> > Person::getMaintainedGroups() const {
|
||
|
return maintainedGroups;
|
||
|
}
|
||
| ... | ... | |
|
}
|
||
|
|
||
|
QSharedPointer<Person> Group::getLeader() const {
|
||
|
return mainTeacher;
|
||
|
return leader;
|
||
|
}
|
||
|
|
||
|
void Group::setLeader(const QSharedPointer<Person> &value) {
|
||
|
mainTeacher = value;
|
||
|
leader = value;
|
||
|
}
|
||
|
|
||
|
QList<QSharedPointer<Person> > Group::getPersons() const {
|
||
|
return persons;
|
||
|
}
|
||
| tests/models.h | ||
|---|---|---|
|
#include "../../entitymanager/src/entity.h"
|
||
|
|
||
|
using namespace CuteEntityManager;
|
||
|
class Group;
|
||
|
class Person: public Entity {
|
||
|
Q_OBJECT
|
||
|
Q_PROPERTY(QString firstName READ getFirstName WRITE setFirstName)
|
||
| ... | ... | |
|
Q_PROPERTY(QDate birthday READ getBirthday WRITE setBirthday)
|
||
|
Q_PROPERTY(Gender gender READ getGender WRITE setGender)
|
||
|
Q_PROPERTY(QList<QSharedPointer<Group>> groups READ getGroups WRITE setGroups)
|
||
|
Q_PROPERTY(QList<QSharedPointer<Group>> maintainedGroups READ
|
||
|
getMaintainedGroups WRITE setMaintainedGroups)
|
||
|
Q_PROPERTY(QList<QSharedPointer<Contact>> contacts READ getContacts WRITE
|
||
|
setContacts)
|
||
|
Q_PROPERTY(QList<QSharedPointer<Address>> addresses READ
|
||
|
getAddresses WRITE setAddresses)
|
||
|
Q_PROPERTY(QList<QSharedPointer<Group>> maintainedGroups READ getMaintainedGroups WRITE setMaintainedGroups)
|
||
|
|
||
|
public:
|
||
|
enum class Gender {MALE, FEMALE, UNKNOWNGENDER};
|
||
| ... | ... | |
|
QString customPictureFileName = QString(), QString namePrefix = QString(),
|
||
|
QString nickName = QString(), QDate birthday = QDate(), QObject *parent = 0);
|
||
|
|
||
|
virtual const QHash<QString, CuteEntityManager::Relation> getRelations() const override;
|
||
|
virtual const QHash<QString, CuteEntityManager::Relation> getRelations() const
|
||
|
override;
|
||
|
|
||
|
bool isPresent(QDateTime date = QDateTime::currentDateTime());
|
||
|
QString fullName(NameOrder nameOrder = NameOrder::FAMILY_FIRST_NAME_ORDER)
|
||
| ... | ... | |
|
QString getCustomPictureFileName() const;
|
||
|
void setCustomPictureFileName(const QString &value);
|
||
|
|
||
|
QList<QSharedPointer<Contact> > getContacts() const;
|
||
|
void setContacts(const QList<QSharedPointer<Contact> > &value);
|
||
|
|
||
|
QList<QSharedPointer<Address> > getAddresses() const;
|
||
|
void setAddresses(const QList<QSharedPointer<Address> > &value);
|
||
|
|
||
|
QList<QSharedPointer<Group> > getGroups() const;
|
||
|
void setGroups(const QList<QSharedPointer<Group> > &value);
|
||
|
|
||
|
void addContact(Contact *contact);
|
||
|
void addAddress(Address *address);
|
||
|
|
||
|
QList<QSharedPointer<Group> > getMaintainedGroups() const;
|
||
|
void setMaintainedGroups(const QList<QSharedPointer<Group> > &value);
|
||
|
|
||
|
protected:
|
||
|
protected:
|
||
|
QString firstName;
|
||
|
QString familyName;
|
||
|
QString namePrefix;
|
||
| ... | ... | |
|
QDate birthday;
|
||
|
Gender gender;
|
||
|
QString customPictureFileName;
|
||
|
QList <QSharedPointer<Contact>> contacts;
|
||
|
QList <QSharedPointer<Address>> addresses;
|
||
|
QList <QSharedPointer<Group>> groups;
|
||
|
QList <QSharedPointer<Group>> maintainedGroups;
|
||
|
|
||
|
};
|
||
|
|
||
|
class Person;
|
||
| tests/tables/.gitignore | ||
|---|---|---|
|
# This file is used to ignore files which are generated
|
||
|
# ----------------------------------------------------------------------------
|
||
|
|
||
|
*~
|
||
|
*.autosave
|
||
|
*.a
|
||
|
*.core
|
||
|
*.moc
|
||
|
*.o
|
||
|
*.obj
|
||
|
*.orig
|
||
|
*.rej
|
||
|
*.so
|
||
|
*.so.*
|
||
|
*_pch.h.cpp
|
||
|
*_resource.rc
|
||
|
*.qm
|
||
|
.#*
|
||
|
*.*#
|
||
|
core
|
||
|
!core/
|
||
|
tags
|
||
|
.DS_Store
|
||
|
*.debug
|
||
|
Makefile*
|
||
|
*.prl
|
||
|
*.app
|
||
|
moc_*.cpp
|
||
|
ui_*.h
|
||
|
qrc_*.cpp
|
||
|
Thumbs.db
|
||
|
*.res
|
||
|
*.rc
|
||
|
/.qmake.cache
|
||
|
/.qmake.stash
|
||
|
|
||
|
# qtcreator generated files
|
||
|
*.pro.user*
|
||
|
|
||
|
# xemacs temporary files
|
||
|
*.flc
|
||
|
|
||
|
# Vim temporary files
|
||
|
.*.swp
|
||
|
|
||
|
# Visual Studio generated files
|
||
|
*.ib_pdb_index
|
||
|
*.idb
|
||
|
*.ilk
|
||
|
*.pdb
|
||
|
*.sln
|
||
|
*.suo
|
||
|
*.vcproj
|
||
|
*vcproj.*.*.user
|
||
|
*.ncb
|
||
|
*.sdf
|
||
|
*.opensdf
|
||
|
*.vcxproj
|
||
|
*vcxproj.*
|
||
|
|
||
|
# MinGW generated files
|
||
|
*.Debug
|
||
|
*.Release
|
||
|
|
||
|
# Python byte code
|
||
|
*.pyc
|
||
|
|
||
|
# Binaries
|
||
|
# --------
|
||
|
*.dll
|
||
|
*.exe
|
||
|
|
||
|
|
||
| tests/tables/tables.pro | ||
|---|---|---|
|
include(../Tests.pri)
|
||
|
TARGET = Tables
|
||
|
#-------------------------------------------------
|
||
|
#
|
||
|
# Project created by QtCreator 2015-10-11T20:35:07
|
||
|
#
|
||
|
#-------------------------------------------------
|
||
|
include(../tests.pri)
|
||
|
|
||
|
QT += sql testlib
|
||
|
|
||
|
QT -= gui
|
||
|
|
||
|
TARGET = tst_tables
|
||
|
CONFIG += console
|
||
|
CONFIG -= app_bundle
|
||
|
|
||
|
SOURCES += \
|
||
|
TEMPLATE = app
|
||
|
|
||
|
|
||
|
SOURCES += tst_tables.cpp \
|
||
|
../models.cpp
|
||
|
DEFINES += SRCDIR=\\\"$$PWD/\\\"
|
||
|
|
||
|
HEADERS += \
|
||
|
../models.h
|
||
|
|
||
| tests/tables/tst_tables.cpp | ||
|---|---|---|
|
#include <QString>
|
||
|
#include <QtTest>
|
||
|
#include "entitymanager.h"
|
||
|
#include "databasemigration.h"
|
||
|
#include "../models.h"
|
||
|
class Tables : public QObject {
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
Tables();
|
||
|
|
||
|
private Q_SLOTS:
|
||
|
void initTestCase();
|
||
|
void cleanupTestCase();
|
||
|
void testStartup();
|
||
|
// void init();
|
||
|
// void cleanup();
|
||
|
private:
|
||
|
CuteEntityManager::EntityManager *e;
|
||
|
};
|
||
|
|
||
|
Tables::Tables() {
|
||
|
}
|
||
|
|
||
|
void Tables::initTestCase() {
|
||
|
CuteEntityManager::EntityInstanceFactory::registerClass<Group>();
|
||
|
CuteEntityManager::EntityInstanceFactory::registerClass<Person>();
|
||
|
this->e = new CuteEntityManager::EntityManager("QSQLITE",
|
||
|
":memory:", "", "", "", "", true, "foreign_keys = ON");
|
||
|
}
|
||
|
|
||
|
void Tables::cleanupTestCase() {
|
||
|
// if (this->e) {
|
||
|
// delete this->e;
|
||
|
// this->e = nullptr;
|
||
|
// }
|
||
|
}
|
||
|
|
||
|
void Tables::testStartup() {
|
||
|
QStringList inits = QStringList() << "Person" << "Group";
|
||
|
QVERIFY2(this->e->startup("test0.1", inits), "Failure");
|
||
|
auto tableNames = this->e->getSchema()->getTableNames();
|
||
|
QVERIFY(tableNames.contains("person"));
|
||
|
QVERIFY(tableNames.contains("group"));
|
||
|
QVERIFY(tableNames.contains("group_persons"));
|
||
|
QVERIFY(tableNames.contains("cuteentitymanager::databasemigration"));
|
||
|
auto migrations = this->e->findAll<CuteEntityManager::DatabaseMigration>();
|
||
|
QCOMPARE(migrations.size(), 1);
|
||
|
QCOMPARE(migrations.at(0)->getVersion(), QString("test0.1"));
|
||
|
}
|
||
|
|
||
|
QTEST_APPLESS_MAIN(Tables)
|
||
|
|
||
|
#include "tst_tables.moc"
|
||
| tests/tests.pri | ||
|---|---|---|
|
include(../EntityManager.pri)
|
||
|
|
||
|
QT += core
|
||
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||
|
|
||
|
CONFIG += c++14
|
||
|
|
||
|
QT += testlib
|
||
|
CONFIG -= app_bundle
|
||
|
CONFIG += testcase
|
||
|
INCLUDEPATH += $$PWD/../src
|
||
|
DEPENDPATH += $$PWD/../src
|
||
|
|
||
|
unix:!macx:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../build-EntityManager-Desktop-Debug -lCuteEntityManager
|
||
|
else:unix:!macx:CONFIG(release, release|debug): LIBS += -L$$PWD/../../build-EntityManager-Desktop-Release/ -lCuteEntityManager
|
||
|
|
||
|
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../build-EntityManager-Desktop-Release/release/ -lCuteEntityManager
|
||
|
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../build-EntityManager-Desktop-Debug/debug/ -lCuteEntityManager
|
||
| tests/tests.pro | ||
|---|---|---|
|
include(tests.pri)
|
||
|
|
||
|
TEMPLATE = subdirs
|
||
|
|
||
|
SUBDIRS += \
|
||
|
tables
|
||
Auch abrufbar als: Unified diff
testing