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

kcachegrind

  • sources
  • kde-4.12
  • kdesdk
  • kcachegrind
  • libcore
config.h
Go to the documentation of this file.
1 /* This file is part of KCachegrind.
2  Copyright (C) 2008 Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
3 
4  KCachegrind is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public
6  License as published by the Free Software Foundation, version 2.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; see the file COPYING. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 
19 #ifndef CONFIG_H
20 #define CONFIG_H
21 
22 #include <QString>
23 #include <QVariant>
24 
25 class ConfigStorage;
26 
27 // helper functions for storing specific values
28 QList<int> toIntList(QStringList l);
29 QStringList toStringList(QList<int> l);
30 
35 class ConfigGroup
36 {
37  friend class ConfigStorage;
38 
39 public:
40  virtual ~ConfigGroup();
41 
42  // when value is defaultValue, any previous stored value is removed
43  virtual void setValue(const QString& key, const QVariant& value,
44  const QVariant& defaultValue = QVariant());
45  virtual QVariant value(const QString & key,
46  const QVariant& defaultValue) const;
47 
48  // the template version is needed for GUI Qt types
49  template<typename T>
50  inline T value(const QString & key,
51  const QVariant & defaultValue = QVariant()) const
52  { return qvariant_cast<T>( value(key, defaultValue) ); }
53 
54 protected:
55  ConfigGroup();
56 };
57 
63 class ConfigStorage
64 {
65 public:
66  ConfigStorage();
67  virtual ~ConfigStorage();
68 
69  // if second parameter is not-empty, first search for an existing
70  // group using the optional suffix, and then without.
71  // the group gets readonly.
72  static ConfigGroup* group(const QString& group,
73  const QString& optSuffix = QString());
74  static void setStorage(ConfigStorage*);
75  static void cleanup();
76 
77 protected:
78  virtual ConfigGroup* getGroup(const QString& group,
79  const QString& optSuffix);
80 
81  static ConfigStorage* _storage;
82 };
83 
84 
85 #endif // CONFIG_H
ConfigStorage::~ConfigStorage
virtual ~ConfigStorage()
Definition: config.cpp:77
ConfigStorage::setStorage
static void setStorage(ConfigStorage *)
Definition: config.cpp:88
ConfigStorage::ConfigStorage
ConfigStorage()
Definition: config.cpp:72
ConfigStorage::_storage
static ConfigStorage * _storage
Definition: config.h:81
ConfigGroup::ConfigGroup
ConfigGroup()
Definition: config.cpp:51
ConfigGroup::value
T value(const QString &key, const QVariant &defaultValue=QVariant()) const
Definition: config.h:50
ConfigGroup::setValue
virtual void setValue(const QString &key, const QVariant &value, const QVariant &defaultValue=QVariant())
Definition: config.cpp:57
ConfigStorage::group
static ConfigGroup * group(const QString &group, const QString &optSuffix=QString())
Definition: config.cpp:80
ConfigStorage::getGroup
virtual ConfigGroup * getGroup(const QString &group, const QString &optSuffix)
Definition: config.cpp:98
ConfigGroup::~ConfigGroup
virtual ~ConfigGroup()
Definition: config.cpp:54
ConfigStorage
This is an adapter class for different configuration backends.
Definition: config.h:63
ConfigGroup
A group of configuration settings.
Definition: config.h:35
toStringList
QStringList toStringList(QList< int > l)
Definition: config.cpp:36
toIntList
QList< int > toIntList(QStringList l)
Definition: config.cpp:26
QList
ConfigGroup::value
virtual QVariant value(const QString &key, const QVariant &defaultValue) const
Definition: config.cpp:60
ConfigStorage::cleanup
static void cleanup()
Definition: config.cpp:93
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:03:26 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kcachegrind

Skip menu "kcachegrind"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

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