Herunterladen als
root/src/entityhelper.h @ 38838b5b
4b90a7ee | 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/>.
|
|||
*/
|
|||
e8d1537c | Christian Ehringfeld | #ifndef ENTITYHELPER_H
|
|
#define ENTITYHELPER_H
|
|||
#include <QString>
|
|||
#include <QHash>
|
|||
#include <QMetaProperty>
|
|||
namespace CuteEntityManager {
|
|||
class Relation;
|
|||
class Entity;
|
|||
class Cache;
|
|||
66704054 | Christian Ehringfeld | class EntityHelper {
|
|
public:
|
|||
e8d1537c | Christian Ehringfeld | EntityHelper();
|
|
66704054 | Christian Ehringfeld | static const QHash<QString, Relation> getNonInheritedRelations(
|
|
const Entity *entity);
|
|||
static const QList<const QMetaObject *> superClasses(const Entity *entity,
|
|||
bool stopAtSingleTableInheritance
|
|||
= false);
|
|||
static const QHash<QString, QMetaProperty> getMetaProperties(
|
|||
const Entity *entity);
|
|||
static const QHash<QString, QMetaProperty> getSuperMetaProperties(
|
|||
const Entity *entity);
|
|||
static const QHash<QString, QMetaProperty> getMetaProperties(
|
|||
const QMetaObject *object);
|
|||
static const QHash<QString, QMetaProperty> getInheritedMetaProperties(
|
|||
const Entity *entity);
|
|||
static const QHash<Relation, QMetaProperty> getRelationProperties(
|
|||
const Entity *entity);
|
|||
e8d1537c | Christian Ehringfeld | ||
static const char *getClassname(const Entity *entity);
|
|||
static const QString getClassName(const Entity *entity);
|
|||
static void addEntityToListProperty(const QSharedPointer<Entity> &entity,
|
|||
66704054 | Christian Ehringfeld | QSharedPointer<Entity> add, const QMetaProperty &property);
|
|
48245e6a | Christian Ehringfeld | static void removeEntityFromListProperty(const QSharedPointer<Entity> &entity,
|
|
QSharedPointer<Entity> remove, const QMetaProperty &property);
|
|||
e8d1537c | Christian Ehringfeld | static void setListProperty(const QSharedPointer<Entity> &entity,
|
|
66704054 | Christian Ehringfeld | QList<QSharedPointer<Entity>> &list,
|
|
const QMetaProperty &property);
|
|||
e8d1537c | Christian Ehringfeld | static void setProperty(const QSharedPointer<Entity> &entity,
|
|
66704054 | Christian Ehringfeld | QSharedPointer<Entity> value,
|
|
const QMetaProperty &property);
|
|||
e8d1537c | Christian Ehringfeld | static void setProperty(const QSharedPointer<Entity> &entity,
|
|
66704054 | Christian Ehringfeld | QSharedPointer<Entity> value,
|
|
const QString property);
|
|||
e8d1537c | Christian Ehringfeld | static QMetaProperty mappedProperty(const Relation &r,
|
|
66704054 | Christian Ehringfeld | const QSharedPointer<Entity> &foreignEntity);
|
|
86e5c917 | Christian Ehringfeld | static QHash<QString, QVariant> getEntityAttributes(const QHash<QString, QMetaProperty>
|
|
&props,
|
|||
const QSharedPointer<Entity> &entity);
|
|||
e8d1537c | Christian Ehringfeld | };
|
|
}
|
|||
#endif // ENTITYHELPER_H
|