]> cloud.milkyroute.net Git - dolphin.git/blob - src/kitemviews/private/kbaloorolesprovider.h
Add clang-format and format code as in Frameworks
[dolphin.git] / src / kitemviews / private / kbaloorolesprovider.h
1 /*
2 * SPDX-FileCopyrightText: 2012 Peter Penz <peter.penz19@gmail.com>
3 * SPDX-FileCopyrightText: 2013 Vishesh Handa <me@vhanda.in>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8 #ifndef KBALOO_ROLESPROVIDER_H
9 #define KBALOO_ROLESPROVIDER_H
10
11 #include "dolphin_export.h"
12
13 #include <QHash>
14 #include <QSet>
15 #include <QVariant>
16
17 namespace Baloo
18 {
19 class File;
20 }
21
22 /**
23 * @brief Allows accessing metadata of a file by providing KFileItemModel roles.
24 *
25 * Is a helper class for KFileItemModelRolesUpdater to retrieve roles that
26 * are only accessible with Baloo.
27 */
28 class DOLPHIN_EXPORT KBalooRolesProvider
29 {
30 public:
31 static KBalooRolesProvider &instance();
32 virtual ~KBalooRolesProvider();
33
34 /**
35 * @return Roles that can be provided by KBalooRolesProvider.
36 */
37 QSet<QByteArray> roles() const;
38
39 /**
40 * @return Values for the roles \a roles that can be determined from the file
41 * with the URL \a url.
42 */
43 QHash<QByteArray, QVariant> roleValues(const Baloo::File &file, const QSet<QByteArray> &roles) const;
44
45 protected:
46 KBalooRolesProvider();
47
48 private:
49 QSet<QByteArray> m_roles;
50
51 friend struct KBalooRolesProviderSingleton;
52 };
53
54 #endif