mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Some successes writing and reading
This commit is contained in:
@@ -279,7 +279,7 @@ static void end_element(void* user, const xmlChar* tag) {
|
||||
}
|
||||
*/
|
||||
// @todo
|
||||
// back.inst()->data().set_attribute_value(back.idx(), elems);
|
||||
// back.inst()->set_attribute_value(back.idx(), elems);
|
||||
}
|
||||
|
||||
if (state->dialect == ifcxml_dialect_ifc2x3 && state->stack.back().ntype() == stack_node::node_instance) {
|
||||
@@ -325,28 +325,28 @@ static void process_characters(void* user, const xmlChar* character, int len) {
|
||||
if (!val.empty()) {
|
||||
// type declaration always at idx 0
|
||||
visit_any([&state](auto& v) {
|
||||
state->stack.back().inst()->data().set_attribute_value(0, v);
|
||||
state->stack.back().inst()->set_attribute_value(0, v);
|
||||
}, val);
|
||||
}
|
||||
} else if (state_type == stack_node::node_header_entry) {
|
||||
const std::string tagname = boost::replace_all_copy(state->stack.back().tagname(), "ex:", "");
|
||||
auto& header = state->file->header();
|
||||
if (tagname == "name") {
|
||||
header.file_name().name(txt);
|
||||
header.file_name()->setname(txt);
|
||||
} else if (tagname == "time_stamp") {
|
||||
header.file_name().time_stamp(txt);
|
||||
header.file_name()->settime_stamp(txt);
|
||||
} else if (tagname == "author") {
|
||||
header.file_name().author({txt});
|
||||
header.file_name()->setauthor({txt});
|
||||
} else if (tagname == "organization") {
|
||||
header.file_name().organization({txt});
|
||||
header.file_name()->setorganization({txt});
|
||||
} else if (tagname == "preprocessor_version") {
|
||||
header.file_name().preprocessor_version(txt);
|
||||
header.file_name()->setpreprocessor_version(txt);
|
||||
} else if (tagname == "originating_system") {
|
||||
header.file_name().originating_system(txt);
|
||||
header.file_name()->setoriginating_system(txt);
|
||||
} else if (tagname == "authorization") {
|
||||
header.file_name().authorization(txt);
|
||||
header.file_name()->setauthorisation(txt);
|
||||
} else if (tagname == "documentation") {
|
||||
header.file_description().description({txt});
|
||||
header.file_description()->setdescription({txt});
|
||||
} else {
|
||||
Logger::Error("Unrecognized header entry " + tagname);
|
||||
}
|
||||
@@ -531,7 +531,7 @@ static void start_element(void* user, const xmlChar* tag, const xmlChar** attrs)
|
||||
IfcUtil::IfcBaseClass* inst;
|
||||
auto inst_ = create_instance(decl);
|
||||
instance_to_attribute(inst_, state->stack.back().idx(), inst);
|
||||
// state->stack.back().inst()->data().set_attribute_value(state->stack.back().idx(), attr);
|
||||
// state->stack.back().inst()->set_attribute_value(state->stack.back().idx(), attr);
|
||||
state->stack.push_back(stack_node::instance(id, inst));
|
||||
} else if (state_type == stack_node::node_aggregate) {
|
||||
|
||||
@@ -592,7 +592,7 @@ static void start_element(void* user, const xmlChar* tag, const xmlChar** attrs)
|
||||
if (inst != nullptr) {
|
||||
int idx = (*found)->entity_reference()->attribute_index(
|
||||
(*found)->attribute_reference());
|
||||
inst->data().set_attribute_value(idx, state->stack.back().inst());
|
||||
inst->set_attribute_value(idx, state->stack.back().inst());
|
||||
state->stack.push_back(stack_node::instance(id, inst));
|
||||
} else {
|
||||
Logger::Error("Unknown attribute " + tagname);
|
||||
@@ -663,12 +663,12 @@ static void start_element(void* user, const xmlChar* tag, const xmlChar** attrs)
|
||||
int idx = state->stack.back().inv_attr()->entity_reference()->attribute_index(
|
||||
state->stack.back().inv_attr()->attribute_reference());
|
||||
if (inst != nullptr) {
|
||||
inst->data().set_attribute_value(idx, state->stack.back().inst());
|
||||
inst->set_attribute_value(idx, state->stack.back().inst());
|
||||
} else {
|
||||
Logger::Error("Internal error, inverse attribute not processed");
|
||||
}
|
||||
} else if (state_type == stack_node::node_instance_attribute) {
|
||||
state->stack.back().inst()->data().set_attribute_value(state->stack.back().idx(), inst);
|
||||
state->stack.back().inst()->set_attribute_value(state->stack.back().idx(), inst);
|
||||
}
|
||||
|
||||
if (entity == nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user