KDECore
KConfigBackend Class Reference
Provides the implementation for accessing configuration sources. More...
#include <KConfigBackend>

Public Types | |
enum | ParseInfo { ParseOk, ParseImmutable, ParseOpenError } |
enum | ParseOption { ParseGlobal = 1, ParseDefaults = 2, ParseExpansions = 4 } |
enum | WriteOption { WriteGlobal = 1 } |
Public Member Functions | |
virtual KConfigBase::AccessMode | accessMode () const =0 |
virtual void | createEnclosing ()=0 |
QString | filePath () const |
virtual bool | isLocked () const =0 |
virtual bool | isWritable () const =0 |
QDateTime | lastModified () const |
virtual bool | lock (const KComponentData &componentData)=0 |
virtual QString | nonWritableErrorMessage () const =0 |
virtual ParseInfo | parseConfig (const QByteArray &locale, KEntryMap &pWriteBackMap, ParseOptions options=ParseOptions())=0 |
virtual void | setFilePath (const QString &path)=0 |
qint64 | size () const |
virtual void | unlock ()=0 |
virtual bool | writeConfig (const QByteArray &locale, KEntryMap &entryMap, WriteOptions options, const KComponentData &data)=0 |
virtual | ~KConfigBackend () |
Static Public Member Functions | |
static KSharedPtr< KConfigBackend > | create (const KComponentData &componentData, const QString &fileName=QString(), const QString &system=QString()) |
static void | registerMappings (const KEntryMap &entryMap) |
Protected Member Functions | |
KConfigBackend () | |
void | setLastModified (const QDateTime &dt) |
void | setLocalFilePath (const QString &file) |
void | setSize (qint64 sz) |
Detailed Description
Provides the implementation for accessing configuration sources.KDELibs only provides an INI backend, but this class can be used to create plugins that allow access to other file formats and configuration systems.
Definition at line 49 of file kconfigbackend.h.
Member Enumeration Documentation
Return value from parseConfig().
- Enumerator:
-
ParseOk ParseImmutable the configuration was opened read/write ParseOpenError the configuration is immutable the configuration could not be opened
Definition at line 103 of file kconfigbackend.h.
Allows the behaviour of parseConfig() to be tuned.
- Enumerator:
-
ParseGlobal ParseDefaults entries should be marked as global ParseExpansions entries should be marked as default
Definition at line 87 of file kconfigbackend.h.
Constructor & Destructor Documentation
KConfigBackend::~KConfigBackend | ( | ) | [virtual] |
KConfigBackend::KConfigBackend | ( | ) | [protected] |
Definition at line 93 of file kconfigbackend.cpp.
Member Function Documentation
virtual KConfigBase::AccessMode KConfigBackend::accessMode | ( | ) | const [pure virtual] |
BackendPtr KConfigBackend::create | ( | const KComponentData & | componentData, | |
const QString & | fileName = QString() , |
|||
const QString & | system = QString() | |||
) | [static] |
Creates a new KConfig backend.
If no system
is given, or the given system
is unknown, this method tries to determine the correct backend to use.
- Parameters:
-
componentData the owning component fileName the absolute file name of the configuration file system the configuration system to use
- Returns:
- a KConfigBackend object to be used with KConfig
Definition at line 64 of file kconfigbackend.cpp.
virtual void KConfigBackend::createEnclosing | ( | ) | [pure virtual] |
Create the enclosing object of the configuration object.
For example, if the configuration object is a file, this should create the parent directory.
QString KConfigBackend::filePath | ( | ) | const |
virtual bool KConfigBackend::isLocked | ( | ) | const [pure virtual] |
- Returns:
true
if the file is locked,false
if it is not locked
virtual bool KConfigBackend::isWritable | ( | ) | const [pure virtual] |
If isWritable() returns false, writeConfig() will always fail.
- Returns:
true
if the configuration is writable,false
if it is immutable
QDateTime KConfigBackend::lastModified | ( | ) | const |
- Returns:
- the date and time when the object was last modified
Definition at line 103 of file kconfigbackend.cpp.
virtual bool KConfigBackend::lock | ( | const KComponentData & | componentData | ) | [pure virtual] |
Lock the file.
virtual QString KConfigBackend::nonWritableErrorMessage | ( | ) | const [pure virtual] |
When isWritable() returns false
, return an error message to explain to the user why saving configuration will not work.
The return value when isWritable() returns true
is undefined.
- Returns:
- a translated user-visible explanation for the configuration object not being writable
virtual ParseInfo KConfigBackend::parseConfig | ( | const QByteArray & | locale, | |
KEntryMap & | pWriteBackMap, | |||
ParseOptions | options = ParseOptions() | |||
) | [pure virtual] |
void KConfigBackend::registerMappings | ( | const KEntryMap & | entryMap | ) | [static] |
Registers mappings from directories/files to configuration systems.
Allows you to tell KConfigBackend that create() should use a particular backend for a particular file or directory.
- Warning:
- currently does nothing
- Parameters:
-
entryMap the KEntryMap to build the mappings from
Definition at line 60 of file kconfigbackend.cpp.
virtual void KConfigBackend::setFilePath | ( | const QString & | path | ) | [pure virtual] |
Set the file path.
- Note:
path
MUST be absolute.
- Parameters:
-
path the absolute file path
void KConfigBackend::setLastModified | ( | const QDateTime & | dt | ) | [protected] |
Definition at line 108 of file kconfigbackend.cpp.
void KConfigBackend::setLocalFilePath | ( | const QString & | file | ) | [protected] |
Definition at line 128 of file kconfigbackend.cpp.
void KConfigBackend::setSize | ( | qint64 | sz | ) | [protected] |
Definition at line 118 of file kconfigbackend.cpp.
qint64 KConfigBackend::size | ( | ) | const |
virtual void KConfigBackend::unlock | ( | ) | [pure virtual] |
Release the lock on the file.
virtual bool KConfigBackend::writeConfig | ( | const QByteArray & | locale, | |
KEntryMap & | entryMap, | |||
WriteOptions | options, | |||
const KComponentData & | data | |||
) | [pure virtual] |
Write the dirty entries to permanent storage.
- Parameters:
-
locale the locale to write entries for (if the backend supports localized entries) entryMap the KEntryMap containing the config object's entries. options
- See also:
- WriteOptions
- Parameters:
-
data the component that requested the write
- Returns:
true
if the write was successful,false
if writing the configuration failed
The documentation for this class was generated from the following files: