File indexing completed on 2024-10-06 12:24:01
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 1999 Waldo Bastian <bastian@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-only 0006 */ 0007 0008 #ifndef KSYCOCAENTRYPRIVATE_H 0009 #define KSYCOCAENTRYPRIVATE_H 0010 0011 #include "ksycocaentry.h" 0012 0013 // clang-format off 0014 #define K_SYCOCATYPE( type, baseclass ) \ 0015 bool isType(KSycocaType t) const override { if (t == type) return true; return baseclass::isType(t);} \ 0016 KSycocaType sycocaType() const override { return type; } 0017 // clang-format on 0018 0019 class KSycocaEntryPrivate 0020 { 0021 public: 0022 explicit KSycocaEntryPrivate(const QString &path_) 0023 : offset(0) 0024 , deleted(false) 0025 , path(path_) 0026 { 0027 } 0028 0029 KSycocaEntryPrivate(QDataStream &_str, int iOffset); 0030 0031 virtual ~KSycocaEntryPrivate() 0032 { 0033 } 0034 0035 // Don't forget to call the parent class 0036 // first if you override this function. 0037 virtual void save(QDataStream &s); 0038 0039 virtual bool isType(KSycocaType t) const 0040 { 0041 return (t == KST_KSycocaEntry); 0042 } 0043 0044 virtual KSycocaType sycocaType() const 0045 { 0046 return KST_KSycocaEntry; 0047 } 0048 0049 virtual bool isValid() const 0050 { 0051 return !name().isEmpty(); 0052 } 0053 0054 virtual QVariant property(const QString &name) const 0055 { 0056 Q_UNUSED(name) 0057 return QVariant(); 0058 } 0059 0060 virtual QStringList propertyNames() const 0061 { 0062 return QStringList(); 0063 } 0064 0065 virtual QString name() const = 0; 0066 0067 virtual QString storageId() const 0068 { 0069 return name(); 0070 } 0071 0072 int offset; 0073 bool deleted; 0074 QString path; 0075 }; 0076 0077 #endif