mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 20:42:27 +00:00
set_default() on spf header
This commit is contained in:
@@ -127,8 +127,6 @@ public:
|
|||||||
const IfcSpfHeader& header() const { return _header; }
|
const IfcSpfHeader& header() const { return _header; }
|
||||||
IfcSpfHeader& header() { return _header; }
|
IfcSpfHeader& header() { return _header; }
|
||||||
|
|
||||||
std::string createTimestamp() const;
|
|
||||||
|
|
||||||
bool create_latebound_entities() const { return _create_latebound_entities; }
|
bool create_latebound_entities() const { return _create_latebound_entities; }
|
||||||
|
|
||||||
std::pair<IfcSchema::IfcNamedUnit*, double> getUnit(IfcSchema::IfcUnitEnum::IfcUnitEnum);
|
std::pair<IfcSchema::IfcNamedUnit*, double> getUnit(IfcSchema::IfcUnitEnum::IfcUnitEnum);
|
||||||
|
|||||||
@@ -1492,22 +1492,6 @@ std::ostream& operator<< (std::ostream& os, const IfcParse::IfcFile& f) {
|
|||||||
return os;
|
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) {
|
IfcEntityList::ptr IfcFile::getInverse(int instance_id, IfcSchema::Type::Enum type, int attribute_index) {
|
||||||
IfcUtil::IfcBaseClass* instance = entityById(instance_id);
|
IfcUtil::IfcBaseClass* instance = entityById(instance_id);
|
||||||
|
|
||||||
@@ -1538,24 +1522,7 @@ IfcEntityList::ptr IfcFile::getInverse(int instance_id, IfcSchema::Type::Enum ty
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IfcFile::setDefaultHeaderValues() {
|
void IfcFile::setDefaultHeaderValues() {
|
||||||
const std::string empty_string = "";
|
header().set_default();
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<IfcSchema::IfcNamedUnit*, double> IfcFile::getUnit(IfcSchema::IfcUnitEnum::IfcUnitEnum type) {
|
std::pair<IfcSchema::IfcNamedUnit*, double> IfcFile::getUnit(IfcSchema::IfcUnitEnum::IfcUnitEnum type) {
|
||||||
|
|||||||
@@ -148,3 +148,40 @@ FileSchema& IfcSpfHeader::file_schema() {
|
|||||||
FileDescription::FileDescription(IfcSpfLexer* lexer) : HeaderEntity(FILE_DESCRIPTION, lexer) {}
|
FileDescription::FileDescription(IfcSpfLexer* lexer) : HeaderEntity(FILE_DESCRIPTION, lexer) {}
|
||||||
FileName::FileName(IfcSpfLexer* lexer) : HeaderEntity(FILE_NAME, 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);
|
||||||
|
}
|
||||||
@@ -193,6 +193,8 @@ public:
|
|||||||
FileDescription& file_description();
|
FileDescription& file_description();
|
||||||
FileName& file_name();
|
FileName& file_name();
|
||||||
FileSchema& file_schema();
|
FileSchema& file_schema();
|
||||||
|
|
||||||
|
void set_default();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user