Revision e8d1537c
Von Christian Ehringfeld vor fast 9 Jahren hinzugefügt
src/cache.h | ||
---|---|---|
#include <QSharedPointer>
|
||
#include "entityinstancefactory.h"
|
||
#include "entity.h"
|
||
#include "entityhelper.h"
|
||
|
||
namespace CuteEntityManager {
|
||
class Entity;
|
||
... | ... | |
bool ok = false;
|
||
Entity *e = EntityInstanceFactory::createInstance<T>();
|
||
if (e) {
|
||
ok = this->contains(id, QString(e->getClassname()));
|
||
ok = this->contains(id, QString(EntityHelper::getClassname(e)));
|
||
delete e;
|
||
}
|
||
return ok;
|
||
... | ... | |
template<class T> void remove(qint64 id) {
|
||
Entity *e = EntityInstanceFactory::createInstance<T>();
|
||
if (e) {
|
||
this->remove(id, QString(e->getClassname()));
|
||
this->remove(id, QString(EntityHelper::getClassname(e)));
|
||
delete e;
|
||
}
|
||
}
|
||
... | ... | |
template<class T> QSharedPointer<Entity> get(qint64 id) {
|
||
Entity *e = EntityInstanceFactory::createInstance<T>();
|
||
if (e) {
|
||
return this->get(id, QString(e->getClassname()));
|
||
return this->get(id, QString(EntityHelper::getClassname(e)));
|
||
delete e;
|
||
}
|
||
return QSharedPointer<Entity>();
|
Auch abrufbar als: Unified diff
entityhelper class