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

KDECore

  • kdecore
  • config
kconfigini_p.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 KCONFIGINI_P_H
24#define KCONFIGINI_P_H
25
26#include <kdecore_export.h>
27#include <kconfigbackend.h>
28#include <klockfile.h>
29
30class KConfigIniBackend : public KConfigBackend
31{
32private:
33 KLockFile::Ptr lockFile;
34public:
35 class BufferFragment;
36
37 KConfigIniBackend();
38 ~KConfigIniBackend();
39
40 ParseInfo parseConfig(const QByteArray& locale,
41 KEntryMap& entryMap,
42 ParseOptions options);
43 ParseInfo parseConfig(const QByteArray& locale,
44 KEntryMap& entryMap,
45 ParseOptions options,
46 bool merging);
47 bool writeConfig(const QByteArray& locale, KEntryMap& entryMap,
48 WriteOptions options, const KComponentData &data);
49
50 bool isWritable() const;
51 QString nonWritableErrorMessage() const;
52 KConfigBase::AccessMode accessMode() const;
53 void createEnclosing();
54 void setFilePath(const QString& path);
55 bool lock(const KComponentData& componentData);
56 void unlock();
57 bool isLocked() const;
58
59protected:
60
61 enum StringType {
62 GroupString = 0,
63 KeyString = 1,
64 ValueString = 2
65 };
66 // Warning: this modifies data in-place. Other BufferFragment objects referencing the same buffer
67 // fragment will get their data modified too.
68 static void printableToString(BufferFragment* aString, const QFile& file, int line);
69 static QByteArray stringToPrintable(const QByteArray& aString, StringType type);
70 static char charFromHex(const char *str, const QFile& file, int line);
71 static QString warningProlog(const QFile& file, int line);
72
73 void writeEntries(const QByteArray& locale, QFile& file, const KEntryMap& map);
74 void writeEntries(const QByteArray& locale, QFile& file, const KEntryMap& map,
75 bool defaultGroup, bool &firstEntry);
76};
77
78#endif // KCONFIGINI_P_H
KComponentData
Per component data.
Definition: kcomponentdata.h:47
KConfigBackend
Provides the implementation for accessing configuration sources.
Definition: kconfigbackend.h:56
KConfigBackend::ParseInfo
ParseInfo
Return value from parseConfig()
Definition: kconfigbackend.h:109
KConfigBase::AccessMode
AccessMode
Possible return values for accessMode().
Definition: kconfigbase.h:133
KConfigIniBackend::BufferFragment
Definition: bufferfragment_p.h:37
KConfigIniBackend
Definition: kconfigini_p.h:31
KConfigIniBackend::printableToString
static void printableToString(BufferFragment *aString, const QFile &file, int line)
Definition: kconfigini.cpp:721
KConfigIniBackend::writeEntries
void writeEntries(const QByteArray &locale, QFile &file, const KEntryMap &map)
Definition: kconfigini.cpp:369
KConfigIniBackend::charFromHex
static char charFromHex(const char *str, const QFile &file, int line)
Definition: kconfigini.cpp:697
KConfigIniBackend::parseConfig
ParseInfo parseConfig(const QByteArray &locale, KEntryMap &entryMap, ParseOptions options)
Read persistent storage.
Definition: kconfigini.cpp:68
KConfigIniBackend::StringType
StringType
Definition: kconfigini_p.h:61
KConfigIniBackend::ValueString
@ ValueString
Definition: kconfigini_p.h:64
KConfigIniBackend::KeyString
@ KeyString
Definition: kconfigini_p.h:63
KConfigIniBackend::GroupString
@ GroupString
Definition: kconfigini_p.h:62
KConfigIniBackend::KConfigIniBackend
KConfigIniBackend()
Definition: kconfigini.cpp:58
KConfigIniBackend::setFilePath
void setFilePath(const QString &path)
Set the file path.
Definition: kconfigini.cpp:559
KConfigIniBackend::createEnclosing
void createEnclosing()
Create the enclosing object of the configuration object.
Definition: kconfigini.cpp:548
KConfigIniBackend::isLocked
bool isLocked() const
Definition: kconfigini.cpp:610
KConfigIniBackend::nonWritableErrorMessage
QString nonWritableErrorMessage() const
When isWritable() returns false, return an error message to explain to the user why saving configurat...
Definition: kconfigini.cpp:543
KConfigIniBackend::isWritable
bool isWritable() const
If isWritable() returns false, writeConfig() will always fail.
Definition: kconfigini.cpp:516
KConfigIniBackend::~KConfigIniBackend
~KConfigIniBackend()
Definition: kconfigini.cpp:63
KConfigIniBackend::writeConfig
bool writeConfig(const QByteArray &locale, KEntryMap &entryMap, WriteOptions options, const KComponentData &data)
Write the dirty entries to permanent storage.
Definition: kconfigini.cpp:380
KConfigIniBackend::stringToPrintable
static QByteArray stringToPrintable(const QByteArray &aString, StringType type)
Definition: kconfigini.cpp:615
KConfigIniBackend::accessMode
KConfigBase::AccessMode accessMode() const
Definition: kconfigini.cpp:580
KConfigIniBackend::warningProlog
static QString warningProlog(const QFile &file, int line)
Definition: kconfigini.cpp:52
KConfigIniBackend::lock
bool lock(const KComponentData &componentData)
Lock the file.
Definition: kconfigini.cpp:591
KConfigIniBackend::unlock
void unlock()
Release the lock on the file.
Definition: kconfigini.cpp:604
KEntryMap
type specifying a map of entries (key,value pairs).
Definition: kconfigdata.h:153
KSharedPtr< KLockFile >
QString
kconfigbackend.h
kdecore_export.h
klockfile.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
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