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

KDECore

  • sources
  • kde-4.12
  • 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  class BufferFragment;
34 
35  KLockFile::Ptr lockFile;
36 public:
37 
38  KConfigIniBackend();
39  ~KConfigIniBackend();
40 
41  ParseInfo parseConfig(const QByteArray& locale,
42  KEntryMap& entryMap,
43  ParseOptions options);
44  ParseInfo parseConfig(const QByteArray& locale,
45  KEntryMap& entryMap,
46  ParseOptions options,
47  bool merging);
48  bool writeConfig(const QByteArray& locale, KEntryMap& entryMap,
49  WriteOptions options, const KComponentData &data);
50 
51  bool isWritable() const;
52  QString nonWritableErrorMessage() const;
53  KConfigBase::AccessMode accessMode() const;
54  void createEnclosing();
55  void setFilePath(const QString& path);
56  bool lock(const KComponentData& componentData);
57  void unlock();
58  bool isLocked() const;
59 
60 protected:
61 
62  enum StringType {
63  GroupString = 0,
64  KeyString = 1,
65  ValueString = 2
66  };
67  // Warning: this modifies data in-place. Other BufferFragment objects referencing the same buffer
68  // fragment will get their data modified too.
69  static void printableToString(BufferFragment* aString, const QFile& file, int line);
70  static QByteArray stringToPrintable(const QByteArray& aString, StringType type);
71  static char charFromHex(const char *str, const QFile& file, int line);
72  static QString warningProlog(const QFile& file, int line);
73 
74  void writeEntries(const QByteArray& locale, QFile& file, const KEntryMap& map);
75  void writeEntries(const QByteArray& locale, QFile& file, const KEntryMap& map,
76  bool defaultGroup, bool &firstEntry);
77 };
78 
79 #endif // KCONFIGINI_P_H
KSharedPtr< KLockFile >
KConfigIniBackend::parseConfig
ParseInfo parseConfig(const QByteArray &locale, KEntryMap &entryMap, ParseOptions options)
Read persistent storage.
Definition: kconfigini.cpp:59
KEntryMap
Definition: kconfigdata.h:152
KConfigIniBackend::BufferFragment
Definition: bufferfragment_p.h:36
kdecore_export.h
KConfigIniBackend::accessMode
KConfigBase::AccessMode accessMode() const
Definition: kconfigini.cpp:563
KConfigIniBackend::KConfigIniBackend
KConfigIniBackend()
Definition: kconfigini.cpp:49
KConfigIniBackend::nonWritableErrorMessage
QString nonWritableErrorMessage() const
When isWritable() returns false, return an error message to explain to the user why saving configurat...
Definition: kconfigini.cpp:526
KConfigIniBackend::writeEntries
void writeEntries(const QByteArray &locale, QFile &file, const KEntryMap &map)
Definition: kconfigini.cpp:352
KConfigIniBackend::stringToPrintable
static QByteArray stringToPrintable(const QByteArray &aString, StringType type)
Definition: kconfigini.cpp:598
QString
klockfile.h
KConfigIniBackend::ValueString
Definition: kconfigini_p.h:65
kconfigbackend.h
KConfigIniBackend::lock
bool lock(const KComponentData &componentData)
Lock the file.
Definition: kconfigini.cpp:574
KConfigBackend::ParseInfo
ParseInfo
Return value from parseConfig()
Definition: kconfigbackend.h:109
KConfigIniBackend::KeyString
Definition: kconfigini_p.h:64
KConfigIniBackend::warningProlog
static QString warningProlog(const QFile &file, int line)
Definition: kconfigini.cpp:43
KConfigIniBackend::charFromHex
static char charFromHex(const char *str, const QFile &file, int line)
Definition: kconfigini.cpp:680
KConfigBackend
Provides the implementation for accessing configuration sources.
Definition: kconfigbackend.h:55
KConfigIniBackend::unlock
void unlock()
Release the lock on the file.
Definition: kconfigini.cpp:587
KConfigIniBackend::~KConfigIniBackend
~KConfigIniBackend()
Definition: kconfigini.cpp:54
KConfigIniBackend::setFilePath
void setFilePath(const QString &path)
Set the file path.
Definition: kconfigini.cpp:542
KGlobal::locale
KLocale * locale()
Returns the global locale object.
Definition: kglobal.cpp:169
KConfigIniBackend::printableToString
static void printableToString(BufferFragment *aString, const QFile &file, int line)
Definition: kconfigini.cpp:704
KConfigIniBackend::isLocked
bool isLocked() const
Definition: kconfigini.cpp:593
KConfigIniBackend::GroupString
Definition: kconfigini_p.h:63
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:531
KConfigIniBackend::StringType
StringType
Definition: kconfigini_p.h:62
KConfigIniBackend::isWritable
bool isWritable() const
If isWritable() returns false, writeConfig() will always fail.
Definition: kconfigini.cpp:499
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:363
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:47:08 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • 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