COVISE Core
coConfigSchema.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 COCONFIGSCHEMA_H
9#define COCONFIGSCHEMA_H
10
13#include <QHash>
14#include <QString>
15#include <QStringList>
16
17#include <xercesc/framework/psvi/XSConstants.hpp>
18#include <xercesc/framework/psvi/XSModelGroup.hpp>
19#include <xercesc/framework/psvi/XSNamedMap.hpp>
20
22{
23class XSModel;
24class XSSimpleTypeDefinition;
25class XSAnnotation;
26class XSElementDeclaration;
27};
28namespace covise
29{
30
31class coConfigSchemaInfos;
32class coConfigSchemaInfosList;
33
35{
36public:
37 static coConfigSchema *getInstance(xercesc::XSModel *model = 0)
38 {
39 if (configSchema)
40 {
41 return configSchema;
42 }
43 if (model)
44 {
45 configSchema = new coConfigSchema(model);
46 configSchema->walkTree();
47 return configSchema;
48 }
49 return 0;
50 }
51
52 static void loadSchema(const QString &filename = 0);
53
54 QStringList getGroupsFromSchema();
55 coConfigSchemaInfosList *getSchemaInfosForGroup(const QString groupName);
56 coConfigSchemaInfos *getSchemaInfosForElement(const QString &name);
57 // coConfigSchemaInfos* getSchemaInfos(xercesc::XSElementDeclaration* elementDecl);
58
59protected:
60 coConfigSchema(xercesc::XSModel *model)
61 {
62 xsModel = model;
63 walked = 0;
64 }
66
67private:
68 static xercesc::XSModel *xsModel;
70 static QString fileName;
71
72 coConfigSchemaInfos *createSchemaInfos(xercesc::XSElementDeclaration *elementDecl, const QString parent = QString(""));
73 void sortInGroups();
74 void walkTree();
75 void addAnnotationsForElement(xercesc::XSElementDeclaration *elementDecl, coConfigSchemaInfos *schemaInfos);
76 QHash<QString, QString> *createFromSchemaFileAnnotationsList(xercesc::XSAnnotationList *annoList);
77 QHash<QString, QString> *createFromSchemaFileAnnotation(xercesc::XSAnnotation *anno);
78 QString processSimpleTypeDefinition(xercesc::XSSimpleTypeDefinition *xsSimpleTypeDef);
79 //QStringList processParticle(xercesc::XSParticle *xsParticle);
80 QList<xercesc::XSElementDeclaration *> processParticle(xercesc::XSParticle *xsParticle);
81 QString printCompositorTypeConnector(xercesc::XSModelGroup::COMPOSITOR_TYPE type);
82
83 // key is path of element, value is pointer to the elements coConfigSchemaInfos
84 QHash<QString, coConfigSchemaInfos *> elements;
85 // key is name of group, value is list with all coConfigSchemaInfos
86 QHash<QString, coConfigSchemaInfosList *> groups;
87 bool walked;
88};
89}
90#endif
#define CONFIGEXPORT
Definition: coExport.h:367
GLuint const GLchar * name
Definition: khronos-glext.h:6722
GLenum type
Definition: khronos-glext.h:6279
list of all chemical elements
Definition: coConfig.h:27
Definition: coConfigSchema.h:22
Definition: coConfigSchemaInfos.h:31
Definition: coConfigSchemaInfosList.h:23
Definition: coConfigSchema.h:35
static xercesc::XSModel * xsModel
Definition: coConfigSchema.h:68
coConfigSchema(xercesc::XSModel *model)
Definition: coConfigSchema.h:60
QHash< QString, coConfigSchemaInfosList * > groups
Definition: coConfigSchema.h:86
static coConfigSchema * getInstance(xercesc::XSModel *model=0)
Definition: coConfigSchema.h:37
bool walked
Definition: coConfigSchema.h:87
QHash< QString, coConfigSchemaInfos * > elements
Definition: coConfigSchema.h:84
static QString fileName
Definition: coConfigSchema.h:70
static coConfigSchema * configSchema
Definition: coConfigSchema.h:69