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

KDECore

  • sources
  • kde-4.14
  • kdelibs
  • kdecore
  • config
kconfigbackend.h
Go to the documentation of this file.
1 /*
2  This file is part of the KDE libraries
3  Copyright (c) 2006, 2007 Thomas Braxton <kde.braxton@gmail.com>
4  Copyright (c) 1999 Preston Brown <pbrown@kde.org>
5  Portions copyright (c) 1997 Matthias Kalle Dalheimer <kalle@kde.org>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 
23 #ifndef KCONFIGBACKEND_H
24 #define KCONFIGBACKEND_H
25 
26 #include <QtCore/QObject>
27 #include <QtCore/QString>
28 
29 #include <kdecore_export.h>
30 #include <kconfigbase.h>
31 #include <kdebug.h>
32 #ifndef KDE_NO_DEPRECATED
33 #include <kgenericfactory.h>
34 #endif
35 #include <klocale.h>
36 #include <kpluginfactory.h>
37 #include <kpluginloader.h>
38 #include <ksharedptr.h>
39 
40 class KEntryMap;
41 class KComponentData;
42 class QFile;
43 class QByteArray;
44 class QDateTime;
45 
55 class KDECORE_EXPORT KConfigBackend : public QObject, public KShared
56 {
57  Q_OBJECT
58  Q_FLAGS(ParseOption)
59  Q_FLAGS(WriteOption)
60 
61 public:
73  static KSharedPtr<KConfigBackend> create(const KComponentData& componentData,
74  const QString& fileName = QString(),
75  const QString& system = QString());
76 
87  static void registerMappings(const KEntryMap& entryMap);
88 
90  virtual ~KConfigBackend();
91 
93  enum ParseOption {
94  ParseGlobal = 1,
95  ParseDefaults = 2,
96  ParseExpansions = 4
97  };
99  Q_DECLARE_FLAGS(ParseOptions, ParseOption)
100 
101 
102  enum WriteOption {
103  WriteGlobal = 1
104  };
106  Q_DECLARE_FLAGS(WriteOptions, WriteOption)
107 
108 
109  enum ParseInfo {
110  ParseOk,
111  ParseImmutable,
112  ParseOpenError
113  };
114 
123  virtual ParseInfo parseConfig(const QByteArray& locale,
124  KEntryMap& pWriteBackMap,
125  ParseOptions options = ParseOptions()) = 0;
126 
137  virtual bool writeConfig(const QByteArray& locale, KEntryMap& entryMap,
138  WriteOptions options, const KComponentData &data) = 0;
139 
145  virtual bool isWritable() const = 0;
155  virtual QString nonWritableErrorMessage() const = 0;
161  virtual KConfigBase::AccessMode accessMode() const = 0;
168  virtual void createEnclosing() = 0;
169 
177  virtual void setFilePath(const QString& path) = 0;
178 
182  virtual bool lock(const KComponentData& componentData) = 0;
186  virtual void unlock() = 0;
190  virtual bool isLocked() const = 0;
191 
195  QDateTime lastModified() const;
197  QString filePath() const;
199  qint64 size() const;
200 
201 protected:
202  KConfigBackend();
203  void setLastModified(const QDateTime& dt);
204  void setSize(qint64 sz);
205  void setLocalFilePath(const QString& file);
206 
207 private:
208  class Private;
209  Private *const d;
210 };
211 
212 Q_DECLARE_OPERATORS_FOR_FLAGS(KConfigBackend::ParseOptions)
213 Q_DECLARE_OPERATORS_FOR_FLAGS(KConfigBackend::WriteOptions)
214 
218 #define K_EXPORT_KCONFIGBACKEND(libname, classname) \
219 K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
220 K_EXPORT_PLUGIN(factory("kconfigbackend_" #libname))
221 
222 
223 #endif // KCONFIGBACKEND_H
KSharedPtr< KConfigBackend >
ksharedptr.h
qint64
kdebug.h
KEntryMap
Definition: kconfigdata.h:152
kdecore_export.h
QByteArray
klocale.h
KConfigBackend::ParseOption
ParseOption
Allows the behaviour of parseConfig() to be tuned.
Definition: kconfigbackend.h:93
QFile
QSharedData
KConfigBackend::ParseInfo
ParseInfo
Return value from parseConfig()
Definition: kconfigbackend.h:109
QObject
kpluginloader.h
KConfigBackend::WriteOption
WriteOption
Allows the behaviour of writeConfig() to be tuned.
Definition: kconfigbackend.h:102
KConfigBackend
Provides the implementation for accessing configuration sources.
Definition: kconfigbackend.h:55
QString
KGlobal::locale
KLocale * locale()
Returns the global locale object.
Definition: kglobal.cpp:170
KConfigBackend::ParseImmutable
the configuration was opened read/write
Definition: kconfigbackend.h:111
KConfigBackend::ParseOk
Definition: kconfigbackend.h:110
kpluginfactory.h
KConfigBase::AccessMode
AccessMode
Possible return values for accessMode().
Definition: kconfigbase.h:133
kconfigbase.h
kgenericfactory.h
KComponentData
Per component data.
Definition: kcomponentdata.h:46
QDateTime
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • 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

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal