std::string IfcWriteIntegralArgument::toString(bool upper) const { std::ostringstream ss; switch ( type ) { case Argument_INT: ss << *(int*)data; break; case Argument_BOOL: ss << ((*(bool*) data) ? ".T." : ".F."); break; case Argument_DOUBLE: ss << *(double*) data; break; case Argument_STRING: { std::string d = *(std::string*) data; if ( upper ) d = IfcCharacterEncoder(d); ss << d; break; } case Argument_VECTOR_INT: ss << "("; {const std::vector<int>& v = *(std::vector<int>*) data; for ( std::vector<int>::const_iterator it = v.begin(); it != v.end(); ++ it ) { if ( it != v.begin() ) ss << ","; ss << *it; }} ss << ")"; break; case Argument_VECTOR_DOUBLE: ss << "("; {const std::vector<double>& v = *(std::vector<double>*) data; for ( std::vector<double>::const_iterator it = v.begin(); it != v.end(); ++ it ) { if ( it != v.begin() ) ss << ","; ss << *it; }} ss << ")"; break; case Argument_VECTOR_STRING: ss << "("; {const std::vector<std::string>& v = *(std::vector<std::string>*) data; for ( std::vector<std::string>::const_iterator it = v.begin(); it != v.end(); ++ it ) { if ( it != v.begin() ) ss << ","; ss << '\'' << *it << '\''; }} ss << ")"; break; case Argument_ENTITY: {IfcAbstractEntity* e = ((IfcUtil::IfcSchemaEntity)data)->entity; if ( Ifc2x3::Type::IsSimple(e->type()) ) { ss << e->toString(upper); } else { if (e->file) { ss << "#" << e->id(); } else { ss << "#?"; } }} break; default: throw IfcParse::IfcException("Invalid cast"); } return ss.str(); }
void operator()(const IfcUtil::IfcBaseClass* const& i) { IfcAbstractEntity* e = i->entity; if ( IfcSchema::Type::IsSimple(e->type()) ) { data << e->toString(upper); } else { data << "#" << e->id(); } }
std::string IfcWriteEntityListArgument::toString(bool upper) const { std::ostringstream ss; ss << "("; for ( IfcEntityList::it it = value->begin(); it != value->end(); ++ it ) { if ( it != value->begin() ) ss << ","; IfcAbstractEntity* e = (*it)->entity; if ( Ifc2x3::Type::IsSimple(e->type()) ) { ss << e->toString(upper); } else { if (e->file) { ss << "#" << e->id(); } else { ss << "#?"; } } } ss << ")"; return ss.str(); }