| 228 | } |
| 229 | |
| 230 | boost::any parse_attribute_value(const IfcParse::parameter_type* ty, const std::string& value) { |
| 231 | boost::any any; |
| 232 | auto cpp_type = IfcUtil::from_parameter_type(ty); |
| 233 | |
| 234 | if (cpp_type == IfcUtil::Argument_STRING) { |
| 235 | any = value; |
| 236 | } else if (cpp_type == IfcUtil::Argument_ENUMERATION) { |
| 237 | const auto* enum_type = ty->as_named_type()->declared_type()->as_enumeration_type(); |
| 238 | |
| 239 | std::vector<std::string>::const_iterator iter = std::find( |
| 240 | enum_type->enumeration_items().begin(), |
| 241 | enum_type->enumeration_items().end(), |
| 242 | boost::to_upper_copy(value)); |
| 243 | |
| 244 | any = EnumerationReference(enum_type, std::distance(enum_type->enumeration_items().begin(), iter)); |
| 245 | } else if (cpp_type == IfcUtil::Argument_INT) { |
| 246 | any = boost::lexical_cast<int>(value); |
| 247 | } else if (cpp_type == IfcUtil::Argument_DOUBLE) { |
| 248 | any = boost::lexical_cast<double>(value); |
| 249 | } else if (cpp_type == IfcUtil::Argument_BOOL) { |
| 250 | any = boost::to_lower_copy(value) == "true"; |
| 251 | } else if (cpp_type == IfcUtil::Argument_AGGREGATE_OF_INT) { |
| 252 | any = split<int>(value); |
| 253 | } else if (cpp_type == IfcUtil::Argument_AGGREGATE_OF_DOUBLE) { |
| 254 | any = split<double>(value); |
| 255 | } |
| 256 | |
| 257 | if (any.empty()) { |
| 258 | Logger::Error("Attribute '" + value + "' not successfully parsed"); |
| 259 | } |
| 260 | |
| 261 | return any; |
| 262 | } |
| 263 | |
| 264 | static void end_element(void* user, const xmlChar* tag) { |
| 265 | ifcxml_parse_state* state = (ifcxml_parse_state*)user; |
no test coverage detected