diff --git a/src/ifcparse/IfcSpfHeader.cpp b/src/ifcparse/IfcSpfHeader.cpp index 4a4e5316c8..14cfe8e91a 100644 --- a/src/ifcparse/IfcSpfHeader.cpp +++ b/src/ifcparse/IfcSpfHeader.cpp @@ -26,11 +26,12 @@ static const char * const HEADER = "HEADER"; static const char * const FILE_DESCRIPTION = "FILE_DESCRIPTION"; static const char * const FILE_NAME = "FILE_NAME"; static const char * const FILE_SCHEMA = "FILE_SCHEMA"; -static const char * const FILE_POPULATION = "FILE_POPULATION"; -static const char * const SECTION_LANGUAGE = "SECTION_LANGUAGE"; -static const char * const SECTION_CONTEXT = "SECTION_CONTEXT"; static const char * const ENDSEC = "ENDSEC"; static const char * const DATA = "DATA"; +// The following header entities are not normally encountered in IFC files and are not parsed. +// static const char * const FILE_POPULATION = "FILE_POPULATION"; +// static const char * const SECTION_LANGUAGE = "SECTION_LANGUAGE"; +// static const char * const SECTION_CONTEXT = "SECTION_CONTEXT"; using namespace IfcParse; @@ -61,6 +62,16 @@ void IfcSpfHeader::read() { readTerminal(ISO_10303_21, TRAILING_SEMICOLON); readTerminal(HEADER, TRAILING_SEMICOLON); + // | The header section of every exchange structure shall contain one + // | instance of each of the following entities: file_description, file_name, + // | and file_schema, and they shall appear in that order. Instances of + // | file_population, section_language and section_context may appear after + // | file_schema. If instances of user-defined header section entities are + // | present, they shall appear after the header section entity instances + // | defined in this section. + // + // ISO 10303-21 Second edition 2002-01-15 p. 16 + readTerminal(FILE_DESCRIPTION, TRAILING_PAREN); delete _file_description; _file_description = new FileDescription(_lexer); @@ -96,7 +107,6 @@ void IfcSpfHeader::write(std::ostream& os) const { os << DATA << ";" << "\n"; } - const FileDescription& IfcSpfHeader::file_description() const { if (_file_description) { return *_file_description; diff --git a/src/ifcparse/IfcSpfHeader.h b/src/ifcparse/IfcSpfHeader.h index 2f3e96e9f4..98725f50c7 100644 --- a/src/ifcparse/IfcSpfHeader.h +++ b/src/ifcparse/IfcSpfHeader.h @@ -50,13 +50,13 @@ protected: } void setArgument(unsigned int i, const std::string& s) { - IfcWrite::IfcWriteArgument* argument = new IfcWrite::IfcWriteArgument(this); + IfcWrite::IfcWriteArgument* argument = new IfcWrite::IfcWriteArgument; argument->set(s); _list->set(i, argument); } void setArgument(unsigned int i, const std::vector& s) { - IfcWrite::IfcWriteArgument* argument = new IfcWrite::IfcWriteArgument(this); + IfcWrite::IfcWriteArgument* argument = new IfcWrite::IfcWriteArgument; argument->set(s); _list->set(i, argument); } diff --git a/src/ifcparse/IfcWrite.cpp b/src/ifcparse/IfcWrite.cpp index d2dddad630..43fd76c8ae 100644 --- a/src/ifcparse/IfcWrite.cpp +++ b/src/ifcparse/IfcWrite.cpp @@ -134,7 +134,7 @@ void IfcWritableEntity::arg_writable(int i, bool b) { template void IfcWritableEntity::_setArgument(int i, const T& t) { if ( arg_writable(i) ) delete args[i]; - IfcWriteArgument* arg = new IfcWriteArgument(this); + IfcWriteArgument* arg = new IfcWriteArgument; args[i] = arg; arg->set(t); arg_writable(i,true); diff --git a/src/ifcparse/IfcWrite.h b/src/ifcparse/IfcWrite.h index 2007f4d6cc..04a7c6d89f 100644 --- a/src/ifcparse/IfcWrite.h +++ b/src/ifcparse/IfcWrite.h @@ -55,7 +55,6 @@ namespace IfcWrite { }; class Derived {}; private: - IfcAbstractEntity* entity; boost::variant< // A null argument, it will always serialize to $ boost::none_t, @@ -108,7 +107,6 @@ namespace IfcWrite { IfcEntityListList::ptr > container; public: - IfcWriteArgument(IfcAbstractEntity* e) : entity(e) {} template const T& as() const { if (const T* val = boost::get(&container)) { return *val;