KService

ksycocaentry.cpp
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 1999 Waldo Bastian <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-only
6 */
7 
8 #include "ksycocaentry.h"
9 #include "ksycocaentry_p.h"
10 #include "ksycocautils_p.h"
11 
12 #include <ksycoca.h>
13 
14 KSycocaEntryPrivate::KSycocaEntryPrivate(QDataStream &_str, int iOffset)
15  : offset(iOffset), deleted(false)
16 {
17  _str >> path;
18 }
19 
20 KSycocaEntry::KSycocaEntry()
21  : d_ptr(nullptr)
22 {
23 }
24 
25 KSycocaEntry::KSycocaEntry(KSycocaEntryPrivate &d)
26  : d_ptr(&d)
27 {
28 }
29 
30 KSycocaEntry::~KSycocaEntry()
31 {
32  delete d_ptr;
33 }
34 
36 {
37  return d_ptr->isType(t);
38 }
39 
41 {
42  return d_ptr->sycocaType();
43 }
44 
46 {
47  Q_D(const KSycocaEntry);
48  return d->path;
49 }
50 
52 {
53  Q_D(const KSycocaEntry);
54  return d->storageId();
55 }
56 
58 {
59  Q_D(const KSycocaEntry);
60  return d->deleted;
61 }
62 
63 void KSycocaEntry::setDeleted(bool deleted)
64 {
65  Q_D(KSycocaEntry);
66  d->deleted = deleted;
67 }
68 
70 {
71  return d_ptr == nullptr || isType(KST_KServiceSeparator);
72 }
73 
74 int KSycocaEntry::offset() const
75 {
76  Q_D(const KSycocaEntry);
77  return d->offset;
78 }
79 
80 void KSycocaEntryPrivate::save(QDataStream &s)
81 {
82  offset = s.device()->pos(); // store position in member variable
83  s << qint32(sycocaType()) << path;
84 }
85 
87 {
88  Q_D(const KSycocaEntry);
89  return d && d->isValid();
90 }
91 
93 {
94  Q_D(const KSycocaEntry);
95  return d->name();
96 }
97 
99 {
100  Q_D(const KSycocaEntry);
101  return d->propertyNames();
102 }
103 
105 {
106  Q_D(const KSycocaEntry);
107  return d->property(name);
108 }
bool isType(KSycocaType t) const
Returns true if this sycoca entry is of the given type.
bool isSeparator() const
KSycocaType sycocaType() const
internal
virtual qint64 pos() const const
QStringList propertyNames() const
Returns the list of all properties that this service can have.
bool isValid() const
QString entryPath() const
Base class for all Sycoca entries.
Definition: ksycocaentry.h:30
void setDeleted(bool deleted)
Sets whether or not this service is deleted.
QString storageId() const
bool isDeleted() const
QIODevice * device() const const
QVariant property(const QString &name) const
Returns the requested property.
QString name() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Jan 14 2021 22:49:18 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.