COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
coConfigEntry.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 COCONFIGENTRY_H
9 #define COCONFIGENTRY_H
10 
11 #include "coConfigConstants.h"
12 #include "coConfigEntryString.h"
13 #include "coConfigEntryPtrList.h"
14 #include "coConfigSchemaInfos.h"
15 
16 #include <QHash>
17 #include <QObject>
18 #include <QString>
19 #include <QRegExp>
20 #include <QList>
21 
22 #include <util/coTypes.h>
23 
25 
26 #ifndef CO_gcc3
27 EXPORT_TEMPLATE2(template class CONFIGEXPORT QHash<QString, QString *>)
28 #endif
29 
30 namespace covise
31 {
32 
33 class CONFIGEXPORT coConfigEntry : public Subject<coConfigEntry>
34 {
35  friend class coConfigXercesEntry;
36 
37 public:
38  coConfigEntry();
39  virtual ~coConfigEntry();
40 
41  coConfigEntryStringList getScopeList(QString scope);
42  coConfigEntryStringList getVariableList(QString scope);
43 
44  coConfigEntryString getValue(const QString &variable, QString scope);
45  //coConfigEntryStringList getValues(const QString & variable, QString scope);
46 
47  const char *getEntry(const char *variable);
48 
49  bool setValue(const QString &variable, const QString &value,
50  const QString &section);
51  void addValue(const QString &variable, const QString &value,
52  const QString &section);
53 
54  bool deleteValue(const QString &variable, const QString &section);
55  bool deleteSection(const QString &section);
56 
57  bool hasValues() const;
58 
59  const QString &getPath() const;
60  QString getName() const;
61  const char *getCName() const;
62  const QString &getConfigName() const;
63 
64  bool isList() const;
65  bool hasChildren() const;
66 
67  void setReadOnly(bool ro);
68  bool isReadOnly() const;
69 
70  static QString &cleanName(QString &name);
71 
72  coConfigSchemaInfos *getSchemaInfos();
73  void setSchemaInfos(coConfigSchemaInfos *infos);
74 
75  void entryChanged();
76 
77  virtual void merge(const coConfigEntry *with);
78  virtual coConfigEntry *clone() const = 0;
79 
80 protected:
81  coConfigEntry(const coConfigEntry *entry);
82 
83  void setPath(const QString &path);
84  void makeSection(const QString &section);
85 
86 private:
87  bool matchingAttributes() const;
88  bool matchingArch() const;
89  bool matchingRank() const;
90 
92  QString configName;
93  QString path;
94 
95  bool isListNode;
96  bool readOnly;
97 
99  QHash<QString, QString *> attributes;
100  QStringList textNodes;
101 
103  QString elementGroup;
104 
105  //TODO How to get rid of this friend...
106  friend class coConfigEntryToEditor;
107  mutable char *cName;
108  mutable QString name;
109 };
110 }
111 #endif
Definition: coConfigXercesEntry.h:36
GLuint const GLchar * name
Definition: khronos-glext.h:6722
#define CONFIGEXPORT
Definition: coExport.h:337
coConfigSchemaInfos * schemaInfos
Definition: coConfigEntry.h:102
Definition: coConfigSchemaInfos.h:30
QString name
Definition: coConfigEntry.h:108
Definition: coConfigEntry.h:33
coConfigConstants::ConfigScope configScope
Definition: coConfigEntry.h:91
QString configName
Definition: coConfigEntry.h:92
#define EXPORT_TEMPLATE2(x, y)
Definition: coExport.h:34
QString path
Definition: coConfigEntry.h:93
bool isListNode
Definition: coConfigEntry.h:95
Definition: coConfigEditorController.h:31
ConfigScope
Definition: coConfigConstants.h:24
GLsizei const GLchar ** path
Definition: khronos-glext.h:7952
Definition: coConfigEntryToEditor.h:14
QHash< QString, QString * > attributes
Definition: coConfigEntry.h:99
Definition: coConfigEntryString.h:23
QString elementGroup
Definition: coConfigEntry.h:103
GLenum GLenum variable
Definition: khronos-glext.h:9990
bool readOnly
Definition: coConfigEntry.h:96
Definition: coConfigEntryString.h:53
QStringList textNodes
Definition: coConfigEntry.h:100
Definition: coConfigEntryPtrList.h:23
GLsizei const GLfloat * value
Definition: khronos-glext.h:6760
coConfigEntryPtrList children
Definition: coConfigEntry.h:98
char * cName
Definition: coConfigEntry.h:107