Projekt

Allgemein

Profil

Herunterladen als
Herunterladen (2,55 KB) Statistiken
| Zweig: | Revision:
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>
47f9301a Christian Ehringfeld
#include "entityinstancefactory.h"
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:
6d91d381 Christian Ehringfeld
explicit Entity (QObject *parent = 0);
2e43da3f Christian Ehringfeld
virtual QString toString() const;
81c23b56 Christian Ehringfeld
virtual ~Entity();
2e43da3f Christian Ehringfeld
virtual QString getTablename() const;
a06633f7 Christian Ehringfeld
virtual const QHash<QString, Relation> getRelations() const;
47f9301a Christian Ehringfeld
virtual const QHash<QString, Relation> getNonInheritedRelations() const;
a06633f7 Christian Ehringfeld
virtual const QStringList getTransientAttributes() const;
virtual const QStringList getBLOBColumns() const;
2e43da3f Christian Ehringfeld
virtual InheritanceStrategy getInheritanceStrategy() const;
da3ce9cf Christian Ehringfeld
virtual bool isInheritanceCascaded() const;
bb5e9339 SebastianDiel
24c5480c Christian Ehringfeld
//return value must be the exact name defined in Q_PROPERTY
2e43da3f Christian Ehringfeld
virtual QString getPrimaryKey() const;
da3ce9cf Christian Ehringfeld
const QList<const QMetaObject *> superClasses(bool stopAtSingleTableInheritance
6d91d381 Christian Ehringfeld
= false) const;
a06633f7 Christian Ehringfeld
const QHash<QString, QMetaProperty> getMetaProperties() const;
47f9301a Christian Ehringfeld
const QHash<QString, QMetaProperty> getSuperMetaProperties() const;
6d91d381 Christian Ehringfeld
static const QHash<QString, QMetaProperty> getMetaProperties(
const QMetaObject *object);
2e43da3f Christian Ehringfeld
const QHash<QString, QMetaProperty> getInheritedMetaProperties() const;
2d9fab10 Christian Ehringfeld
const QHash<Relation, QMetaProperty> getRelationProperties() const;
a06633f7 Christian Ehringfeld
const char *getClassname() const;
da3ce9cf Christian Ehringfeld
QVariant property(const QString &name) 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