1 | /* |
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 1999 Waldo Bastian <bastian@kde.org> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-only |
6 | */ |
7 | |
8 | #ifndef KSYCOCAENTRYPRIVATE_H |
9 | #define KSYCOCAENTRYPRIVATE_H |
10 | |
11 | #include "ksycocaentry.h" |
12 | |
13 | // clang-format off |
14 | #define K_SYCOCATYPE( type, baseclass ) \ |
15 | bool isType(KSycocaType t) const override { if (t == type) return true; return baseclass::isType(t);} \ |
16 | KSycocaType sycocaType() const override { return type; } |
17 | // clang-format on |
18 | |
19 | class KSycocaEntryPrivate |
20 | { |
21 | public: |
22 | explicit KSycocaEntryPrivate(const QString &path_) |
23 | : offset(0) |
24 | , deleted(false) |
25 | , path(path_) |
26 | { |
27 | } |
28 | |
29 | KSycocaEntryPrivate(QDataStream &_str, int iOffset); |
30 | |
31 | virtual ~KSycocaEntryPrivate() |
32 | { |
33 | } |
34 | |
35 | // Don't forget to call the parent class |
36 | // first if you override this function. |
37 | virtual void save(QDataStream &s); |
38 | |
39 | virtual bool isType(KSycocaType t) const |
40 | { |
41 | return (t == KST_KSycocaEntry); |
42 | } |
43 | |
44 | virtual KSycocaType sycocaType() const |
45 | { |
46 | return KST_KSycocaEntry; |
47 | } |
48 | |
49 | virtual bool isValid() const |
50 | { |
51 | return !name().isEmpty(); |
52 | } |
53 | |
54 | virtual QString name() const = 0; |
55 | |
56 | virtual QString storageId() const |
57 | { |
58 | return name(); |
59 | } |
60 | |
61 | int offset; |
62 | bool deleted; |
63 | QString path; |
64 | }; |
65 | |
66 | #endif |
67 | |