KService

ksycocaentry.cpp
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
33{
34 return d_ptr->isType(t);
35}
36
38{
39 return d_ptr->sycocaType();
40}
41
43{
44 Q_D(const KSycocaEntry);
45 return d->path;
46}
47
49{
50 Q_D(const KSycocaEntry);
51 return d->storageId();
52}
53
55{
56 Q_D(const KSycocaEntry);
57 return d->deleted;
58}
59
60void KSycocaEntry::setDeleted(bool deleted)
61{
63 d->deleted = deleted;
64}
65
67{
68 return d_ptr == nullptr || isType(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
84{
85 Q_D(const KSycocaEntry);
86 return d && d->isValid();
87}
88
90{
91 Q_D(const KSycocaEntry);
92 return d->name();
93}
Base class for all Sycoca entries.
QString storageId() const
bool isValid() const
QString name() const
bool isDeleted() const
bool isSeparator() const
bool isType(KSycocaType t) const
Returns true if this sycoca entry is of the given type.
KSycocaType
A KSycocaType is a code (out of the KSycocaType enum) assigned to each class type derived from KSycoc...
Definition ksycocatype.h:19
QString entryPath() const
void setDeleted(bool deleted)
Sets whether or not this service is deleted.
KSycocaType sycocaType() const
internal
QString path(const QString &relativePath)
QIODevice * device() const const
virtual qint64 pos() const const
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:16:40 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.