mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
Fix wrapper code
This commit is contained in:
@@ -133,9 +133,9 @@ public:
|
||||
|
||||
std::pair<IfcSchema::IfcNamedUnit*, double> getUnit(IfcSchema::IfcUnitEnum::IfcUnitEnum);
|
||||
|
||||
const schema_definition* schema() const { return schema_; }
|
||||
const IfcParse::schema_definition* schema() const { return schema_; }
|
||||
|
||||
void write_hdf5(const std::string&, const Hdf5Settings&);
|
||||
void write_hdf5(const std::string&, const IfcParse::Hdf5Settings&);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -280,3 +280,8 @@ std::vector<std::string> IfcParse::IfcLateBoundEntity::getInverseAttributeNames(
|
||||
std::copy(values.begin(), values.end(), std::back_inserter(return_value));
|
||||
return return_value;
|
||||
}
|
||||
|
||||
const IfcParse::declaration& IfcParse::IfcLateBoundEntity::declaration() const {
|
||||
// TODO: Bound instances to a file and use according schema
|
||||
return *get_schema().declaration_by_name(_type);
|
||||
}
|
||||
@@ -87,14 +87,7 @@ namespace IfcParse {
|
||||
const IfcAbstractEntity& data() const { return *data_; }
|
||||
IfcAbstractEntity& data() { return *data_; }
|
||||
|
||||
virtual const IfcParse::declaration& declaration() const {
|
||||
if (data().file) {
|
||||
throw;
|
||||
// data().file->
|
||||
} else {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
const IfcParse::declaration& IfcParse::IfcLateBoundEntity::declaration() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -922,9 +922,7 @@ IfcFile::IfcFile(bool create_latebound_entities)
|
||||
, tokens(0)
|
||||
, MaxId(0)
|
||||
{
|
||||
if (!create_latebound_entities) {
|
||||
schema_ = &get_schema();
|
||||
}
|
||||
schema_ = &get_schema();
|
||||
setDefaultHeaderValues();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include "../ifcparse/IfcException.h"
|
||||
|
||||
#ifdef USE_IFC4
|
||||
#include "../ifcparse/Ifc4enum.h"
|
||||
#else
|
||||
@@ -360,7 +364,22 @@ namespace IfcParse {
|
||||
class declaration_by_name_cmp : public std::binary_function<const declaration*, const std::string&, bool> {
|
||||
public:
|
||||
bool operator()(const declaration* decl, const std::string& name) {
|
||||
return decl->name() < name;
|
||||
// TODO: Efficiency?
|
||||
return boost::to_lower_copy(decl->name()) < boost::to_lower_copy(name);
|
||||
}
|
||||
};
|
||||
|
||||
class declaration_by_enum_cmp : public std::binary_function<const declaration*, IfcSchema::Type::Enum, bool> {
|
||||
public:
|
||||
bool operator()(const declaration* decl, IfcSchema::Type::Enum name) {
|
||||
return decl->type() < name;
|
||||
}
|
||||
};
|
||||
|
||||
class declaration_by_enum_sort : public std::binary_function<const declaration*, const declaration*, bool> {
|
||||
public:
|
||||
bool operator()(const declaration* a, const declaration* b) {
|
||||
return a->type() < b->type();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -370,12 +389,13 @@ namespace IfcParse {
|
||||
, declarations_(declarations)
|
||||
, built_in_(built_in)
|
||||
{
|
||||
std::sort(declarations_.begin(), declarations_.end(), declaration_by_enum_sort());
|
||||
for (std::vector<const declaration*>::const_iterator it = declarations_.begin(); it != declarations_.end(); ++it) {
|
||||
if ((**it).as_type_declaration()) type_declarations_.push_back((**it).as_type_declaration());
|
||||
if ((**it).as_select_type()) select_types_.push_back((**it).as_select_type());
|
||||
if ((**it).as_enumeration_type()) enumeration_types_.push_back((**it).as_enumeration_type());
|
||||
if ((**it).as_entity()) entities_.push_back((**it).as_entity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
~schema_definition() {
|
||||
@@ -386,8 +406,8 @@ namespace IfcParse {
|
||||
|
||||
const declaration* declaration_by_name(const std::string& name) const {
|
||||
std::vector<const declaration*>::const_iterator it = std::lower_bound(declarations_.begin(), declarations_.end(), name, declaration_by_name_cmp());
|
||||
if (it == declarations_.end() || (**it).name() != name) {
|
||||
throw;
|
||||
if (it == declarations_.end() || boost::to_lower_copy((**it).name()) != boost::to_lower_copy(name)) {
|
||||
throw IfcParse::IfcException("Entity with '" + name + "' not found");
|
||||
} else {
|
||||
return *it;
|
||||
}
|
||||
@@ -395,7 +415,7 @@ namespace IfcParse {
|
||||
|
||||
const declaration* declaration_by_name(IfcSchema::Type::Enum name) const {
|
||||
if (!built_in_) throw;
|
||||
return declaration_by_name(IfcSchema::Type::ToString(name));
|
||||
return declarations_[name];
|
||||
}
|
||||
|
||||
const std::vector<const declaration*>& declarations() const { return declarations_; }
|
||||
|
||||
Reference in New Issue
Block a user