2222
2323#include " ../ifcparse/IfcFile.h"
2424#include " ../ifcparse/IfcLogger.h"
25+ #include " ../ifcparse/Ifc2x3.h"
2526
2627#include < boost/preprocessor/stringize.hpp>
2728#include < boost/preprocessor/seq/for_each.hpp>
@@ -79,31 +80,31 @@ struct is_ifc4_or_higher<T, std::void_t<decltype(T::IfcMaterialDefinition)>> : s
7980
8081typedef std::map<std::string, std::map<std::string, std::string>> element_properties;
8182
82- std::string format_string (const Argument* argument) {
83+ std::string format_string (const AttributeValue& argument) {
8384 // Argument is a runtime tagged variant for the various data types in a IFC model,
8485 // in this particular case we only care about flattening it to a string.
8586 // @todo mostly duplicated from XmlSerializer.cpp
86- if (argument-> isNull ()) {
87+ if (argument. isNull ()) {
8788 return " -" ;
8889 }
89- auto argument_type = argument-> type ();
90+ auto argument_type = argument. type ();
9091 switch (argument_type) {
9192 case IfcUtil::Argument_BOOL: {
92- const bool b = * argument;
93+ const bool b = argument;
9394 return b ? " true" : " false" ;
9495 }
9596 case IfcUtil::Argument_DOUBLE: {
96- const double d = * argument;
97+ const double d = argument;
9798 std::stringstream stream;
9899 stream << std::setprecision (std::numeric_limits< double >::max_digits10) << d;
99100 return stream.str ();
100101 break ; }
101102 case IfcUtil::Argument_STRING:
102103 case IfcUtil::Argument_ENUMERATION: {
103- return static_cast <std::string>(* argument);
104+ return static_cast <std::string>(argument);
104105 break ; }
105106 case IfcUtil::Argument_INT: {
106- const int v = * argument;
107+ const int v = argument;
107108 std::stringstream stream;
108109 stream << v;
109110 return stream.str ();
@@ -136,7 +137,7 @@ void process_pset(element_properties& props, const T* inst) {
136137 if (!singleval->NominalValue ()) {
137138 propvalue = " -" ;
138139 } else {
139- props[*pset->Name ()][propname] = format_string (singleval->NominalValue ()->template as <IfcUtil::IfcBaseClass>()->data ().getArgument (0 ));
140+ props[*pset->Name ()][propname] = format_string (singleval->NominalValue ()->template as <IfcUtil::IfcBaseClass>()->data ().get_attribute_value (0 ));
140141 }
141142 }
142143 }
@@ -148,8 +149,8 @@ void process_pset(element_properties& props, const T* inst) {
148149 auto qs = qset->Quantities ();
149150 for (auto it = qs->begin (); it != qs->end (); ++it) {
150151 auto & q = *it;
151- if (q->template as <typename Schema::IfcPhysicalSimpleQuantity>() && q->data ().getArgument (3 )-> type () == IfcUtil::Argument_DOUBLE) {
152- double v = * q->data ().getArgument (3 );
152+ if (q->template as <typename Schema::IfcPhysicalSimpleQuantity>() && q->data ().get_attribute_value (3 ). type () == IfcUtil::Argument_DOUBLE) {
153+ double v = q->data ().get_attribute_value (3 );
153154 props[*qset->Name ()][q->Name ()] = std::to_string (v);
154155 }
155156 }
@@ -264,7 +265,8 @@ int main(int argc, char** argv) {
264265
265266 for (auto it = elements->begin (); it != elements->end (); ++it) {
266267 const auto * element = *it;
267- std::cout << element->data ().toString () << std::endl;
268+ element->toString (std::cout);
269+ std::cout << std::endl;
268270
269271 const IfcSchema::IfcWindow* window;
270272 if ((window = element->as <IfcSchema::IfcWindow>()) != 0 ) {
0 commit comments