File indexing completed on 2024-04-21 03:56:54

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 QString name() const = 0;
0055 
0056     virtual QString storageId() const
0057     {
0058         return name();
0059     }
0060 
0061     int offset;
0062     bool deleted;
0063     QString path;
0064 };
0065 
0066 #endif