• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

KDECore

kconfigbackend.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 KCONFIGBACKEND_H
00024 #define KCONFIGBACKEND_H
00025 
00026 #include <QtCore/QObject>
00027 #include <QtCore/QString>
00028 
00029 #include <kdecore_export.h>
00030 #include <kconfigbase.h>
00031 #include <kdebug.h>
00032 #ifndef KDE_NO_DEPRECATED
00033 #include <kgenericfactory.h>
00034 #endif
00035 #include <klocale.h>
00036 #include <kpluginfactory.h>
00037 #include <kpluginloader.h>
00038 #include <ksharedptr.h>
00039 
00040 class KEntryMap;
00041 class KComponentData;
00042 class QFile;
00043 class QByteArray;
00044 class QDateTime;
00045 
00055 class KDECORE_EXPORT KConfigBackend : public QObject, public KShared
00056 {
00057     Q_OBJECT
00058     Q_FLAGS(ParseOption)
00059     Q_FLAGS(WriteOption)
00060 
00061 public:
00073     static KSharedPtr<KConfigBackend> create(const KComponentData& componentData,
00074                                              const QString& fileName = QString(),
00075                                              const QString& system = QString());
00076 
00087     static void registerMappings(const KEntryMap& entryMap);
00088 
00090     virtual ~KConfigBackend();
00091 
00093     enum ParseOption {
00094         ParseGlobal = 1, 
00095         ParseDefaults = 2, 
00096         ParseExpansions = 4 
00097     };
00099     Q_DECLARE_FLAGS(ParseOptions, ParseOption)
00100 
00101     
00102     enum WriteOption {
00103         WriteGlobal = 1 
00104     };
00106     Q_DECLARE_FLAGS(WriteOptions, WriteOption)
00107 
00108     
00109     enum ParseInfo {
00110         ParseOk, 
00111         ParseImmutable, 
00112         ParseOpenError 
00113     };
00114 
00123     virtual ParseInfo parseConfig(const QByteArray& locale,
00124                                   KEntryMap& pWriteBackMap,
00125                                   ParseOptions options = ParseOptions()) = 0;
00126 
00137     virtual bool writeConfig(const QByteArray& locale, KEntryMap& entryMap,
00138                              WriteOptions options, const KComponentData &data) = 0;
00139 
00145     virtual bool isWritable() const = 0;
00155     virtual QString nonWritableErrorMessage() const = 0;
00161     virtual KConfigBase::AccessMode accessMode() const = 0;
00168     virtual void createEnclosing() = 0;
00169 
00177     virtual void setFilePath(const QString& path) = 0;
00178 
00182     virtual bool lock(const KComponentData& componentData) = 0;
00186     virtual void unlock() = 0;
00190     virtual bool isLocked() const = 0;
00191 
00195     QDateTime lastModified() const;
00197     QString filePath() const;
00199     qint64 size() const;
00200 
00201 protected:
00202     KConfigBackend();
00203     void setLastModified(const QDateTime& dt);
00204     void setSize(qint64 sz);
00205     void setLocalFilePath(const QString& file);
00206 
00207 private:
00208     class Private;
00209     Private *const d;
00210 };
00211 
00212 Q_DECLARE_OPERATORS_FOR_FLAGS(KConfigBackend::ParseOptions)
00213 Q_DECLARE_OPERATORS_FOR_FLAGS(KConfigBackend::WriteOptions)
00214 
00218 #define K_EXPORT_KCONFIGBACKEND(libname, classname) \
00219 K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
00220 K_EXPORT_PLUGIN(factory("kconfigbackend_" #libname))
00221 
00222 
00223 #endif // KCONFIGBACKEND_H

KDECore

Skip menu "KDECore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal