Herunterladen als
root/src/entity.h @ 56b9e133
81c23b56 | Christian Ehringfeld | /*
|
|
6899f814 | Christian Ehringfeld | * Copyright (C) 2015 Christian Ehringfeld <c.ehringfeld@t-online.de>
|
|
*
|
|||
* This program 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.
|
|||
*
|
|||
* This program 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 General Public License
|
|||
* for more details.
|
|||
*
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
|||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
*/
|
|||
81c23b56 | Christian Ehringfeld | ||
586bb527 | Christian Ehringfeld | #ifndef ENTITY_H
|
|
#define ENTITY_H
|
|||
81c23b56 | Christian Ehringfeld | #include <QtGlobal>
|
|
#include <QMap>
|
|||
#include <QDebug>
|
|||
aa44e7d1 | Christian Ehringfeld | #include <QObject>
|
|
813205af | Christian Ehringfeld | #include <QMetaProperty>
|
|
24c5480c | Christian Ehringfeld | #include "relation.h"
|
|
7e233492 | Christian Ehringfeld | #include <QStringList>
|
|
97f9a843 | Christian Ehringfeld | #include <QSharedPointer>
|
|
2e43da3f | Christian Ehringfeld | #include <QStack>
|
|
#include <QQueue>
|
|||
6899f814 | Christian Ehringfeld | namespace CuteEntityManager {
|
|
81c23b56 | Christian Ehringfeld | ||
9c2f773f | Christian Ehringfeld | /**
|
|
ba800d6d | Christian Ehringfeld | * You mustn't name any persisted property objectName, because its pre used by Qt and will be ignored by Entity Manager
|
|
9c2f773f | Christian Ehringfeld | * @brief The Entity class
|
|
*/
|
|||
aa44e7d1 | Christian Ehringfeld | class Entity : public QObject {
|
|
Q_OBJECT
|
|||
24c5480c | Christian Ehringfeld | Q_PROPERTY(qint64 id READ getId WRITE setId NOTIFY idChanged)
|
|
9d05e414 | Christian Ehringfeld | ||
586bb527 | Christian Ehringfeld | signals:
|
|
void idChanged();
|
|||
9d05e414 | Christian Ehringfeld | ||
426974c6 | Christian Ehringfeld | public:
|
|
9d05e414 | Christian Ehringfeld | Entity (QObject *parent = 0);
|
|
2e43da3f | Christian Ehringfeld | virtual QString toString() const;
|
|
81c23b56 | Christian Ehringfeld | virtual ~Entity();
|
|
2e43da3f | Christian Ehringfeld | virtual QString getTablename() const;
|
|
a47954c0 | Christian Ehringfeld | /**
|
|
* @brief getRelations
|
|||
* @return
|
|||
*/
|
|||
a06633f7 | Christian Ehringfeld | virtual const QHash<QString, Relation> getRelations() const;
|
|
virtual const QStringList getTransientAttributes() const;
|
|||
virtual const QStringList getBLOBColumns() const;
|
|||
2e43da3f | Christian Ehringfeld | virtual InheritanceStrategy getInheritanceStrategy() const;
|
|
bb5e9339 | SebastianDiel | ||
24c5480c | Christian Ehringfeld | //return value must be the exact name defined in Q_PROPERTY
|
|
2e43da3f | Christian Ehringfeld | virtual QString getPrimaryKey() const;
|
|
const QStack<const QMetaObject *> superClasses() const;
|
|||
a06633f7 | Christian Ehringfeld | const QHash<QString, QMetaProperty> getMetaProperties() const;
|
|
2e43da3f | Christian Ehringfeld | static const QHash<QString, QMetaProperty> getMetaProperties(const QMetaObject* object);
|
|
const QHash<QString, QMetaProperty> getInheritedMetaProperties() const;
|
|||
2d9fab10 | Christian Ehringfeld | const QHash<Relation, QMetaProperty> getRelationProperties() const;
|
|
a06633f7 | Christian Ehringfeld | const char *getClassname() const;
|
|
586bb527 | Christian Ehringfeld | ||
813205af | Christian Ehringfeld | qint64 getId() const;
|
|
void setId(const qint64 &value);
|
|||
24c5480c | Christian Ehringfeld | ||
97f9a843 | Christian Ehringfeld | protected:
|
|
813205af | Christian Ehringfeld | qint64 id;
|
|
81c23b56 | Christian Ehringfeld | };
|
|
}
|
|||
586bb527 | Christian Ehringfeld | #endif // ENTITY_H
|