tuchulcha  0.10.1
Graphical Workflow Configuration Editor
QParameterFile.h
Go to the documentation of this file.
1 /* Copyright (C) 2011 Jens-Malte Gottfried
2 
3  This file is part of Tuchulcha.
4 
5  Tuchulcha is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  Tuchulcha 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
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with Tuchulcha. If not, see <http://www.gnu.org/licenses/>.
17 */
25 #ifndef QPARAMETERFILE_H
26 #define QPARAMETERFILE_H
27 
28 #include <QStringList>
29 #include <QHash>
30 
32 
39 public:
41  QParameterFile(QString fileName = "" );
42 
44 
49  void load(QString fileName, QString encoding=QString());
51  void save(QString fileName) const;
53  QStringList toStringList() const;
54 
56  bool isSet(QString parameter) const;
57 
61  // \{
63 
66  void set(QString parameter, QString value = "");
68 
70  QString get(QString parameter) const;
71 
73 
76  QStringList getKeyList(QString beginsWith = "") const;
77  // \}
78 
80  void erase(QString parameter);
81 
83  void clear();
84 
86 
102  bool rename(QString oldPrefix, QString newPrefix);
103 
105  static const QRegExp prefixCheck;
107  static const QRegExp postfixCheck;
109  static const QRegExp paramCheck;
111  static const QRegExp paramCheckSloppy;
112 
113 private:
115  QStringList _keys;
117  QHash<QString,QString> _content;
118 };
119 
120 #endif // QPARAMETERFILE_H
QParameterFile(QString fileName="")
default constructor
QStringList _keys
key array, stored in mixed case
bool isSet(QString parameter) const
check if a given parameter has been set
static const QRegExp paramCheckSloppy
full parameter name check (sloppy version, may handle buggy lines)
void load(QString fileName, QString encoding=QString())
load parameter file
void set(QString parameter, QString value="")
set parameter value
Qt implementation for ParameterFile class.
QHash< QString, QString > _content
value hash table, keys are stored in lowercase
void erase(QString parameter)
remove parameter from file
bool rename(QString oldPrefix, QString newPrefix)
rename prefix
static const QRegExp paramCheck
full parameter name check
void save(QString fileName) const
save to given plain text file
static const QRegExp postfixCheck
postfix check, everything that may follow a prefix (starting with ".")
QStringList getKeyList(QString beginsWith="") const
Look for parameters beginning with a given string.
QStringList toStringList() const
get StringList representation, like file content after save()
void clear()
clear content
static const QRegExp prefixCheck
instance name or prefix check regex