COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
coConfigValue.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 #ifndef COCONFIGVALUE_H
9 #define COCONFIGVALUE_H
10 
11 #include <QString>
12 #include <util/coTypes.h>
13 
14 namespace covise
15 {
16 
17 class coConfigGroup;
18 
19 template <class T>
21 {
22 
23 public:
24  coConfigValue(const QString &configGroupName, const QString &variable, const QString &section);
25  coConfigValue(const QString &variable, const QString &section);
26  coConfigValue(const QString &simpleVariable);
28  const QString &variable, const QString &section);
30  const QString &simpleVariable);
32 
33  virtual ~coConfigValue();
34 
35  virtual void update();
36  virtual bool hasValidValue();
37  virtual bool hasValidValue() const;
38 
39  coConfigValue<T> &operator=(const T &);
40  virtual operator T();
41 
42  virtual bool operator==(const coConfigValue<T> &);
43  virtual bool operator!=(const coConfigValue<T> &);
44 
45  virtual void setSaveToGroup(coConfigGroup *group);
46  virtual coConfigGroup *getSaveToGroup() const;
47 
48  virtual void setAutoUpdate(bool update);
49  virtual bool isAutoUpdate() const;
50 
51  virtual bool isModified() const;
52 
53 protected:
54  virtual T fromString(const QString &value) const = 0;
55  virtual QString toString(const T &value) const = 0;
56 
57  QString variable;
58  QString section;
59  QString value;
60  QString unmodifiedValue;
61  QString configGroupName;
62 
63  bool autoUpdate;
64  bool modified;
65 
68 
69 #ifdef COCONFIGVALUE_USE_CACHE
70  T cache;
71 #endif
72 };
73 }
74 //#include "coConfigValue.inl"
75 #endif
bool modified
Definition: coConfigValue.h:64
virtual bool hasValidValue()
bool autoUpdate
Definition: coConfigValue.h:63
coConfigValue(const QString &configGroupName, const QString &variable, const QString &section)
virtual QString toString(const T &value) const =0
Definition: coConfigGroup.h:25
QString configGroupName
Definition: coConfigValue.h:61
coConfigGroup * saveToGroup
Definition: coConfigValue.h:67
virtual void setAutoUpdate(bool update)
virtual void update()
Definition: coConfigValue.h:20
coConfigValue< T > & operator=(const T &)
QString variable
Definition: coConfigValue.h:57
virtual coConfigGroup * getSaveToGroup() const
virtual bool operator==(const coConfigValue< T > &)
QString section
Definition: coConfigValue.h:58
QString value
Definition: coConfigValue.h:59
virtual T fromString(const QString &value) const =0
GLboolean GLuint group
Definition: khronos-glext.h:12389
GLenum GLenum variable
Definition: khronos-glext.h:9990
coConfigGroup * group
Definition: coConfigValue.h:66
virtual bool isAutoUpdate() const
virtual bool isModified() const
GLsizei const GLfloat * value
Definition: khronos-glext.h:6760
virtual void setSaveToGroup(coConfigGroup *group)
virtual bool operator!=(const coConfigValue< T > &)
QString unmodifiedValue
Definition: coConfigValue.h:60