Skip to content

Commit 68e60f0

Browse files
committed
Fix serialization of simple type attributes
1 parent e4f141b commit 68e60f0

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/ifcparse/IfcParse.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,9 @@ std::ostream& operator<< (std::ostream& os, const IfcParse::IfcFile& f) {
891891

892892
for ( MapEntityById::const_iterator it = f.begin(); it != f.end(); ++ it ) {
893893
const IfcEntity e = it->second;
894-
os << e->entity->toString(true) << ";" << std::endl;
894+
if (!IfcSchema::Type::IsSimple(e->type())) {
895+
os << e->entity->toString(true) << ";" << std::endl;
896+
}
895897
}
896898

897899
os << "ENDSEC;" << std::endl;

src/ifcparse/IfcWrite.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ std::string IfcWritableEntity::toString(bool upper) {
8484
if ( upper ) {
8585
for (std::string::iterator p = dt.begin(); p != dt.end(); ++p ) *p = toupper(*p);
8686
}
87-
if ( _id ) ss << "#" << *_id;
88-
ss << "=" << dt << "(";
87+
if ( _id && !IfcSchema::Type::IsSimple(_type) ) {
88+
ss << "#" << *_id << "=";
89+
}
90+
ss << dt << "(";
8991
for ( std::map<int,ArgumentPtr>::const_iterator it = args.begin(); it != args.end(); ++ it ) {
9092
if ( it != args.begin() ) ss << ",";
9193
const ArgumentPtr a = it->second;

0 commit comments

Comments
 (0)