COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
coConfigImportReader.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 COCONFIGIMPORTREADER_H
9 #define COCONFIGIMPORTREADER_H
10 
11 #include <util/coTypes.h>
12 
13 #include <QLinkedList>
14 #include <QMap>
15 #include <QTextStream>
16 #include <QtXml>
17 
18 class QDomDocument;
19 class QDomElement;
20 class QDomNode;
21 class QFile;
22 class QString;
23 class QTextStream;
24 
25 #ifndef CO_gcc3
26 EXPORT_TEMPLATE2(template class CONFIGEXPORT QMap<QString, QDomElement>)
27 #endif
28 
30 {
31 
32 public:
33  coConfigImportReader(const QString &source,
34  const QString &dest,
35  const QString &transform,
36  bool resolve_includes = true);
37 
39 
40  QDomDocument parse();
41  QDomDocument write();
42 
43  void updatev0v1();
44 
45 private:
46  QDomElement findMapping(const QString &mapping, const QDomNode &parent) const;
47 
48  QDomElement getOrCreateSection(QDomDocument &document, QDomNode &parent, const QString &name, const QString &hosts = "");
49  QDomNode addChild(QDomNode &parent, const QDomNode &newChild);
50 
51  void update(QDomElement &rootNode, QDomElement &updater);
52  inline void updateNode(QDomElement &node, QDomElement &updateInstruction);
53  inline void updateEntry(QDomElement &node, QDomElement &updateInstruction);
54  inline void updateApplyInstruction(QDomElement &node, QDomElement &updateInstruction);
55  inline void updateMergeNodes(QDomElement &section, QDomElement &node);
56  inline QLinkedList<QDomNode> makeNonLiveList(QDomNodeList liveList) const;
57 
58  inline QString domToString(const QDomDocument &doc) const;
59 
60  QFile *source;
61  QFile *dest;
62  QFile *transform;
63 
64  QTextStream *sourceStream;
65  QDomDocument transformerDoc;
66  QDomElement transformer;
67  QDomDocument result;
68  QDomNode root;
69  QDomNode global;
70  QString errorMessage;
71 
72  QMap<QString, QDomElement> hostconfigs;
73 
74  int errorLine;
77 };
78 
79 #endif
QDomElement transformer
Definition: coConfigImportReader.h:66
GLsizei GLsizei GLchar * source
Definition: khronos-glext.h:6739
QMap< QString, QDomElement > hostconfigs
Definition: coConfigImportReader.h:72
GLuint const GLchar * name
Definition: khronos-glext.h:6722
QTextStream * sourceStream
Definition: coConfigImportReader.h:64
QString errorMessage
Definition: coConfigImportReader.h:70
#define CONFIGEXPORT
Definition: coExport.h:337
int errorLine
Definition: coConfigImportReader.h:74
GLenum GLenum GLenum GLenum mapping
Definition: khronos-glext.h:9990
QDomNode root
Definition: coConfigImportReader.h:68
#define EXPORT_TEMPLATE2(x, y)
Definition: coExport.h:34
int errorColumn
Definition: coConfigImportReader.h:75
QFile * transform
Definition: coConfigImportReader.h:62
QDomDocument transformerDoc
Definition: coConfigImportReader.h:65
QFile * dest
Definition: coConfigImportReader.h:61
QFile * source
Definition: coConfigImportReader.h:60
GLuint GLenum GLenum transform
Definition: khronos-glext.h:10382
Definition: coConfigImportReader.h:29
QDomDocument result
Definition: coConfigImportReader.h:67
QDomNode global
Definition: coConfigImportReader.h:69
bool resolveIncludes
Definition: coConfigImportReader.h:76