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#include "ksycocaentry.h"
9#include "ksycocaentry_p.h"
10#include <QIODevice>
11#include <ksycoca.h>
12
13KSycocaEntryPrivate::KSycocaEntryPrivate(QDataStream &_str, int iOffset)
14 : offset(iOffset)
15 , deleted(false)
16{
17 _str >> path;
18}
19
20KSycocaEntry::KSycocaEntry()
21 : d_ptr(nullptr)
22{
23}
24
25KSycocaEntry::KSycocaEntry(KSycocaEntryPrivate &d)
26 : d_ptr(&d)
27{
28}
29
30KSycocaEntry::~KSycocaEntry() = default;
31
32bool KSycocaEntry::isType(KSycocaType t) const
33{
34 return d_ptr->isType(t);
35}
36
37KSycocaType KSycocaEntry::sycocaType() const
38{
39 return d_ptr->sycocaType();
40}
41
42QString KSycocaEntry::entryPath() const
43{
44 Q_D(const KSycocaEntry);
45 return d->path;
46}
47
48QString KSycocaEntry::storageId() const
49{
50 Q_D(const KSycocaEntry);
51 return d->storageId();
52}
53
54bool KSycocaEntry::isDeleted() const
55{
56 Q_D(const KSycocaEntry);
57 return d->deleted;
58}
59
60void KSycocaEntry::setDeleted(bool deleted)
61{
62 Q_D(KSycocaEntry);
63 d->deleted = deleted;
64}
65
66bool KSycocaEntry::isSeparator() const
67{
68 return d_ptr == nullptr || isType(t: KST_KServiceSeparator);
69}
70
71int KSycocaEntry::offset() const
72{
73 Q_D(const KSycocaEntry);
74 return d->offset;
75}
76
77void KSycocaEntryPrivate::save(QDataStream &s)
78{
79 offset = s.device()->pos(); // store position in member variable
80 s << qint32(sycocaType()) << path;
81}
82
83bool KSycocaEntry::isValid() const
84{
85 Q_D(const KSycocaEntry);
86 return d && d->isValid();
87}
88
89QString KSycocaEntry::name() const
90{
91 Q_D(const KSycocaEntry);
92 return d->name();
93}
94

source code of kservice/src/sycoca/ksycocaentry.cpp