Runtime schema by name

This commit is contained in:
Thomas Krijnen
2017-12-12 10:33:24 +01:00
parent 33e1fa6a14
commit 33fc2080df
13 changed files with 967 additions and 73 deletions
+1 -1
View File
@@ -137,7 +137,7 @@ class AttributeList(Node):
class InverseAttribute(Node):
name = property(lambda self: self.tokens[0])
type = property(lambda self: self.tokens[2])
type = property(lambda self: self.tokens[2] if self.tokens[2] != self.tokens[-4] else None)
bounds = property(lambda self: None if len(self.tokens) != 9 else self.tokens[3])
entity = property(lambda self: self.tokens[-4])
attribute = property(lambda self: self.tokens[-2])
+3 -1
View File
@@ -194,11 +194,13 @@ class SchemaClass(codegen.Base):
#endif
""")
statements.append("namespace %s {" % mapping.schema.name)
statements.extend(('const schema_definition& get_schema() {',
'',
' static const schema_definition* s = populate_schema();',
' return *s;',
'}','',''))
'}','}','',''))
self.str = "\n".join(statements)
+2 -2
View File
@@ -36,12 +36,12 @@ header = """
#include "../ifcparse/%(schema_name)senum.h"
const IfcParse::schema_definition& get_schema();
#define IfcSchema %(schema_name)s
namespace %(schema_name)s {
const IfcParse::schema_definition& get_schema();
const char* const Identifier = "%(schema_name_upper)s";
// Forward definitions