mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
#1311 better error handling during parse for schema and header
This commit is contained in:
+33
-2
@@ -33,6 +33,36 @@
|
||||
|
||||
namespace IfcParse {
|
||||
|
||||
class IFC_PARSE_API file_open_status {
|
||||
public:
|
||||
enum file_open_enum {
|
||||
SUCCESS,
|
||||
READ_ERROR,
|
||||
NO_HEADER,
|
||||
UNSUPPORTED_SCHEMA
|
||||
};
|
||||
|
||||
private:
|
||||
file_open_enum error_;
|
||||
|
||||
public:
|
||||
file_open_status(file_open_enum error)
|
||||
: error_(error)
|
||||
{}
|
||||
|
||||
operator file_open_enum() const {
|
||||
return error_;
|
||||
}
|
||||
|
||||
file_open_enum value() const {
|
||||
return error_;
|
||||
}
|
||||
|
||||
operator bool() const {
|
||||
return error_ == SUCCESS;
|
||||
}
|
||||
};
|
||||
|
||||
/// This class provides several static convenience functions and variables
|
||||
/// and provide access to the entities in an IFC file
|
||||
class IFC_PARSE_API IfcFile {
|
||||
@@ -78,7 +108,8 @@ public:
|
||||
private:
|
||||
typedef std::map<IfcUtil::IfcBaseClass*, IfcUtil::IfcBaseClass*> entity_entity_map_t;
|
||||
|
||||
bool parsing_complete_, good_;
|
||||
bool parsing_complete_;
|
||||
file_open_status good_ = file_open_status::SUCCESS;
|
||||
|
||||
const IfcParse::schema_definition* schema_;
|
||||
const IfcParse::declaration* ifcroot_type_;
|
||||
@@ -116,7 +147,7 @@ public:
|
||||
|
||||
virtual ~IfcFile();
|
||||
|
||||
bool good() const { return good_; }
|
||||
file_open_status good() const { return good_; }
|
||||
|
||||
/// Returns the first entity in the file, this probably is the entity
|
||||
/// with the lowest id (EXPRESS ENTITY_INSTANCE_NAME)
|
||||
|
||||
Reference in New Issue
Block a user