KDECore
kconfigbase.h
Go to the documentation of this file.
00001 /* 00002 This file is part of the KDE libraries 00003 Copyright (c) 2006, 2007 Thomas Braxton <kde.braxton@gmail.com> 00004 Copyright (c) 2001 Waldo Bastian <bastian@kde.org> 00005 Copyright (c) 1999 Preston Brown <pbrown@kde.org> 00006 Copyright (c) 1997 Matthias Kalle Dalheimer <kalle@kde.org> 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Library General Public 00010 License as published by the Free Software Foundation; either 00011 version 2 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Library General Public License for more details. 00017 00018 You should have received a copy of the GNU Library General Public License 00019 along with this library; see the file COPYING.LIB. If not, write to 00020 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00021 Boston, MA 02110-1301, USA. 00022 */ 00023 00024 #ifndef KCONFIGBASE_H 00025 #define KCONFIGBASE_H 00026 00027 #include <kdecore_export.h> 00028 00029 #include <QtCore/QtGlobal> 00030 00031 class QStringList; 00032 class KConfigGroup; 00033 class KConfigBasePrivate; 00034 00038 class KDECORE_EXPORT KConfigBase 00039 { 00040 public: 00044 enum WriteConfigFlag 00045 { 00046 Persistent = 0x01, 00050 Global = 0x02, 00055 Localized = 0x04, 00059 Normal=Persistent 00065 }; 00066 Q_DECLARE_FLAGS(WriteConfigFlags, WriteConfigFlag) 00067 00068 00071 virtual ~KConfigBase(); 00072 00078 virtual QStringList groupList() const = 0; 00079 00086 bool hasGroup(const QString &group) const; 00087 bool hasGroup(const char *group) const; 00088 bool hasGroup(const QByteArray &group) const; 00089 00097 KConfigGroup group(const QByteArray &group); 00098 KConfigGroup group(const QString &group); 00099 KConfigGroup group(const char *group); 00100 00104 const KConfigGroup group(const QByteArray &group) const; 00105 const KConfigGroup group(const QString &group) const; 00106 const KConfigGroup group(const char *group) const; 00107 00112 void deleteGroup(const QByteArray &group, WriteConfigFlags flags = Normal); 00113 void deleteGroup(const QString &group, WriteConfigFlags flags = Normal); 00114 void deleteGroup(const char *group, WriteConfigFlags flags = Normal); 00115 00122 virtual void sync() = 0; 00123 00128 virtual void markAsClean() = 0; 00129 00133 enum AccessMode { NoAccess, ReadOnly, ReadWrite }; 00134 00147 virtual AccessMode accessMode() const = 0; 00148 00153 virtual bool isImmutable() const = 0; 00154 00161 bool isGroupImmutable(const QByteArray& aGroup) const; 00162 bool isGroupImmutable(const QString& aGroup) const; 00163 bool isGroupImmutable(const char *aGroup) const; 00164 00165 protected: 00166 KConfigBase(); 00167 00168 virtual bool hasGroupImpl(const QByteArray &group) const = 0; 00169 virtual KConfigGroup groupImpl( const QByteArray &b) = 0; 00170 virtual const KConfigGroup groupImpl(const QByteArray &b) const = 0; 00171 virtual void deleteGroupImpl(const QByteArray &group, WriteConfigFlags flags = Normal) = 0; 00172 virtual bool isGroupImmutableImpl(const QByteArray& aGroup) const = 0; 00173 00177 virtual void virtual_hook( int id, void* data ); 00178 }; 00179 00180 Q_DECLARE_OPERATORS_FOR_FLAGS(KConfigBase::WriteConfigFlags) 00181 00182 00183 00184 #endif // KCONFIG_H
KDE 4.6 API Reference