mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 22:43:41 +00:00
#2037 Option to optain declaration from early bound select definitions
This commit is contained in:
@@ -56,6 +56,14 @@ class Implementation(codegen.Base):
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
for name, enum in mapping.schema.selects.items():
|
||||||
|
write(
|
||||||
|
templates.select_function,
|
||||||
|
name=name,
|
||||||
|
schema_name=schema_name,
|
||||||
|
schema_name_upper=schema_name_upper
|
||||||
|
)
|
||||||
|
|
||||||
write = lambda str, **kwargs: entity_implementations.append(str % kwargs)
|
write = lambda str, **kwargs: entity_implementations.append(str % kwargs)
|
||||||
|
|
||||||
for name, type in mapping.schema.entities.items():
|
for name, type in mapping.schema.entities.items():
|
||||||
@@ -348,6 +356,10 @@ class Implementation(codegen.Base):
|
|||||||
("extern enumeration_type* %s_%%s_type;" % schema_name_upper) % n
|
("extern enumeration_type* %s_%%s_type;" % schema_name_upper) % n
|
||||||
for n in mapping.schema.enumerations.keys()
|
for n in mapping.schema.enumerations.keys()
|
||||||
]
|
]
|
||||||
|
+ [
|
||||||
|
("extern select_type* %s_%%s_type;" % schema_name_upper) % n
|
||||||
|
for n in mapping.schema.selects.keys()
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
self.str = templates.implementation % {
|
self.str = templates.implementation % {
|
||||||
|
|||||||
@@ -137,7 +137,10 @@ simpletype_impl_cast_templated = (
|
|||||||
simpletype_impl_declaration = "return *%(schema_name_upper)s_%(class_name)s_type;"
|
simpletype_impl_declaration = "return *%(schema_name_upper)s_%(class_name)s_type;"
|
||||||
|
|
||||||
select = """%(documentation)s
|
select = """%(documentation)s
|
||||||
class IFC_PARSE_API %(name)s : public virtual IfcUtil::IfcBaseInterface {};
|
class IFC_PARSE_API %(name)s : public virtual IfcUtil::IfcBaseInterface {
|
||||||
|
public:
|
||||||
|
static const IfcParse::select_type& Class();
|
||||||
|
};
|
||||||
"""
|
"""
|
||||||
|
|
||||||
enumeration = """class IFC_PARSE_API %(name)s : public IfcUtil::IfcBaseType {
|
enumeration = """class IFC_PARSE_API %(name)s : public IfcUtil::IfcBaseType {
|
||||||
@@ -167,6 +170,10 @@ public:
|
|||||||
};
|
};
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
select_function = """
|
||||||
|
const IfcParse::select_type& %(schema_name)s::%(name)s::Class() { return *%(schema_name_upper)s_%(name)s_type; }
|
||||||
|
"""
|
||||||
|
|
||||||
enumeration_function = """
|
enumeration_function = """
|
||||||
const IfcParse::enumeration_type& %(schema_name)s::%(name)s::declaration() const { return *%(schema_name_upper)s_%(name)s_type; }
|
const IfcParse::enumeration_type& %(schema_name)s::%(name)s::declaration() const { return *%(schema_name_upper)s_%(name)s_type; }
|
||||||
const IfcParse::enumeration_type& %(schema_name)s::%(name)s::Class() { return *%(schema_name_upper)s_%(name)s_type; }
|
const IfcParse::enumeration_type& %(schema_name)s::%(name)s::Class() { return *%(schema_name_upper)s_%(name)s_type; }
|
||||||
|
|||||||
Reference in New Issue
Block a user