Revision 72b5abad
Von Sebastian Diel vor mehr als 10 Jahren hinzugefügt
| src/cache.h | ||
|---|---|---|
|
class Entity;
|
||
|
class Cache {
|
||
|
public:
|
||
|
Cache();
|
||
|
QHash<QString, QWeakPointer<Entity> > getCache() const;
|
||
|
bool contains(qint64 id, const QString &classname);
|
||
|
bool contains(const QString &key);
|
||
|
template<class T> bool contains(qint64 id) {
|
||
|
Q_DECL_EXPORT Cache();
|
||
|
Q_DECL_EXPORT QHash<QString, QWeakPointer<Entity> > getCache() const;
|
||
|
Q_DECL_EXPORT bool contains(qint64 id, const QString &classname);
|
||
|
Q_DECL_EXPORT bool contains(const QString &key);
|
||
|
template<class T> Q_DECL_EXPORT bool contains(qint64 id) {
|
||
|
bool ok = false;
|
||
|
Entity *e = EntityInstanceFactory::createInstance<T>();
|
||
|
if (e) {
|
||
| ... | ... | |
|
}
|
||
|
return ok;
|
||
|
}
|
||
|
void insert(QSharedPointer<Entity> &entity);
|
||
|
void remove(const QSharedPointer<Entity> &entity);
|
||
|
void remove(const qint64 &id, const QString &classname);
|
||
|
template<class T> void remove(qint64 id) {
|
||
|
Q_DECL_EXPORT void insert(QSharedPointer<Entity> &entity);
|
||
|
Q_DECL_EXPORT void remove(const QSharedPointer<Entity> &entity);
|
||
|
Q_DECL_EXPORT void remove(const qint64 &id, const QString &classname);
|
||
|
template<class T> Q_DECL_EXPORT void remove(qint64 id) {
|
||
|
Entity *e = EntityInstanceFactory::createInstance<T>();
|
||
|
if (e) {
|
||
|
this->remove(id, QString(e->getClassname()));
|
||
| ... | ... | |
|
}
|
||
|
}
|
||
|
|
||
|
QSharedPointer<Entity> get(qint64 id, const QString &classname);
|
||
|
template<class T> QSharedPointer<Entity> get(qint64 id) {
|
||
|
Q_DECL_EXPORT QSharedPointer<Entity> get(qint64 id, const QString &classname);
|
||
|
template<class T> Q_DECL_EXPORT QSharedPointer<Entity> get(qint64 id) {
|
||
|
Entity *e = EntityInstanceFactory::createInstance<T>();
|
||
|
if (e) {
|
||
|
return this->get(id, QString(e->getClassname()));
|
||
Auch abrufbar als: Unified diff
Dead End? LNK2001 bei vielen obj.