inisection.h
1 //------------------------------------------------------------------------------
2 // inisection.h
3 //------------------------------------------------------------------------------
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301 USA
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2009 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 #ifndef __INISECTION_H__
24 #define __INISECTION_H__
25 
26 #include <QVariant>
27 #include <QVector>
28 #include "dptr.h"
29 #include "global.h"
30 
31 class Ini;
32 class IniVariable;
33 
40 class MAIN_EXPORT IniSection
41 {
42  public:
47  IniSection();
48 
61  IniSection(Ini* pIni, const QString& sectionName);
62 
63  virtual ~IniSection();
64 
85  IniVariable createSetting(const QString& name, const QVariant& data);
86 
94  void deleteSetting(const QString& name);
95 
102  bool hasSetting(const QString &name) const;
103 
108  bool isNull() const;
109 
113  const QString &name() const;
114 
124  IniVariable retrieveSetting(const QString& name);
125 
129  const IniVariable retrieveSetting(const QString& name) const;
130 
140  IniVariable setting(const QString& name);
141 
151  void setValue(const QString& key, const QVariant& value);
152 
156  IniVariable operator[](const QString& name);
157 
161  const IniVariable operator[](const QString& name) const;
162 
169  QVariant value(const QString& key) const;
170 
179  QVariant value(const QString& key, QVariant defaultValue) const;
180 
181  private:
183 
187  void remove(const QString& key);
188 };
189 
190 #endif
INI variable representation.
Definition: inivariable.h:41
Configuration handler.
Definition: ini.h:69
INI section representation.
Definition: inisection.h:40