set_default() on spf header

This commit is contained in:
Thomas Krijnen
2017-11-17 14:57:03 +01:00
parent 693444d4d2
commit 59020a22ee
4 changed files with 41 additions and 37 deletions
-2
View File
@@ -127,8 +127,6 @@ public:
const IfcSpfHeader& header() const { return _header; }
IfcSpfHeader& header() { return _header; }
std::string createTimestamp() const;
bool create_latebound_entities() const { return _create_latebound_entities; }
std::pair<IfcSchema::IfcNamedUnit*, double> getUnit(IfcSchema::IfcUnitEnum::IfcUnitEnum);
+1 -34
View File
@@ -1492,22 +1492,6 @@ std::ostream& operator<< (std::ostream& os, const IfcParse::IfcFile& f) {
return os;
}
std::string IfcFile::createTimestamp() const {
char buf[255];
time_t t;
time(&t);
struct tm* ti = localtime (&t);
std::string result = "";
if (strftime(buf,255,"%Y-%m-%dT%H:%M:%S",ti)) {
result = std::string(buf);
}
return result;
}
IfcEntityList::ptr IfcFile::getInverse(int instance_id, IfcSchema::Type::Enum type, int attribute_index) {
IfcUtil::IfcBaseClass* instance = entityById(instance_id);
@@ -1538,24 +1522,7 @@ IfcEntityList::ptr IfcFile::getInverse(int instance_id, IfcSchema::Type::Enum ty
}
void IfcFile::setDefaultHeaderValues() {
const std::string empty_string = "";
std::vector<std::string> file_description, schema_identifiers, empty_vector;
file_description.push_back("ViewDefinition [CoordinationView]");
schema_identifiers.push_back(IfcSchema::Identifier);
header().file_description().description(file_description);
header().file_description().implementation_level("2;1");
header().file_name().name(empty_string);
header().file_name().time_stamp(createTimestamp());
header().file_name().author(empty_vector);
header().file_name().organization(empty_vector);
header().file_name().preprocessor_version("IfcOpenShell " IFCOPENSHELL_VERSION);
header().file_name().originating_system("IfcOpenShell " IFCOPENSHELL_VERSION);
header().file_name().authorization(empty_string);
header().file_schema().schema_identifiers(schema_identifiers);
header().set_default();
}
std::pair<IfcSchema::IfcNamedUnit*, double> IfcFile::getUnit(IfcSchema::IfcUnitEnum::IfcUnitEnum type) {
+38 -1
View File
@@ -147,4 +147,41 @@ FileSchema& IfcSpfHeader::file_schema() {
FileDescription::FileDescription(IfcSpfLexer* lexer) : HeaderEntity(FILE_DESCRIPTION, lexer) {}
FileName::FileName(IfcSpfLexer* lexer) : HeaderEntity(FILE_NAME, lexer) {}
FileSchema::FileSchema(IfcSpfLexer* lexer) : HeaderEntity(FILE_SCHEMA, lexer) {}
FileSchema::FileSchema(IfcSpfLexer* lexer) : HeaderEntity(FILE_SCHEMA, lexer) {}
std::string createTimestamp() {
char buf[255];
time_t t;
time(&t);
struct tm* ti = localtime(&t);
std::string result = "";
if (strftime(buf, 255, "%Y-%m-%dT%H:%M:%S", ti)) {
result = std::string(buf);
}
return result;
}
void IfcSpfHeader::set_default() {
const std::string empty_string = "";
std::vector<std::string> file_description_vector, schema_identifiers, empty_vector;
file_description_vector.push_back("ViewDefinition [CoordinationView]");
schema_identifiers.push_back(IfcSchema::Identifier);
file_description().description(file_description_vector);
file_description().implementation_level("2;1");
file_name().name(empty_string);
file_name().time_stamp(createTimestamp());
file_name().author(empty_vector);
file_name().organization(empty_vector);
file_name().preprocessor_version("IfcOpenShell " IFCOPENSHELL_VERSION);
file_name().originating_system("IfcOpenShell " IFCOPENSHELL_VERSION);
file_name().authorization(empty_string);
file_schema().schema_identifiers(schema_identifiers);
}
+2
View File
@@ -193,6 +193,8 @@ public:
FileDescription& file_description();
FileName& file_name();
FileSchema& file_schema();
void set_default();
};
}