Baloo

documenturldb.h
1/*
2 This file is part of the KDE Baloo project.
3 SPDX-FileCopyrightText: 2015 Vishesh Handa <vhanda@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.1-or-later
6*/
7
8#ifndef BALOO_DOCUMENTURLDB_H
9#define BALOO_DOCUMENTURLDB_H
10
11#include "idtreedb.h"
12#include "idfilenamedb.h"
13#include "idutils.h"
14
15#include <QDebug>
16#include <QFile>
17
18namespace Baloo {
19
20class PostingIterator;
21
22class BALOO_ENGINE_EXPORT DocumentUrlDB
23{
24public:
25 explicit DocumentUrlDB(MDB_dbi idTreeDb, MDB_dbi idFileNameDb, MDB_txn* txn);
26 ~DocumentUrlDB();
27
28 /**
29 * Returns true if added
30 */
31 bool put(quint64 docId, quint64 parentId, const QByteArray& fileName);
32 bool addPath(const QByteArray& url);
33
34 QByteArray get(quint64 docId) const;
35 QVector<quint64> getChildren(quint64 docId) const;
36 bool contains(quint64 docId) const;
37
38 /**
39 * Move the document \p id to directory \p newParentId, set its name
40 * to \p newName.
41 */
42 void updateUrl(quint64 id, quint64 newParentId, const QByteArray& newName);
43
44 void del(quint64 docId);
45
46 quint64 getId(quint64 docId, const QByteArray& fileName) const;
47
48 PostingIterator* iter(quint64 docId) {
49 IdTreeDB db(m_idTreeDbi, m_txn);
50 return db.iter(docId);
51 }
52
53 QMap<quint64, QByteArray> toTestMap() const;
54
55private:
56 BALOO_ENGINE_NO_EXPORT void add(quint64 id, quint64 parentId, const QByteArray& name);
57
58 MDB_txn* m_txn;
59 MDB_dbi m_idFilenameDbi;
60 MDB_dbi m_idTreeDbi;
61
62};
63
64}
65
66#endif // BALOO_DOCUMENTURLDB_H
Implements storage for docIds without any associated data Instantiated for:
Definition coding.cpp:11
KIOCORE_EXPORT TransferJob * get(const QUrl &url, LoadType reload=NoReload, JobFlags flags=DefaultFlags)
KIOCORE_EXPORT TransferJob * put(const QUrl &url, int permissions, JobFlags flags=DefaultFlags)
KGuiItem add()
KGuiItem del()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:58 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.