Projekt

Allgemein

Profil

Herunterladen als
Herunterladen (3,86 KB) Statistiken
| Zweig: | Revision:
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>
612083d3 Christian Ehringfeld
#include "entity.h"
#include "entityinstancefactory.h"
#include "entity.h"
e8d1537c Christian Ehringfeld
namespace CuteEntityManager {

class Relation;
class Entity;
class Cache;
66704054 Christian Ehringfeld
class EntityHelper {
74d545d4 Christian Ehringfeld
public:
e8d1537c Christian Ehringfeld
EntityHelper();
66704054 Christian Ehringfeld
static const QHash<QString, Relation> getNonInheritedRelations(
74d545d4 Christian Ehringfeld
const Entity *entity);
66704054 Christian Ehringfeld
static const QList<const QMetaObject *> superClasses(const Entity *entity,
74d545d4 Christian Ehringfeld
bool stopAtSingleTableInheritance
= false);
66704054 Christian Ehringfeld
static const QHash<QString, QMetaProperty> getMetaProperties(
74d545d4 Christian Ehringfeld
const Entity *entity);
66704054 Christian Ehringfeld
static const QHash<QString, QMetaProperty> getSuperMetaProperties(
74d545d4 Christian Ehringfeld
const Entity *entity);
66704054 Christian Ehringfeld
static const QHash<QString, QMetaProperty> getMetaProperties(
74d545d4 Christian Ehringfeld
const QMetaObject *object);
4e75d5a1 Christian Ehringfeld
static const QHash<QString, QMetaProperty> getNonInheritedMetaProperties(
74d545d4 Christian Ehringfeld
const Entity *entity);
66704054 Christian Ehringfeld
static const QHash<QString, QMetaProperty> getInheritedMetaProperties(
74d545d4 Christian Ehringfeld
const Entity *entity);
66704054 Christian Ehringfeld
static const QHash<Relation, QMetaProperty> getRelationProperties(
74d545d4 Christian Ehringfeld
const Entity *entity);
612083d3 Christian Ehringfeld
static Entity* copyObject(const Entity *entity);
46d2de48 Christian Ehringfeld
static Entity* getBaseClassObject(const QSharedPointer<Entity> &entity,
QString attributeName);
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,
74d545d4 Christian Ehringfeld
QSharedPointer<Entity> remove, const QMetaProperty &property);
4e75d5a1 Christian Ehringfeld
static void clearEntityListProperty(const QSharedPointer<Entity> &entity,
const QMetaProperty &property);
e8d1537c Christian Ehringfeld
static void setProperty(const QSharedPointer<Entity> &entity,
66704054 Christian Ehringfeld
QSharedPointer<Entity> value,
const QMetaProperty &property);
cbfd2b95 Christian Ehringfeld
static void setFoundProperty(const QSharedPointer<Entity> &entity,
QSharedPointer<Entity> value,
const QMetaProperty &property);
51f88a34 Christian Ehringfeld
static void setListProperty(const QSharedPointer<Entity> &entity,
74d545d4 Christian Ehringfeld
QList<QSharedPointer<Entity>> &value,
const QMetaProperty &property);
e8d1537c Christian Ehringfeld
static QMetaProperty mappedProperty(const Relation &r,
66704054 Christian Ehringfeld
const QSharedPointer<Entity> &foreignEntity);
67aa0d3f Christian Ehringfeld
static QHash<QString, QVariant> getEntityAttributes(const
74d545d4 Christian Ehringfeld
QHash<QString, QMetaProperty> &props,
const QSharedPointer<Entity> &entity);
static const QList<qint64> getIds(QList<QSharedPointer<Entity>> entities);
static const QVariant getIdsAsVariant(QList<QSharedPointer<Entity>> entities);
31565d02 Christian Ehringfeld
e8d1537c Christian Ehringfeld
};
}

#endif // ENTITYHELPER_H