| 81 | typedef std::map<std::string, std::map<std::string, std::string>> element_properties; |
| 82 | |
| 83 | std::string format_string(const AttributeValue& argument) { |
| 84 | // Argument is a runtime tagged variant for the various data types in a IFC model, |
| 85 | // in this particular case we only care about flattening it to a string. |
| 86 | // @todo mostly duplicated from XmlSerializer.cpp |
| 87 | if (argument.isNull()) { |
| 88 | return "-"; |
| 89 | } |
| 90 | auto argument_type = argument.type(); |
| 91 | switch (argument_type) { |
| 92 | case IfcUtil::Argument_BOOL: { |
| 93 | const bool b = argument; |
| 94 | return b ? "true" : "false"; |
| 95 | } |
| 96 | case IfcUtil::Argument_DOUBLE: { |
| 97 | const double d = argument; |
| 98 | std::stringstream stream; |
| 99 | stream << std::setprecision(std::numeric_limits< double >::max_digits10) << d; |
| 100 | return stream.str(); |
| 101 | break; } |
| 102 | case IfcUtil::Argument_STRING: |
| 103 | case IfcUtil::Argument_ENUMERATION: { |
| 104 | return static_cast<std::string>(argument); |
| 105 | break; } |
| 106 | case IfcUtil::Argument_INT: { |
| 107 | const int v = argument; |
| 108 | std::stringstream stream; |
| 109 | stream << v; |
| 110 | return stream.str(); |
| 111 | break; } |
| 112 | } |
| 113 | return "?"; |
| 114 | } |
| 115 | |
| 116 | template <typename Schema, typename T> |
| 117 | void process_pset(element_properties& props, const T* inst) { |
no test coverage detected