• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • 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 <kgenericfactory.h>
00032 #include <ksharedptr.h>
00033 
00034 class KEntryMap;
00035 class KComponentData;
00036 class QFile;
00037 class QByteArray;
00038 class QDateTime;
00039 
00043 class KDECORE_EXPORT KConfigBackend : public QObject, public KShared
00044 {
00045     Q_OBJECT
00046     Q_FLAGS(ParseOption)
00047     Q_FLAGS(WriteOption)
00048 
00049 public:
00056     static KSharedPtr<KConfigBackend> create(const KComponentData& componentData,
00057                                              const QString& fileName = QString(),
00058                                              const QString& system = QString());
00059 
00063     static void registerMappings(const KEntryMap& entryMap);
00064 
00066     virtual ~KConfigBackend();
00067 
00069     enum ParseOption {
00070         ParseGlobal = 1, 
00071         ParseDefaults = 2, 
00072         ParseExpansions = 4 
00073     };
00075     Q_DECLARE_FLAGS(ParseOptions, ParseOption)
00076 
00077     
00078     enum WriteOption {
00079         WriteGlobal = 1 
00080     };
00082     Q_DECLARE_FLAGS(WriteOptions, WriteOption)
00083 
00084     
00085     enum ParseInfo {
00086         ParseOk, 
00087         ParseImmutable, 
00088         ParseOpenError 
00089     };
00090 
00097     virtual ParseInfo parseConfig(const QByteArray& locale,
00098                                   KEntryMap& pWriteBackMap,
00099                                   ParseOptions options = ParseOptions()) = 0;
00100 
00106     virtual bool writeConfig(const QByteArray& locale, KEntryMap& entryMap,
00107                              WriteOptions options, const KComponentData &data) = 0;
00108 
00113     virtual bool isWritable() const = 0;
00118     virtual QString nonWritableErrorMessage() const = 0;
00123     virtual KConfigBase::AccessMode accessMode() const = 0;
00128     virtual void createEnclosing() = 0;
00129 
00135     virtual void setFilePath(const QString& path) = 0;
00136 
00140     virtual bool lock(const KComponentData& componentData) = 0;
00141     virtual void unlock() = 0;
00142     virtual bool isLocked() const = 0;
00143 
00147     QDateTime lastModified() const;
00149     QString filePath() const;
00151     qint64 size() const;
00152 
00153 protected:
00154     KConfigBackend();
00155     void setLastModified(const QDateTime& dt);
00156     void setSize(qint64 sz);
00157     void setLocalFilePath(const QString& file);
00158 
00159 private:
00160     class Private;
00161     Private *const d;
00162 };
00163 
00164 Q_DECLARE_OPERATORS_FOR_FLAGS(KConfigBackend::ParseOptions)
00165 Q_DECLARE_OPERATORS_FOR_FLAGS(KConfigBackend::WriteOptions)
00166 
00170 #define K_EXPORT_KCONFIGBACKEND(libname, classname) \
00171 K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
00172 K_EXPORT_PLUGIN(factory("kconfigbackend_" #libname))
00173 
00174 
00175 #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
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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