ksycocaentry.h
/* This file is part of the KDE libraries
* Copyright (C) 1999 Waldo Bastian <bastian@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation;
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#ifndef __ksycocaentry_h__
#define __ksycocaentry_h__
#include "ksycocatype.h"
#include <qstringlist.h>
#include <ksharedptr.h>
class QDataStream;
class KDECORE_EXPORT KSycocaEntry : public KShared
{
public:
virtual bool isType(KSycocaType t) const { return (t == KST_KSycocaEntry); }
virtual KSycocaType sycocaType() const { return KST_KSycocaEntry; }
public:
typedef KSharedPtr<KSycocaEntry> Ptr;
typedef QValueList<Ptr> List;
public: // KDoc seems to barf on those typedefs and generates no docs after them
KSycocaEntry(const QString &path) : mOffset(0), m_bDeleted(false), mPath(path) { }
static void read( QDataStream &s, QString &str );
static void read( QDataStream &s, QStringList &list );
KSycocaEntry( QDataStream &_str, int offset ) :
mOffset( offset ), m_bDeleted(false)
{
read(_str, mPath);
}
virtual QString name() const = 0;
QString entryPath() const { return mPath; }
virtual bool isValid() const = 0;
virtual bool isDeleted() const { return m_bDeleted; }
int offset() { return mOffset; }
virtual void save(QDataStream &s)
{
mOffset = s.device()->at(); // store position in member variable
s << (Q_INT32) sycocaType() << mPath;
}
virtual void load(QDataStream &) = 0;
private:
int mOffset;
protected:
bool m_bDeleted;
QString mPath;
protected:
virtual void virtual_hook( int id, void* data );
};
#endif
KSharedPtr
Can be used to control the lifetime of an object that has derived KShared.
Definition: ksharedptr.h:100
KSycocaEntry::KSycocaEntry
KSycocaEntry(const QString &path)
Default constructor.
Definition: ksycocaentry.h:51
KSycocaEntry::KSycocaType
KSycocaType
Definition: ksycocatype.h:31
KSycocaEntry::entryPath
QString entryPath() const
Definition: ksycocaentry.h:79
KSycocaEntry
Base class for all Sycoca entries.
Definition: ksycocaentry.h:37
KStdAction::name
const char * name(StdAction id)
KSycocaEntry::isDeleted
virtual bool isDeleted() const
Definition: ksycocaentry.h:89
KStdAction::save
KAction * save(const QObject *recvr, const char *slot, KActionCollection *parent, const char *name=0)
KShared
Reference counting for shared objects.
Definition: ksharedptr.h:40

KDE Home | KDE Accessibility Home | Description of Access Keys