KDECore
kconfig_p.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 KCONFIG_P_H 00025 #define KCONFIG_P_H 00026 00027 #include "kconfigdata.h" 00028 #include <kglobal.h> 00029 #include "kconfigbackend.h" 00030 #include "kconfiggroup.h" 00031 #include "kcomponentdata.h" 00032 #include "kstandarddirs.h" 00033 #include "klocale.h" 00034 00035 #include <QtCore/QStringList> 00036 #include <QtCore/QStack> 00037 #include <QtCore/QFile> 00038 #include <QtCore/QDir> 00039 00040 #include <unistd.h> 00041 00042 class KConfigPrivate 00043 { 00044 friend class KConfig; 00045 public: 00046 KConfig::OpenFlags openFlags; 00047 const char* resourceType; 00048 00049 void changeFileName(const QString& fileName, const char* resourceType); 00050 00051 // functions for KConfigGroup 00052 bool canWriteEntry(const QByteArray& group, const char* key, bool isDefault=false) const; 00053 QString lookupData(const QByteArray& group, const char* key, KEntryMap::SearchFlags flags, 00054 bool* expand) const; 00055 QByteArray lookupData(const QByteArray& group, const char* key, KEntryMap::SearchFlags flags) const; 00056 00057 void putData(const QByteArray& group, const char* key, const QByteArray& value, 00058 KConfigBase::WriteConfigFlags flags, bool expand=false); 00059 QStringList groupList(const QByteArray& group) const; 00060 // copies the entries from @p source to @p otherGroup changing all occurrences 00061 // of @p source with @p destination 00062 void copyGroup(const QByteArray& source, const QByteArray& destination, 00063 KConfigGroup *otherGroup, KConfigBase::WriteConfigFlags flags) const; 00064 QStringList keyListImpl(const QByteArray& theGroup) const; 00065 QSet<QByteArray> allSubGroups(const QByteArray& parentGroup) const; 00066 bool hasNonDeletedEntries(const QByteArray& group) const; 00067 00068 protected: 00069 KSharedPtr<KConfigBackend> mBackend; 00070 00071 KConfigPrivate(const KComponentData &componentData_, KConfig::OpenFlags flags, 00072 const char* resource); 00073 00074 virtual ~KConfigPrivate() 00075 { 00076 } 00077 00078 bool bDynamicBackend:1; // do we own the backend? 00079 private: 00080 bool bDirty:1; 00081 bool bLocaleInitialized:1; 00082 bool bReadDefaults:1; 00083 bool bFileImmutable:1; 00084 bool bForceGlobal:1; 00085 bool bSuppressGlobal:1; 00086 00087 QString sGlobalFileName; 00088 static bool mappingsRegistered; 00089 00090 00091 KEntryMap entryMap; 00092 QString backendType; 00093 QStack<QString> extraFiles; 00094 00095 QString locale; 00096 QString fileName; 00097 QString etc_kderc; 00098 KComponentData componentData; 00099 KConfigBase::AccessMode configState; 00100 00101 bool wantGlobals() const { return openFlags&KConfig::IncludeGlobals && !bSuppressGlobal; } 00102 bool wantDefaults() const { return openFlags&KConfig::CascadeConfig; } 00103 bool isSimple() const { return openFlags == KConfig::SimpleConfig; } 00104 bool isReadOnly() const { return configState == KConfig::ReadOnly; } 00105 00106 bool setLocale(const QString& aLocale); 00107 QStringList getGlobalFiles() const; 00108 void parseGlobalFiles(); 00109 void parseConfigFiles(); 00110 void initCustomized(KConfig*); 00111 bool lockLocal(); 00112 }; 00113 00114 #endif // KCONFIG_P_H
KDE 4.6 API Reference