mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Restructure and rename
This commit is contained in:
@@ -141,7 +141,7 @@ class Header(codegen.Base):
|
||||
["/// %s" % d for d in documentation.description(".".join((name, attr.name)))]
|
||||
)
|
||||
type_str = mapping.get_parameter_type(attr)
|
||||
if mapping.make_argument_type(attr) != "IfcUtil::Argument_UNKNOWN":
|
||||
if mapping.make_argument_type(attr) != "ifcopenshell::Argument_UNKNOWN":
|
||||
attr_lines.append("%s %s() const;" % (type_str, attr.name))
|
||||
attr_lines.append("void set%s(const %s& v);" % (attr.name, type_str))
|
||||
if type_str == 'std::optional< std::string >':
|
||||
@@ -202,7 +202,7 @@ class Header(codegen.Base):
|
||||
argument_name_function_body_tail = (
|
||||
(" return %s::getArgumentName(i); " % type.supertypes[0])
|
||||
if len(type.supertypes) == 1
|
||||
else ' (void)i; throw IfcParse::IfcAttributeOutOfRangeException("Argument index out of range"); '
|
||||
else ' (void)i; throw ifcopenshell::attribute_out_of_range_exception("Argument index out of range"); '
|
||||
)
|
||||
|
||||
argument_name_function_body = (
|
||||
@@ -214,7 +214,7 @@ class Header(codegen.Base):
|
||||
derived_in_supertype = set(derived) & set(attribute_names)
|
||||
derived_in_supertype_indices = sorted(attribute_names.index(nm) for nm in derived_in_supertype)
|
||||
attribute_type_cases = [
|
||||
"case %d: return IfcUtil::Argument_DERIVED; " % idx for idx in derived_in_supertype_indices
|
||||
"case %d: return ifcopenshell::Argument_DERIVED; " % idx for idx in derived_in_supertype_indices
|
||||
]
|
||||
attribute_type_cases += [
|
||||
"case %d: return %s; " % (i + argument_start, mapping.make_argument_type(attr))
|
||||
@@ -226,7 +226,7 @@ class Header(codegen.Base):
|
||||
argument_type_function_body_tail = (
|
||||
(" return %s::getArgumentType(i); " % type.supertypes[0])
|
||||
if len(type.supertypes) == 1
|
||||
else ' (void)i; throw IfcParse::IfcAttributeOutOfRangeException("Argument index out of range"); '
|
||||
else ' (void)i; throw ifcopenshell::attribute_out_of_range_exception("Argument index out of range"); '
|
||||
)
|
||||
|
||||
argument_type_function_body = (
|
||||
@@ -249,7 +249,7 @@ class Header(codegen.Base):
|
||||
argument_entity_function_body_tail = (
|
||||
(" return %s::getArgumentEntity(i); " % type.supertypes[0])
|
||||
if len(type.supertypes) == 1
|
||||
else ' (void)i; throw IfcParse::IfcAttributeOutOfRangeException("Argument index out of range"); '
|
||||
else ' (void)i; throw ifcopenshell::attribute_out_of_range_exception("Argument index out of range"); '
|
||||
)
|
||||
|
||||
argument_entity_function_body = (
|
||||
|
||||
@@ -107,7 +107,7 @@ class Implementation(codegen.Base):
|
||||
return templates.get_attr_stmt_nested_array
|
||||
elif arg["is_templated_list"] and not (simple or express):
|
||||
return templates.get_attr_stmt_array
|
||||
elif arg["argument_type_enum"] == 'IfcUtil::Argument_ENTITY_INSTANCE':
|
||||
elif arg["argument_type_enum"] == 'ifcopenshell::Argument_ENTITY_INSTANCE':
|
||||
return templates.get_attr_stmt_entity
|
||||
else:
|
||||
return templates.get_attr_stmt
|
||||
@@ -154,7 +154,7 @@ class Implementation(codegen.Base):
|
||||
return templates.set_attr_stmt_nested_array
|
||||
elif arg["is_templated_list"] and not (simple or express):
|
||||
return templates.set_attr_stmt_array
|
||||
elif arg["argument_type_enum"] == 'IfcUtil::Argument_ENTITY_INSTANCE':
|
||||
elif arg["argument_type_enum"] == 'ifcopenshell::Argument_ENTITY_INSTANCE':
|
||||
return templates.set_attr_instance
|
||||
else:
|
||||
return templates.set_attr_stmt
|
||||
@@ -243,9 +243,9 @@ class Implementation(codegen.Base):
|
||||
)
|
||||
|
||||
superclass_num_attrs = (
|
||||
"%s(const std::weak_ptr<InstanceData>&(in_memory_attribute_storage(%%d)))" % type.supertypes[0]
|
||||
"%s(const std::weak_ptr<instance_data>&(in_memory_attribute_storage(%%d)))" % type.supertypes[0]
|
||||
if len(type.supertypes) == 1
|
||||
else "express::Entity(const std::weak_ptr<InstanceData>&(in_memory_attribute_storage(%d)))"
|
||||
else "express::Entity(const std::weak_ptr<instance_data>&(in_memory_attribute_storage(%d)))"
|
||||
) % len(constructor_arguments)
|
||||
|
||||
write(
|
||||
@@ -351,7 +351,7 @@ class Implementation(codegen.Base):
|
||||
"",
|
||||
"Class",
|
||||
templates.function,
|
||||
"const IfcParse::type_declaration&",
|
||||
"const ifcopenshell::type_declaration&",
|
||||
(),
|
||||
templates.simpletype_impl_class,
|
||||
),
|
||||
@@ -359,7 +359,7 @@ class Implementation(codegen.Base):
|
||||
# "",
|
||||
# "declaration",
|
||||
# templates.const_function,
|
||||
# "const IfcParse::type_declaration&",
|
||||
# "const ifcopenshell::type_declaration&",
|
||||
# (),
|
||||
# templates.simpletype_impl_declaration,
|
||||
# ),
|
||||
@@ -368,7 +368,7 @@ class Implementation(codegen.Base):
|
||||
# "",
|
||||
# constructor,
|
||||
# "",
|
||||
# ("const std::weak_ptr<InstanceData>& e",),
|
||||
# ("const std::weak_ptr<instance_data>& e",),
|
||||
# "",
|
||||
# ),
|
||||
("", "", initializer, "", ("%s v" % type_str,), ("set_attribute_value(0, %s(v));" % ("cast_vector<express::Base>" if mapping.is_templated_list(type) else ""))),
|
||||
|
||||
@@ -150,7 +150,7 @@ class Mapping:
|
||||
pdb.set_trace()
|
||||
print("Attribute %r mapped as 'unknown'" % (attr), file=sys.stderr)
|
||||
ty = "UNKNOWN"
|
||||
return "IfcUtil::Argument_%s" % ty
|
||||
return "ifcopenshell::Argument_%s" % ty
|
||||
|
||||
def get_type_dep(self, type):
|
||||
if isinstance(type, str):
|
||||
@@ -243,7 +243,7 @@ class Mapping:
|
||||
arr = self.is_array(attr_type)
|
||||
simple = self.schema.is_simpletype(ty)
|
||||
express = self.flatten_type_string(ty) in self.express_to_cpp_typemapping
|
||||
# select = ty == "IfcUtil::IfcBaseClass"
|
||||
# select = ty == "ifcopenshell::IfcBaseClass"
|
||||
return arr and not simple and not express
|
||||
|
||||
def get_assignable_arguments(self, t, include_derived=False):
|
||||
@@ -254,7 +254,7 @@ class Mapping:
|
||||
|
||||
def include(attr):
|
||||
not_derived = include_derived or (attr.name not in derived)
|
||||
supported = self.make_argument_type(attr) != "IfcUtil::Argument_UNKNOWN"
|
||||
supported = self.make_argument_type(attr) != "ifcopenshell::Argument_UNKNOWN"
|
||||
return not_derived and supported
|
||||
|
||||
return [
|
||||
|
||||
@@ -5940,7 +5940,7 @@ class IfcPropertyEnumeratedValue_WR1:
|
||||
@staticmethod
|
||||
def __call__(self):
|
||||
enumerationvalues = express_getattr(self, 'EnumerationValues', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'EnumerationReference', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'enumeration_reference', INDETERMINATE)
|
||||
assert (not exists(enumerationreference) or sizeof([temp for temp in enumerationvalues if temp in express_getattr(enumerationreference, 'EnumerationValues', INDETERMINATE)]) == sizeof(enumerationvalues)) is not False
|
||||
|
||||
class IfcPropertyEnumeration_WR01:
|
||||
|
||||
@@ -8625,7 +8625,7 @@ class IfcPropertyEnumeratedValue_WR21:
|
||||
@staticmethod
|
||||
def __call__(self):
|
||||
enumerationvalues = express_getattr(self, 'EnumerationValues', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'EnumerationReference', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'enumeration_reference', INDETERMINATE)
|
||||
assert (not exists(enumerationreference) or not exists(enumerationvalues) or sizeof([temp for temp in enumerationvalues if temp in express_getattr(enumerationreference, 'EnumerationValues', INDETERMINATE)]) == sizeof(enumerationvalues)) is not False
|
||||
|
||||
class IfcPropertyEnumeration_WR01:
|
||||
|
||||
@@ -8716,7 +8716,7 @@ class IfcPropertyEnumeratedValue_WR21:
|
||||
@staticmethod
|
||||
def __call__(self):
|
||||
enumerationvalues = express_getattr(self, 'EnumerationValues', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'EnumerationReference', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'enumeration_reference', INDETERMINATE)
|
||||
assert (not exists(enumerationreference) or not exists(enumerationvalues) or sizeof([temp for temp in enumerationvalues if temp in express_getattr(enumerationreference, 'EnumerationValues', INDETERMINATE)]) == sizeof(enumerationvalues)) is not False
|
||||
|
||||
class IfcPropertyEnumeration_WR01:
|
||||
|
||||
@@ -8937,7 +8937,7 @@ class IfcPropertyEnumeratedValue_WR21:
|
||||
@staticmethod
|
||||
def __call__(self):
|
||||
enumerationvalues = express_getattr(self, 'EnumerationValues', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'EnumerationReference', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'enumeration_reference', INDETERMINATE)
|
||||
assert (not exists(enumerationreference) or not exists(enumerationvalues) or sizeof([temp for temp in enumerationvalues if temp in express_getattr(enumerationreference, 'EnumerationValues', INDETERMINATE)]) == sizeof(enumerationvalues)) is not False
|
||||
|
||||
class IfcPropertyEnumeration_WR01:
|
||||
|
||||
@@ -10088,7 +10088,7 @@ class IfcPropertyEnumeratedValue_WR21:
|
||||
@staticmethod
|
||||
def __call__(self):
|
||||
enumerationvalues = express_getattr(self, 'EnumerationValues', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'EnumerationReference', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'enumeration_reference', INDETERMINATE)
|
||||
assert (not exists(enumerationreference) or not exists(enumerationvalues) or sizeof([temp for temp in enumerationvalues if temp in express_getattr(enumerationreference, 'EnumerationValues', INDETERMINATE)]) == sizeof(enumerationvalues)) is not False
|
||||
|
||||
class IfcPropertyEnumeration_WR01:
|
||||
|
||||
@@ -10065,7 +10065,7 @@ class IfcPropertyEnumeratedValue_WR21:
|
||||
@staticmethod
|
||||
def __call__(self):
|
||||
enumerationvalues = express_getattr(self, 'EnumerationValues', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'EnumerationReference', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'enumeration_reference', INDETERMINATE)
|
||||
assert (not exists(enumerationreference) or not exists(enumerationvalues) or sizeof([temp for temp in enumerationvalues if temp in express_getattr(enumerationreference, 'EnumerationValues', INDETERMINATE)]) == sizeof(enumerationvalues)) is not False
|
||||
|
||||
class IfcPropertyEnumeration_WR01:
|
||||
|
||||
@@ -10085,7 +10085,7 @@ class IfcPropertyEnumeratedValue_WR21:
|
||||
@staticmethod
|
||||
def __call__(self):
|
||||
enumerationvalues = express_getattr(self, 'EnumerationValues', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'EnumerationReference', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'enumeration_reference', INDETERMINATE)
|
||||
assert (not exists(enumerationreference) or not exists(enumerationvalues) or sizeof([temp for temp in enumerationvalues if temp in express_getattr(enumerationreference, 'EnumerationValues', INDETERMINATE)]) == sizeof(enumerationvalues)) is not False
|
||||
|
||||
class IfcPropertyEnumeration_WR01:
|
||||
|
||||
@@ -9838,7 +9838,7 @@ class IfcPropertyEnumeratedValue_WR21:
|
||||
@staticmethod
|
||||
def __call__(self):
|
||||
enumerationvalues = express_getattr(self, 'EnumerationValues', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'EnumerationReference', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'enumeration_reference', INDETERMINATE)
|
||||
assert (not exists(enumerationreference) or not exists(enumerationvalues) or sizeof([temp for temp in enumerationvalues if temp in express_getattr(enumerationreference, 'EnumerationValues', INDETERMINATE)]) == sizeof(enumerationvalues)) is not False
|
||||
|
||||
class IfcPropertyEnumeration_WR01:
|
||||
|
||||
@@ -9933,7 +9933,7 @@ class IfcPropertyEnumeratedValue_WR21:
|
||||
@staticmethod
|
||||
def __call__(self):
|
||||
enumerationvalues = express_getattr(self, 'EnumerationValues', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'EnumerationReference', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'enumeration_reference', INDETERMINATE)
|
||||
assert (not exists(enumerationreference) or not exists(enumerationvalues) or sizeof([temp for temp in enumerationvalues if temp in express_getattr(enumerationreference, 'EnumerationValues', INDETERMINATE)]) == sizeof(enumerationvalues)) is not False
|
||||
|
||||
class IfcPropertyEnumeration_WR01:
|
||||
|
||||
@@ -10059,7 +10059,7 @@ class IfcPropertyEnumeratedValue_WR21:
|
||||
@staticmethod
|
||||
def __call__(self):
|
||||
enumerationvalues = express_getattr(self, 'EnumerationValues', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'EnumerationReference', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'enumeration_reference', INDETERMINATE)
|
||||
assert (not exists(enumerationreference) or not exists(enumerationvalues) or sizeof([temp for temp in enumerationvalues if temp in express_getattr(enumerationreference, 'EnumerationValues', INDETERMINATE)]) == sizeof(enumerationvalues)) is not False
|
||||
|
||||
class IfcPropertyEnumeration_WR01:
|
||||
|
||||
@@ -10075,7 +10075,7 @@ class IfcPropertyEnumeratedValue_WR21:
|
||||
@staticmethod
|
||||
def __call__(self):
|
||||
enumerationvalues = express_getattr(self, 'EnumerationValues', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'EnumerationReference', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'enumeration_reference', INDETERMINATE)
|
||||
assert (not exists(enumerationreference) or not exists(enumerationvalues) or sizeof([temp for temp in enumerationvalues if temp in express_getattr(enumerationreference, 'EnumerationValues', INDETERMINATE)]) == sizeof(enumerationvalues)) is not False
|
||||
|
||||
class IfcPropertyEnumeration_WR01:
|
||||
|
||||
@@ -10032,7 +10032,7 @@ class IfcPropertyEnumeratedValue_WR21:
|
||||
@staticmethod
|
||||
def __call__(self):
|
||||
enumerationvalues = express_getattr(self, 'EnumerationValues', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'EnumerationReference', INDETERMINATE)
|
||||
enumerationreference = express_getattr(self, 'enumeration_reference', INDETERMINATE)
|
||||
assert (not exists(enumerationreference) or not exists(enumerationvalues) or sizeof([temp for temp in enumerationvalues if temp in express_getattr(enumerationreference, 'EnumerationValues', INDETERMINATE)]) == sizeof(enumerationvalues)) is not False
|
||||
|
||||
class IfcPropertyEnumeration_WR01:
|
||||
|
||||
@@ -144,12 +144,12 @@ class EarlyBoundCodeWriter:
|
||||
|
||||
self.statements = [
|
||||
"",
|
||||
'#include "../../ifcparse/IfcSchema.h"',
|
||||
'#include "../../ifcparse/schema.h"',
|
||||
'#include "../../ifcparse/schemas/%(schema_name_title)s.h"' % self.__dict__,
|
||||
'#include <string>',
|
||||
"",
|
||||
'using namespace std::string_literals;',
|
||||
"using namespace IfcParse;",
|
||||
"using namespace ifcopenshell;",
|
||||
"",
|
||||
]
|
||||
|
||||
@@ -192,7 +192,7 @@ class EarlyBoundCodeWriter:
|
||||
# #endif
|
||||
# """
|
||||
# )
|
||||
self.statements.append("IfcParse::schema_definition* %s_populate_schema() {" % self.schema_name.upper())
|
||||
self.statements.append("ifcopenshell::schema_definition* %s_populate_schema() {" % self.schema_name.upper())
|
||||
self.statements.append("{string_pool_placeholder}")
|
||||
|
||||
def typedef(self, name, declared_type):
|
||||
@@ -331,7 +331,7 @@ class EarlyBoundCodeWriter:
|
||||
|
||||
instance_mapping = """switch(decl->index_in_schema()) {
|
||||
%s
|
||||
default: throw IfcParse::IfcException(decl->name() + " cannot be instantiated");
|
||||
default: throw ifcopenshell::exception(decl->name() + " cannot be instantiated");
|
||||
}
|
||||
""" % "\n ".join(
|
||||
map(
|
||||
@@ -343,8 +343,8 @@ class EarlyBoundCodeWriter:
|
||||
# Factor no longer exists because we don't have virtual methods anymore.
|
||||
# self.statements[self.statements.index("{factory_placeholder}")] = (
|
||||
# """
|
||||
# class %(schema_name)s_instance_factory : public IfcParse::instance_factory {
|
||||
# virtual IfcUtil::IfcBaseClass* operator()(const IfcParse::declaration* decl, const std::weak_ptr<InstanceData>& data) const {
|
||||
# class %(schema_name)s_instance_factory : public ifcopenshell::instance_factory {
|
||||
# virtual ifcopenshell::IfcBaseClass* operator()(const ifcopenshell::declaration* decl, const std::weak_ptr<instance_data>& data) const {
|
||||
# %(instance_mapping)s
|
||||
# }
|
||||
# };
|
||||
|
||||
@@ -28,18 +28,18 @@ header = """
|
||||
#include "../../ifcparse/ifc_parse_api.h"
|
||||
|
||||
#include "../../ifcparse/express.h"
|
||||
#include "../../ifcparse/IfcSchema.h"
|
||||
#include "../../ifcparse/IfcException.h"
|
||||
#include "../../ifcparse/Argument.h"
|
||||
#include "../../ifcparse/schema.h"
|
||||
#include "../../ifcparse/exception.h"
|
||||
#include "../../ifcparse/argument.h"
|
||||
|
||||
namespace IfcParse {
|
||||
class IfcFile;
|
||||
class IfcSpfHeader;
|
||||
} // namespace IfcParse
|
||||
namespace ifcopenshell {
|
||||
class file;
|
||||
class spf_header;
|
||||
} // namespace ifcopenshell
|
||||
|
||||
struct %(schema_name)s {
|
||||
|
||||
IFC_PARSE_API static const IfcParse::schema_definition& get_schema();
|
||||
IFC_PARSE_API static const ifcopenshell::schema_definition& get_schema();
|
||||
|
||||
IFC_PARSE_API static void clear_schema();
|
||||
|
||||
@@ -72,15 +72,15 @@ lb_header = """"""
|
||||
|
||||
implementation = """
|
||||
#include "../../ifcparse/schemas/%(schema_name)s.h"
|
||||
#include "../../ifcparse/IfcSchema.h"
|
||||
#include "../../ifcparse/IfcException.h"
|
||||
#include "../../ifcparse/IfcFile.h"
|
||||
#include "../../ifcparse/schema.h"
|
||||
#include "../../ifcparse/exception.h"
|
||||
#include "../../ifcparse/file.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
const char* const %(schema_name)s::Identifier = "%(schema_name_upper)s";
|
||||
|
||||
using namespace IfcParse;
|
||||
using namespace ifcopenshell;
|
||||
|
||||
// External definitions
|
||||
%(external_definitions)s
|
||||
@@ -114,30 +114,30 @@ simpletype = """%(documentation)s
|
||||
class IFC_PARSE_API %(name)s : public %(superclass)s {
|
||||
public:
|
||||
%(name)s() {}
|
||||
explicit %(name)s (const std::weak_ptr<InstanceData>& data) : %(superclass)s(data) {}
|
||||
explicit %(name)s (const std::weak_ptr<instance_data>& data) : %(superclass)s(data) {}
|
||||
|
||||
static const IfcParse::type_declaration& Class();
|
||||
static const ifcopenshell::type_declaration& Class();
|
||||
void initialize(%(type)s v);
|
||||
operator %(type)s() const;
|
||||
};
|
||||
"""
|
||||
|
||||
simpletype_impl_comment = "// Function implementations for %(name)s"
|
||||
simpletype_impl_argument_type = 'if (i == 0) { return %(attr_type)s; } else { throw IfcParse::IfcAttributeOutOfRangeException("Argument index out of range"); }'
|
||||
simpletype_impl_argument_type = 'if (i == 0) { return %(attr_type)s; } else { throw ifcopenshell::attribute_out_of_range_exception("Argument index out of range"); }'
|
||||
simpletype_impl_argument = "return get_attribute_value(i);"
|
||||
simpletype_impl_is_with_supertype = "return v == %(class_name)s_type || %(superclass)s::is(v);"
|
||||
simpletype_impl_is_without_supertype = "return v == %(class_name)s_type;"
|
||||
simpletype_impl_type = "return *((IfcParse::type_declaration*)%(schema_name_upper)s_types[%(index_in_schema)d]);"
|
||||
simpletype_impl_class = "return *((IfcParse::type_declaration*)%(schema_name_upper)s_types[%(index_in_schema)d]);"
|
||||
simpletype_impl_type = "return *((ifcopenshell::type_declaration*)%(schema_name_upper)s_types[%(index_in_schema)d]);"
|
||||
simpletype_impl_class = "return *((ifcopenshell::type_declaration*)%(schema_name_upper)s_types[%(index_in_schema)d]);"
|
||||
simpletype_impl_explicit_constructor = "data_ = e;"
|
||||
simpletype_impl_constructor = (
|
||||
"data_ = new const std::weak_ptr<InstanceData>&(%(schema_name_upper)s_types[%(index_in_schema)d]); set_attribute_value(0, v);"
|
||||
"data_ = new const std::weak_ptr<instance_data>&(%(schema_name_upper)s_types[%(index_in_schema)d]); set_attribute_value(0, v);"
|
||||
)
|
||||
simpletype_impl_constructor_templated = "data_ = new const std::weak_ptr<InstanceData>&(%(schema_name_upper)s_types[%(index_in_schema)d]); set_attribute_value(0, cast_vector<express::Base>(v));"
|
||||
simpletype_impl_constructor_templated = "data_ = new const std::weak_ptr<instance_data>&(%(schema_name_upper)s_types[%(index_in_schema)d]); set_attribute_value(0, cast_vector<express::Base>(v));"
|
||||
simpletype_impl_cast = "return get_attribute_value(0);"
|
||||
simpletype_impl_cast_templated = "std::vector<express::Base> es = get_attribute_value(0); return cast_vector<%(underlying_type)s>(es);"
|
||||
|
||||
simpletype_impl_declaration = "return *((IfcParse::type_declaration*)%(schema_name_upper)s_types[%(index_in_schema)d]);"
|
||||
simpletype_impl_declaration = "return *((ifcopenshell::type_declaration*)%(schema_name_upper)s_types[%(index_in_schema)d]);"
|
||||
|
||||
select = """%(documentation)s
|
||||
class IFC_PARSE_API %(name)s : public express::Select {
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
%(name)s() {}
|
||||
explicit %(name)s(const express::Base& c) : express::Select(c) {}
|
||||
|
||||
static const IfcParse::select_type& Class();
|
||||
static const ifcopenshell::select_type& Class();
|
||||
%(template_items)s
|
||||
%(cast_functions)s
|
||||
};
|
||||
@@ -163,13 +163,13 @@ enumeration = """%(documentation)s
|
||||
class IFC_PARSE_API %(name)s : public express::DeclaredType {
|
||||
public:
|
||||
%(name)s() {}
|
||||
explicit %(name)s (const std::weak_ptr<InstanceData>& data) : express::DeclaredType(data) {}
|
||||
explicit %(name)s (const std::weak_ptr<instance_data>& data) : express::DeclaredType(data) {}
|
||||
|
||||
typedef enum {%(values)s} Value;
|
||||
static const char* ToString(Value v);
|
||||
static Value FromString(const std::string& s);
|
||||
|
||||
static const IfcParse::enumeration_type& Class();
|
||||
static const ifcopenshell::enumeration_type& Class();
|
||||
void initialize(Value v);
|
||||
void initialize(const std::string& v);
|
||||
operator Value() const;
|
||||
@@ -180,33 +180,33 @@ entity = """%(documentation)s
|
||||
class IFC_PARSE_API %(name)s : public %(superclass)s {
|
||||
public:
|
||||
%(name)s() {}
|
||||
explicit %(name)s (const std::weak_ptr<InstanceData>& data) : %(superclass)s(data) {}
|
||||
explicit %(name)s (const std::weak_ptr<instance_data>& data) : %(superclass)s(data) {}
|
||||
|
||||
%(attributes)s %(inverse)s
|
||||
static const IfcParse::entity& Class();
|
||||
static const ifcopenshell::entity& Class();
|
||||
void initialize(%(constructor_arguments)s);
|
||||
};
|
||||
"""
|
||||
|
||||
select_function = """
|
||||
const IfcParse::select_type& %(schema_name)s::%(name)s::Class() { return *((IfcParse::select_type*)%(schema_name_upper)s_types[%(index_in_schema)d]); }
|
||||
const ifcopenshell::select_type& %(schema_name)s::%(name)s::Class() { return *((ifcopenshell::select_type*)%(schema_name_upper)s_types[%(index_in_schema)d]); }
|
||||
"""
|
||||
|
||||
enumeration_function = """
|
||||
// const IfcParse::enumeration_type& %(schema_name)s::%(name)s::declaration() const { return *((IfcParse::enumeration_type*)%(schema_name_upper)s_types[%(index_in_schema)d]); }
|
||||
const IfcParse::enumeration_type& %(schema_name)s::%(name)s::Class() { return *((IfcParse::enumeration_type*)%(schema_name_upper)s_types[%(index_in_schema)d]); }
|
||||
// const ifcopenshell::enumeration_type& %(schema_name)s::%(name)s::declaration() const { return *((ifcopenshell::enumeration_type*)%(schema_name_upper)s_types[%(index_in_schema)d]); }
|
||||
const ifcopenshell::enumeration_type& %(schema_name)s::%(name)s::Class() { return *((ifcopenshell::enumeration_type*)%(schema_name_upper)s_types[%(index_in_schema)d]); }
|
||||
|
||||
/*
|
||||
%(schema_name)s::%(name)s::%(name)s(const std::weak_ptr<InstanceData>& e)
|
||||
%(schema_name)s::%(name)s::%(name)s(const std::weak_ptr<instance_data>& e)
|
||||
: express::DeclaredType(e)
|
||||
{}
|
||||
|
||||
%(schema_name)s::%(name)s::%(name)s(Value v) {
|
||||
set_attribute_value(0, EnumerationReference(&Class(), static_cast<size_t>(v)));
|
||||
set_attribute_value(0, enumeration_reference(&Class(), static_cast<size_t>(v)));
|
||||
}
|
||||
|
||||
%(schema_name)s::%(name)s::%(name)s(const std::string& v) {
|
||||
set_attribute_value(0, EnumerationReference(&Class(), Class().lookup_enum_offset(v)));
|
||||
set_attribute_value(0, enumeration_reference(&Class(), Class().lookup_enum_offset(v)));
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -219,19 +219,19 @@ const char* %(schema_name)s::%(name)s::ToString(Value v) {
|
||||
}
|
||||
|
||||
%(schema_name)s::%(name)s::operator %(schema_name)s::%(name)s::Value() const {
|
||||
return (%(schema_name)s::%(name)s::Value) ((EnumerationReference) get_attribute_value(0)).index();
|
||||
return (%(schema_name)s::%(name)s::Value) ((enumeration_reference) get_attribute_value(0)).index();
|
||||
}
|
||||
"""
|
||||
|
||||
entity_implementation = """// Function implementations for %(name)s
|
||||
%(attributes)s
|
||||
%(inverse)s
|
||||
const IfcParse::entity& %(schema_name)s::%(name)s::Class() { return *((IfcParse::entity*)%(schema_name_upper)s_types[%(index_in_schema)d]); }
|
||||
const ifcopenshell::entity& %(schema_name)s::%(name)s::Class() { return *((ifcopenshell::entity*)%(schema_name_upper)s_types[%(index_in_schema)d]); }
|
||||
void %(schema_name)s::%(name)s::initialize(%(constructor_arguments)s) { %(constructor_implementation)s }
|
||||
"""
|
||||
|
||||
# data_ = e;
|
||||
# data_ = new const std::weak_ptr<InstanceData>&(%(schema_name_upper)s_types[%(index_in_schema)d]);
|
||||
# data_ = new const std::weak_ptr<instance_data>&(%(schema_name_upper)s_types[%(index_in_schema)d]);
|
||||
|
||||
optional_attribute_description = "/// Whether the optional attribute %s is defined for this %s"
|
||||
|
||||
@@ -266,7 +266,7 @@ get_attr_stmt_entity = "%(null_check)s return ((express::Base)(get_attribute_val
|
||||
get_attr_stmt_array = "%(null_check)s std::vector<express::Base> es = get_attribute_value(%(index)d); return cast_vector<%(list_instance_type)s>(es);"
|
||||
get_attr_stmt_nested_array = "%(null_check)s std::vector<std::vector<express::Base>> es = get_attribute_value(%(index)d); return cast_vector<%(list_instance_type)s>(es);"
|
||||
|
||||
get_inverse = "return cast_vector<%(type)s>(file()->getInverse(data()->id(), %(schema_name_upper)s_types[%(type_index)d], %(index)d));"
|
||||
get_inverse = "return cast_vector<%(type)s>(file()->get_inverse(data()->id(), %(schema_name_upper)s_types[%(type_index)d], %(index)d));"
|
||||
|
||||
set_attr_stmt = (
|
||||
"%(check_optional_set_begin)sset_attribute_value(%(index)d, %(star_if_optional)sv);%(check_optional_set_else)sunset_attribute_value(%(index)d);%(check_optional_set_end)s"
|
||||
@@ -274,7 +274,7 @@ set_attr_stmt = (
|
||||
set_attr_instance = (
|
||||
"%(check_optional_set_begin)sset_attribute_value(%(index)d, v);%(check_optional_set_else)sunset_attribute_value(%(index)d);%(check_optional_set_end)s"
|
||||
)
|
||||
set_attr_stmt_enum = "%(check_optional_set_begin)sset_attribute_value(%(index)d, EnumerationReference(&%(non_optional_type)s::Class(), (size_t) %(star_if_optional)sv));%(check_optional_set_else)sunset_attribute_value(%(index)d);%(check_optional_set_end)s"
|
||||
set_attr_stmt_enum = "%(check_optional_set_begin)sset_attribute_value(%(index)d, enumeration_reference(&%(non_optional_type)s::Class(), (size_t) %(star_if_optional)sv));%(check_optional_set_else)sunset_attribute_value(%(index)d);%(check_optional_set_end)s"
|
||||
set_attr_stmt_array = (
|
||||
"%(check_optional_set_begin)sset_attribute_value(%(index)d, cast_vector<express::Base>(%(star_if_optional)sv));%(check_optional_set_else)sunset_attribute_value(%(index)d);%(check_optional_set_end)s"
|
||||
)
|
||||
@@ -286,7 +286,7 @@ constructor_stmt = (
|
||||
"set_attribute_value(%(index)d, (%(name)s));"
|
||||
)
|
||||
constructor_stmt_enum = (
|
||||
"set_attribute_value(%(index)d, (EnumerationReference(&%(type)s::Class(),(size_t)%(name)s)));"
|
||||
"set_attribute_value(%(index)d, (enumeration_reference(&%(type)s::Class(),(size_t)%(name)s)));"
|
||||
)
|
||||
constructor_stmt_array = (
|
||||
"set_attribute_value(%(index)d, cast_vector<express::Base>(%(name)s));"
|
||||
|
||||
Reference in New Issue
Block a user