Auto-detect filetype

This commit is contained in:
Thomas Krijnen
2025-03-13 13:09:39 +01:00
parent 67932a22c3
commit df6b7a34f7
4 changed files with 72 additions and 20 deletions
+10 -6
View File
@@ -572,12 +572,16 @@ namespace impl {
}
enum filetype {
ifcspf,
ifcxml,
rocksdb,
autodetect
FT_IFCSPF,
FT_IFCXML,
FT_IFCZIP,
FT_ROCKSDB,
FT_UNKNOWN,
FT_AUTODETECT
};
filetype guess_file_type(const std::string& fn);
/// This class provides access to the entity instances in an IFC file
/// The file takes ownership of instances added to this file and deletes them when the file is deleted.
class IFC_PARSE_API IfcFile {
@@ -623,13 +627,13 @@ private:
#ifdef USE_MMAP
IfcFile(const std::string& path, bool mmap = false);
#else
IfcFile(const std::string& path, filetype ty=ifcspf);
IfcFile(const std::string& path, filetype ty=FT_AUTODETECT);
#endif
IfcFile(std::istream& stream, int length);
IfcFile(void* data, int length);
IfcFile(IfcParse::IfcSpfStream* stream);
// @nb path is only used in rocksdb mode, for spf file is in-memory only until write() is called
IfcFile(const IfcParse::schema_definition* schema = IfcParse::schema_by_name("IFC4"), filetype ty = ifcspf, const std::string& path = "");
IfcFile(const IfcParse::schema_definition* schema = IfcParse::schema_by_name("IFC4"), filetype ty = FT_AUTODETECT, const std::string& path = "");
~IfcFile();