Changeset View
Changeset View
Standalone View
Standalone View
src/engine/databasesanitizer.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * This file is part of the KDE Baloo project. | ||||
3 | * Copyright 2018 Michael Heidelbach <ottwolt@gmail.com> | ||||
4 | * | ||||
5 | * This program is free software; you can redistribute it and/or | ||||
6 | * modify it under the terms of the GNU General Public License as | ||||
7 | * published by the Free Software Foundation; either version 2 of | ||||
8 | * the License or (at your option) version 3 or any later version | ||||
9 | * accepted by the membership of KDE e.V. (or its successor approved | ||||
10 | * by the membership of KDE e.V.), which shall act as a proxy | ||||
11 | * defined in Section 14 of version 3 of the license. | ||||
12 | * | ||||
13 | * This program is distributed in the hope that it will be useful, | ||||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
16 | * GNU General Public License for more details. | ||||
17 | * | ||||
18 | * You should have received a copy of the GNU General Public License | ||||
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
20 | */ | ||||
21 | | ||||
22 | #ifndef BALOODATABASESANITIZER_H | ||||
23 | #define BALOODATABASESANITIZER_H | ||||
24 | | ||||
25 | #include "transaction.h" | ||||
26 | class DatabaseSanitizerImpl; | ||||
27 | | ||||
28 | namespace Baloo | ||||
29 | { | ||||
30 | /** | ||||
31 | * \brief Provide methods to show database problems and | ||||
32 | * sanitize them. | ||||
33 | */ | ||||
34 | class BALOO_ENGINE_EXPORT DatabaseSanitizer | ||||
35 | { | ||||
36 | public: | ||||
37 | DatabaseSanitizer(const Database& db, Transaction::TransactionType type); | ||||
38 | DatabaseSanitizer(Database* db, Transaction::TransactionType type); | ||||
39 | ~DatabaseSanitizer(); | ||||
40 | | ||||
41 | /** | ||||
42 | * Print database content to stdout | ||||
43 | * | ||||
44 | * \p deviceIDs filter by device ids. Negative numbers list everything but... | ||||
45 | * with empty \p deviceIDs(default) everything is printed. | ||||
46 | * | ||||
47 | * \p missingOnly Simulate purging operation. Only inaccessible items are printed. | ||||
48 | * | ||||
49 | * \p urlFilter Filter result urls. Default is null = Print everything. | ||||
50 | */ | ||||
51 | void printList(const QVector<qint64>& deviceIds, | ||||
52 | const bool missingOnly, | ||||
53 | const QSharedPointer<QRegularExpression>& urlFilter | ||||
54 | ); | ||||
55 | /** | ||||
56 | * Print info about known devices to stdout | ||||
57 | * | ||||
58 | * \p deviceIDs filter by device ids. Negative numbers list everything but... | ||||
59 | * with empty \p deviceIDs(default) everything is printed. | ||||
60 | * | ||||
61 | * \p missingOnly Only inaccessible items are printed. | ||||
62 | */ | ||||
63 | void printDevices(const QVector<qint64>& deviceIds, const bool missingOnly = false); | ||||
64 | | ||||
65 | /** | ||||
66 | * Internal use only. | ||||
67 | * TODO: Hide this | ||||
68 | */ | ||||
69 | DocumentUrlDB getDocuments(Transaction* txn); | ||||
70 | | ||||
71 | private: | ||||
72 | DatabaseSanitizer(const DatabaseSanitizer& rhs) = delete; | ||||
73 | DatabaseSanitizerImpl* m_pimpl; | ||||
74 | }; | ||||
75 | | ||||
76 | } | ||||
77 | #endif // BALOODATABASESANITIZER_H |