OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
inisettings.hpp
Go to the documentation of this file.
1 #ifndef INISETTINGS_HPP
2 #define INISETTINGS_HPP
3 
4 #include <QHash>
5 #include <QVariant>
6 
7 class QTextStream;
8 
9 namespace Wizard
10 {
11 
12  typedef QHash<QString, QVariant> SettingsMap;
13 
15  {
16  public:
17  explicit IniSettings();
18  ~IniSettings();
19 
20  inline QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const
21  {
22  return mSettings.value(key, defaultValue);
23  }
24 
25  inline QList<QVariant> values() const
26  {
27  return mSettings.values();
28  }
29 
30  inline void setValue(const QString &key, const QVariant &value)
31  {
32  mSettings.insert(key, value);
33  }
34 
35  inline void remove(const QString &key)
36  {
37  mSettings.remove(key);
38  }
39 
40  QStringList findKeys(const QString &text);
41 
42  bool readFile(QTextStream &stream);
43  bool writeFile(const QString &path, QTextStream &stream);
44 
45  bool parseInx(const QString &path);
46 
47  private:
48 
49  int getLastNewline(const QString &buffer, int from);
50 
52  };
53 
54 }
55 
56 #endif // INISETTINGS_HPP
~IniSettings()
Definition: inisettings.cpp:16
bool writeFile(const QString &path, QTextStream &stream)
Definition: inisettings.cpp:75
QHash< QString, QVariant > SettingsMap
Definition: inisettings.hpp:12
void setValue(const QString &key, const QVariant &value)
Definition: inisettings.hpp:30
Definition: inisettings.hpp:14
int getLastNewline(const QString &buffer, int from)
SettingsMap mSettings
Definition: inisettings.hpp:51
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
Definition: inisettings.hpp:20
QList< QVariant > values() const
Definition: inisettings.hpp:25
QStringList findKeys(const QString &text)
Definition: inisettings.cpp:20
bool parseInx(const QString &path)
Definition: inisettings.cpp:169
bool readFile(QTextStream &stream)
Definition: inisettings.cpp:34
IniSettings()
Definition: inisettings.cpp:12