Akonadi
12#include "private/tristate_p.h"
16#include <QReadWriteLock>
26class CollectionTreeCache :
public AkThread
35 explicit Node(
const Collection &query);
39 void appendChild(Node *child);
40 void removeChild(Node *child);
42 Node *parent =
nullptr;
43 QList<Node *> children;
44 QAtomicInt lruCounter;
47 Collection collection;
51 explicit CollectionTreeCache();
52 ~CollectionTreeCache()
override;
55 retrieveCollections(
const Scope &scope,
int depth,
int ancestorDepth,
const QString &resource = QString(), CommandContext *context =
nullptr)
const;
58 void collectionAdded(
const Collection &col);
59 void collectionChanged(
const Collection &col);
60 void collectionMoved(
const Collection &col);
61 void collectionRemoved(
const Collection &col);
67 Node *findNode(
const QString &rid,
const QString &resource)
const;
69 template<
typename Predicate>
70 Node *findNode(Node *root, Predicate pred)
const;
72 QList<Collection> retrieveCollections(Node *root,
int depth,
int ancestorDepth)
const;
75 mutable QReadWriteLock mLock;
77 Node *mRoot =
nullptr;
79 QHash<qint64 , Node *> mNodeLookup;
83template<
typename Predicate>
84CollectionTreeCache::Node *CollectionTreeCache::findNode(Node *root, Predicate pred)
const
86 QList<Node *> toVisit = {root};
89 toVisit.
reserve(mNodeLookup.size() / 4);
96 for (
auto child : std::as_const(node->children)) {
Helper integration between Akonadi and Qt.
bool isEmpty() const const
void prepend(parameter_type value)
void reserve(qsizetype size)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:49:57 by
doxygen 1.13.2 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.