mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 02:47:48 +00:00
Runtime schema by name
This commit is contained in:
@@ -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])
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user