mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
Fix exception in file.from_string()
This commit is contained in:
@@ -318,9 +318,9 @@ private:
|
|||||||
const IfcSpfHeader& header() const { return _header; }
|
const IfcSpfHeader& header() const { return _header; }
|
||||||
IfcSpfHeader& header() { return _header; }
|
IfcSpfHeader& header() { return _header; }
|
||||||
|
|
||||||
static std::string createTimestamp() ;
|
static std::string createTimestamp();
|
||||||
|
|
||||||
const IfcParse::schema_definition* schema() const { return schema_; }
|
const IfcParse::schema_definition* schema() const;
|
||||||
|
|
||||||
std::pair<IfcUtil::IfcBaseClass*, double> getUnit(const std::string& unit_type);
|
std::pair<IfcUtil::IfcBaseClass*, double> getUnit(const std::string& unit_type);
|
||||||
|
|
||||||
|
|||||||
@@ -1404,6 +1404,7 @@ IfcFile::IfcFile(std::istream& stream, int length)
|
|||||||
IfcSpfStream s(stream, length);
|
IfcSpfStream s(stream, length);
|
||||||
storage_.emplace<1>(this);
|
storage_.emplace<1>(this);
|
||||||
std::get<impl::in_memory_file_storage>(storage_).read_from_stream(&s, schema_, max_id_);
|
std::get<impl::in_memory_file_storage>(storage_).read_from_stream(&s, schema_, max_id_);
|
||||||
|
good_ = std::get<impl::in_memory_file_storage>(storage_).good_;
|
||||||
ifcroot_type_ = schema_ ? schema_->declaration_by_name("IfcRoot") : nullptr;
|
ifcroot_type_ = schema_ ? schema_->declaration_by_name("IfcRoot") : nullptr;
|
||||||
|
|
||||||
byid_ = decltype(byid_)(&std::get<impl::in_memory_file_storage>(storage_).byid_);
|
byid_ = decltype(byid_)(&std::get<impl::in_memory_file_storage>(storage_).byid_);
|
||||||
@@ -1418,6 +1419,7 @@ IfcFile::IfcFile(void* data, int length)
|
|||||||
IfcSpfStream s(data, length);
|
IfcSpfStream s(data, length);
|
||||||
storage_.emplace<1>(this);
|
storage_.emplace<1>(this);
|
||||||
std::get<impl::in_memory_file_storage>(storage_).read_from_stream(&s, schema_, max_id_);
|
std::get<impl::in_memory_file_storage>(storage_).read_from_stream(&s, schema_, max_id_);
|
||||||
|
good_ = std::get<impl::in_memory_file_storage>(storage_).good_;
|
||||||
ifcroot_type_ = schema_ ? schema_->declaration_by_name("IfcRoot") : nullptr;
|
ifcroot_type_ = schema_ ? schema_->declaration_by_name("IfcRoot") : nullptr;
|
||||||
|
|
||||||
byid_ = decltype(byid_)(&std::get<impl::in_memory_file_storage>(storage_).byid_);
|
byid_ = decltype(byid_)(&std::get<impl::in_memory_file_storage>(storage_).byid_);
|
||||||
@@ -1431,6 +1433,7 @@ IfcFile::IfcFile(IfcParse::IfcSpfStream* s)
|
|||||||
{
|
{
|
||||||
storage_.emplace<1>(this);
|
storage_.emplace<1>(this);
|
||||||
std::get<impl::in_memory_file_storage>(storage_).read_from_stream(s, schema_, max_id_);
|
std::get<impl::in_memory_file_storage>(storage_).read_from_stream(s, schema_, max_id_);
|
||||||
|
good_ = std::get<impl::in_memory_file_storage>(storage_).good_;
|
||||||
ifcroot_type_ = schema_ ? schema_->declaration_by_name("IfcRoot") : nullptr;
|
ifcroot_type_ = schema_ ? schema_->declaration_by_name("IfcRoot") : nullptr;
|
||||||
|
|
||||||
byid_ = decltype(byid_)(&std::get<impl::in_memory_file_storage>(storage_).byid_);
|
byid_ = decltype(byid_)(&std::get<impl::in_memory_file_storage>(storage_).byid_);
|
||||||
@@ -2512,6 +2515,13 @@ std::string IfcFile::createTimestamp() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const IfcParse::schema_definition* IfcFile::schema() const {
|
||||||
|
if (schema_ == nullptr) {
|
||||||
|
throw IfcException("No schema loaded");
|
||||||
|
}
|
||||||
|
return schema_;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<int> IfcFile::get_inverse_indices(int instance_id) {
|
std::vector<int> IfcFile::get_inverse_indices(int instance_id) {
|
||||||
std::vector<int> return_value;
|
std::vector<int> return_value;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user