COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
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 
11 #include <config/coConfigEntry.h>
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 
21 namespace XERCES_CPP_NAMESPACE
22 {
23 class XSModel;
24 class XSSimpleTypeDefinition;
25 class XSAnnotation;
26 class XSElementDeclaration;
27 };
28 namespace covise
29 {
30 
31 class coConfigSchemaInfos;
32 class coConfigSchemaInfosList;
33 
35 {
36 public:
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 
59 protected:
60  coConfigSchema(xercesc::XSModel *model)
61  {
62  xsModel = model;
63  walked = 0;
64  }
65  ~coConfigSchema();
66 
67 private:
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
static coConfigSchema * configSchema
Definition: coConfigSchema.h:69
GLuint const GLchar * name
Definition: khronos-glext.h:6722
#define CONFIGEXPORT
Definition: coExport.h:337
Definition: coConfigSchemaInfos.h:30
static QString fileName
Definition: coConfigSchema.h:70
QHash< QString, coConfigSchemaInfosList * > groups
Definition: coConfigSchema.h:86
static xercesc::XSModel * xsModel
Definition: coConfigSchema.h:68
Definition: coConfigSchema.h:34
QHash< QString, coConfigSchemaInfos * > elements
Definition: coConfigSchema.h:84
static coConfigSchema * getInstance(xercesc::XSModel *model=0)
Definition: coConfigSchema.h:37
bool walked
Definition: coConfigSchema.h:87
GLenum type
Definition: khronos-glext.h:6279
coConfigSchema(xercesc::XSModel *model)
Definition: coConfigSchema.h:60
Definition: coConfigSchemaInfosList.h:22