• 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
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 
30 class KConfigIniBackend : public KConfigBackend
31 {
32 private:
33  KLockFile::Ptr lockFile;
34 public:
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 
59 protected:
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
KSharedPtr< KLockFile >
KConfigIniBackend::parseConfig
ParseInfo parseConfig(const QByteArray &locale, KEntryMap &entryMap, ParseOptions options)
Read persistent storage.
Definition: kconfigini.cpp:68
KEntryMap
Definition: kconfigdata.h:152
KConfigIniBackend::BufferFragment
Definition: bufferfragment_p.h:36
kdecore_export.h
QByteArray
KConfigIniBackend::accessMode
KConfigBase::AccessMode accessMode() const
Definition: kconfigini.cpp:580
KConfigIniBackend::KConfigIniBackend
KConfigIniBackend()
Definition: kconfigini.cpp:58
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::writeEntries
void writeEntries(const QByteArray &locale, QFile &file, const KEntryMap &map)
Definition: kconfigini.cpp:369
KConfigIniBackend::stringToPrintable
static QByteArray stringToPrintable(const QByteArray &aString, StringType type)
Definition: kconfigini.cpp:615
QFile
klockfile.h
KConfigIniBackend::ValueString
Definition: kconfigini_p.h:64
kconfigbackend.h
KConfigIniBackend::lock
bool lock(const KComponentData &componentData)
Lock the file.
Definition: kconfigini.cpp:591
KConfigBackend::ParseInfo
ParseInfo
Return value from parseConfig()
Definition: kconfigbackend.h:109
KConfigIniBackend::KeyString
Definition: kconfigini_p.h:63
KConfigIniBackend::warningProlog
static QString warningProlog(const QFile &file, int line)
Definition: kconfigini.cpp:52
KConfigIniBackend::charFromHex
static char charFromHex(const char *str, const QFile &file, int line)
Definition: kconfigini.cpp:697
KConfigBackend
Provides the implementation for accessing configuration sources.
Definition: kconfigbackend.h:55
QString
KConfigIniBackend::unlock
void unlock()
Release the lock on the file.
Definition: kconfigini.cpp:604
KConfigIniBackend::~KConfigIniBackend
~KConfigIniBackend()
Definition: kconfigini.cpp:63
KConfigIniBackend::setFilePath
void setFilePath(const QString &path)
Set the file path.
Definition: kconfigini.cpp:559
KGlobal::locale
KLocale * locale()
Returns the global locale object.
Definition: kglobal.cpp:170
KConfigIniBackend::printableToString
static void printableToString(BufferFragment *aString, const QFile &file, int line)
Definition: kconfigini.cpp:721
KConfigIniBackend::isLocked
bool isLocked() const
Definition: kconfigini.cpp:610
KConfigIniBackend::GroupString
Definition: kconfigini_p.h:62
KConfigBase::AccessMode
AccessMode
Possible return values for accessMode().
Definition: kconfigbase.h:133
KConfigIniBackend::createEnclosing
void createEnclosing()
Create the enclosing object of the configuration object.
Definition: kconfigini.cpp:548
KConfigIniBackend::StringType
StringType
Definition: kconfigini_p.h:61
KConfigIniBackend::isWritable
bool isWritable() const
If isWritable() returns false, writeConfig() will always fail.
Definition: kconfigini.cpp:516
KComponentData
Per component data.
Definition: kcomponentdata.h:46
KConfigIniBackend
Definition: kconfigini_p.h:30
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
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