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)
16  , deleted(false)
17 {
18  _str >> path;
19 }
20 
21 KSycocaEntry::KSycocaEntry()
22  : d_ptr(nullptr)
23 {
24 }
25 
26 KSycocaEntry::KSycocaEntry(KSycocaEntryPrivate &d)
27  : d_ptr(&d)
28 {
29 }
30 
31 KSycocaEntry::~KSycocaEntry() = default;
32 
34 {
35  return d_ptr->isType(t);
36 }
37 
39 {
40  return d_ptr->sycocaType();
41 }
42 
44 {
45  Q_D(const KSycocaEntry);
46  return d->path;
47 }
48 
50 {
51  Q_D(const KSycocaEntry);
52  return d->storageId();
53 }
54 
56 {
57  Q_D(const KSycocaEntry);
58  return d->deleted;
59 }
60 
61 void KSycocaEntry::setDeleted(bool deleted)
62 {
64  d->deleted = deleted;
65 }
66 
68 {
69  return d_ptr == nullptr || isType(KST_KServiceSeparator);
70 }
71 
72 int KSycocaEntry::offset() const
73 {
74  Q_D(const KSycocaEntry);
75  return d->offset;
76 }
77 
78 void KSycocaEntryPrivate::save(QDataStream &s)
79 {
80  offset = s.device()->pos(); // store position in member variable
81  s << qint32(sycocaType()) << path;
82 }
83 
85 {
86  Q_D(const KSycocaEntry);
87  return d && d->isValid();
88 }
89 
91 {
92  Q_D(const KSycocaEntry);
93  return d->name();
94 }
95 
97 {
98  Q_D(const KSycocaEntry);
99  return d->propertyNames();
100 }
101 
103 {
104  Q_D(const KSycocaEntry);
105  return d->property(name);
106 }
QString storageId() const
QVariant property(const QString &name) const
Returns the requested property.
void setDeleted(bool deleted)
Sets whether or not this service is deleted.
Base class for all Sycoca entries.
Definition: ksycocaentry.h:32
QString entryPath() const
QIODevice * device() const const
bool isValid() const
virtual qint64 pos() const const
KSycocaType sycocaType() const
internal
bool isType(KSycocaType t) const
Returns true if this sycoca entry is of the given type.
QString name() const
bool isSeparator() const
bool isDeleted() const
Q_D(Todo)
QStringList propertyNames() const
Returns the list of all properties that this service can have.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Feb 5 2023 04:01:05 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.