2121#include < string>
2222#include < stdio.h>
2323#include < stdlib.h>
24+ #include < ctime>
2425
2526#include " ../ifcparse/IfcCharacterDecoder.h"
2627#include " ../ifcparse/IfcParse.h"
@@ -643,6 +644,7 @@ IfcFile::IfcFile() {
643644 lastId = 0 ;
644645 tokens = 0 ;
645646 MaxId = 0 ;
647+ initTimestamp ();
646648}
647649
648650//
@@ -849,7 +851,15 @@ std::ostream& operator<< (std::ostream& os, const IfcParse::IfcFile& f) {
849851 os << " ISO-10303-21;" << std::endl;
850852 os << " HEADER;" << std::endl;
851853 os << " FILE_DESCRIPTION(('ViewDefinition []'),'2;1');" << std::endl;
852- os << " FILE_NAME('','',(''),('',''),'IfcOpenShell','IfcOpenShell','');" << std::endl;
854+ os << " FILE_NAME("
855+ << static_cast <std::string>(IfcWrite::IfcCharacterEncoder (f.filename ())) << " ,"
856+ << static_cast <std::string>(IfcWrite::IfcCharacterEncoder (f.timestamp ())) << " ,("
857+ << static_cast <std::string>(IfcWrite::IfcCharacterEncoder (f.authorOrganisation ())) << " ),("
858+ << static_cast <std::string>(IfcWrite::IfcCharacterEncoder (f.authorName ())) << " ,"
859+ << static_cast <std::string>(IfcWrite::IfcCharacterEncoder (f.authorEmail ()))
860+ << " ),'IfcOpenShell " << IFCOPENSHELL_VERSION
861+ << " ','IfcOpenShell " << IFCOPENSHELL_VERSION
862+ << " ','');" << std::endl;
853863 os << " FILE_SCHEMA(('IFC2X3'));" << std::endl;
854864 os << " ENDSEC;" << std::endl;
855865 os << " DATA;" << std::endl;
@@ -864,3 +874,25 @@ std::ostream& operator<< (std::ostream& os, const IfcParse::IfcFile& f) {
864874
865875 return os;
866876}
877+
878+ void IfcFile::filename (const std::string& s) { _filename = s; }
879+ std::string IfcFile::filename () const { return _filename; }
880+ void IfcFile::timestamp (const std::string& s) { _timestamp = s; }
881+ std::string IfcFile::timestamp () const { return _timestamp; }
882+ void IfcFile::author (const std::string& name, const std::string& email, const std::string& organisation) {
883+ _author = name;
884+ _author_email = email;
885+ _author_organisation = organisation;
886+ }
887+ std::string IfcFile::authorName () const { return _author; }
888+ std::string IfcFile::authorEmail () const { return _author_email; }
889+ std::string IfcFile::authorOrganisation () const { return _author_organisation; }
890+ void IfcFile::initTimestamp () {
891+ char buf[255 ];
892+ time_t t;
893+ time (&t);
894+ struct tm * ti = localtime (&t);
895+ if (strftime (buf,255 ," %Y-%m-%dT%H:%M:%S" ,ti)) {
896+ _timestamp = std::string (buf);
897+ }
898+ }
0 commit comments