KDECore
kconfigini_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) 1999 Preston Brown <pbrown@kde.org> 00005 Portions copyright (c) 1997 Matthias Kalle Dalheimer <kalle@kde.org> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef KCONFIGINI_P_H 00024 #define KCONFIGINI_P_H 00025 00026 #include <kdecore_export.h> 00027 #include <kconfigbackend.h> 00028 #include <klockfile.h> 00029 00030 class KConfigIniBackend : public KConfigBackend 00031 { 00032 private: 00033 class BufferFragment; 00034 00035 KLockFile::Ptr lockFile; 00036 public: 00037 00038 KConfigIniBackend(); 00039 ~KConfigIniBackend(); 00040 00041 ParseInfo parseConfig(const QByteArray& locale, 00042 KEntryMap& entryMap, 00043 ParseOptions options); 00044 ParseInfo parseConfig(const QByteArray& locale, 00045 KEntryMap& entryMap, 00046 ParseOptions options, 00047 bool merging); 00048 bool writeConfig(const QByteArray& locale, KEntryMap& entryMap, 00049 WriteOptions options, const KComponentData &data); 00050 00051 bool isWritable() const; 00052 QString nonWritableErrorMessage() const; 00053 KConfigBase::AccessMode accessMode() const; 00054 void createEnclosing(); 00055 void setFilePath(const QString& path); 00056 bool lock(const KComponentData& componentData); 00057 void unlock(); 00058 bool isLocked() const; 00059 00060 protected: 00061 00062 enum StringType { 00063 GroupString = 0, 00064 KeyString = 1, 00065 ValueString = 2 00066 }; 00067 // Warning: this modifies data in-place. Other BufferFragment objects referencing the same buffer 00068 // fragment will get their data modified too. 00069 static void printableToString(BufferFragment* aString, const QFile& file, int line); 00070 static QByteArray stringToPrintable(const QByteArray& aString, StringType type); 00071 static char charFromHex(const char *str, const QFile& file, int line); 00072 static QString warningProlog(const QFile& file, int line); 00073 00074 void writeEntries(const QByteArray& locale, QFile& file, const KEntryMap& map); 00075 void writeEntries(const QByteArray& locale, QFile& file, const KEntryMap& map, 00076 bool defaultGroup, bool &firstEntry); 00077 }; 00078 00079 #endif // KCONFIGINI_P_H
KDE 4.6 API Reference