KService

ksycocaentry.cpp
1 /* This file is part of the KDE libraries
2  * Copyright (C) 1999 Waldo Bastian <[email protected]>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License version 2 as published by the Free Software Foundation;
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Library General Public License for more details.
12  *
13  * You should have received a copy of the GNU Library General Public License
14  * along with this library; see the file COPYING.LIB. If not, write to
15  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  * Boston, MA 02110-1301, USA.
17  **/
18 
19 #include "ksycocaentry.h"
20 #include "ksycocaentry_p.h"
21 #include "ksycocautils_p.h"
22 
23 #include <ksycoca.h>
24 
25 KSycocaEntryPrivate::KSycocaEntryPrivate(QDataStream &_str, int iOffset)
26  : offset(iOffset), deleted(false)
27 {
28  _str >> path;
29 }
30 
31 KSycocaEntry::KSycocaEntry()
32  : d_ptr(nullptr)
33 {
34 }
35 
36 KSycocaEntry::KSycocaEntry(KSycocaEntryPrivate &d)
37  : d_ptr(&d)
38 {
39 }
40 
41 KSycocaEntry::~KSycocaEntry()
42 {
43  delete d_ptr;
44 }
45 
47 {
48  return d_ptr->isType(t);
49 }
50 
52 {
53  return d_ptr->sycocaType();
54 }
55 
57 {
58  Q_D(const KSycocaEntry);
59  return d->path;
60 }
61 
63 {
64  Q_D(const KSycocaEntry);
65  return d->storageId();
66 }
67 
69 {
70  Q_D(const KSycocaEntry);
71  return d->deleted;
72 }
73 
74 void KSycocaEntry::setDeleted(bool deleted)
75 {
76  Q_D(KSycocaEntry);
77  d->deleted = deleted;
78 }
79 
81 {
82  return d_ptr == nullptr || isType(KST_KServiceSeparator);
83 }
84 
85 int KSycocaEntry::offset() const
86 {
87  Q_D(const KSycocaEntry);
88  return d->offset;
89 }
90 
91 void KSycocaEntryPrivate::save(QDataStream &s)
92 {
93  offset = s.device()->pos(); // store position in member variable
94  s << qint32(sycocaType()) << path;
95 }
96 
98 {
99  Q_D(const KSycocaEntry);
100  return d && d->isValid();
101 }
102 
104 {
105  Q_D(const KSycocaEntry);
106  return d->name();
107 }
108 
110 {
111  Q_D(const KSycocaEntry);
112  return d->propertyNames();
113 }
114 
116 {
117  Q_D(const KSycocaEntry);
118  return d->property(name);
119 }
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:41
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-2020 The KDE developers.
Generated on Wed Aug 5 2020 22:45:46 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.