Fixes for compilation on clang

This commit is contained in:
Thomas Krijnen
2024-08-21 08:48:39 +02:00
parent 261fb895eb
commit 2e27ff64b4
4 changed files with 34 additions and 27 deletions
+29 -1
View File
@@ -99,9 +99,9 @@ protected:
public:
IfcBaseClass(IfcEntityInstanceData&& data)
: identity_(counter_++)
, data_(std::move(data))
, id_(0)
, file_(nullptr)
, data_(std::move(data))
{}
const IfcEntityInstanceData& data() const { return data_; }
@@ -191,6 +191,34 @@ T IfcBaseEntity::get_value(const std::string& name, const T& default_value) cons
}
return (T) attr;
}
} // namespace IfcUtil
template <class U>
typename U::list::ptr aggregate_of_instance::as() {
typename U::list::ptr result(new typename U::list);
for (it i = begin(); i != end(); ++i) {
if ((*i)->template as<U>()) {
result->push((*i)->template as<U>());
}
}
return result;
}
template <class U>
typename aggregate_of_aggregate_of<U>::ptr aggregate_of_aggregate_of_instance::as() {
typename aggregate_of_aggregate_of<U>::ptr result(new aggregate_of_aggregate_of<U>);
for (outer_it outer = begin(); outer != end(); ++outer) {
const std::vector<IfcUtil::IfcBaseClass*>& from = *outer;
typename std::vector<U*> to;
for (inner_it inner = from.begin(); inner != from.end(); ++inner) {
if ((*inner)->template as<U>()) {
to.push_back((*inner)->template as<U>());
}
}
result->push(to);
}
return result;
}
#endif
+1 -1
View File
@@ -1422,7 +1422,7 @@ void IfcFile::initialize_(IfcParse::IfcSpfStream* s) {
}
byid_[p.first.name_]->data().storage_.set(p.first.index_, instances);
} else {
static_assert(false, "Inconsistent type");
// static_assert(false, "Inconsistent type");
}
}, p.second);
}
+2 -23
View File
@@ -52,15 +52,7 @@ class IFC_PARSE_API aggregate_of_instance {
bool contains(IfcUtil::IfcBaseClass*) const;
template <class U>
typename U::list::ptr as() {
typename U::list::ptr result(new typename U::list);
for (it i = begin(); i != end(); ++i) {
if ((*i)->template as<U>()) {
result->push((*i)->template as<U>());
}
}
return result;
}
typename U::list::ptr as();
void remove(IfcUtil::IfcBaseClass*);
aggregate_of_instance::ptr filtered(const std::set<const IfcParse::declaration*>& entities);
@@ -158,20 +150,7 @@ class IFC_PARSE_API aggregate_of_aggregate_of_instance {
}
template <class U>
typename aggregate_of_aggregate_of<U>::ptr as() {
typename aggregate_of_aggregate_of<U>::ptr result(new aggregate_of_aggregate_of<U>);
for (outer_it outer = begin(); outer != end(); ++outer) {
const std::vector<IfcUtil::IfcBaseClass*>& from = *outer;
typename std::vector<U*> to;
for (inner_it inner = from.begin(); inner != from.end(); ++inner) {
if ((*inner)->template as<U>()) {
to.push_back((*inner)->template as<U>());
}
}
result->push(to);
}
return result;
}
typename aggregate_of_aggregate_of<U>::ptr as();
};
+2 -2
View File
@@ -357,7 +357,7 @@ static void process_characters(void* user, const xmlChar* character, int len) {
auto val = parse_attribute_value(pt, txt);
if (!val.empty()) {
visit_any([&state](auto& v) {
state->stack.back().inst()->data().setArgument(state->stack.back().idx(), v);
state->stack.back().inst()->set_attribute_value(state->stack.back().idx(), v);
}, val);
}
}
@@ -494,7 +494,7 @@ static void start_element(void* user, const xmlChar* tag, const xmlChar** attrs)
auto val = parse_attribute_value(attr->type_of_attribute(), pair.second);
if (!val.empty()) {
visit_any([&untyped, idx](auto& v) {
untyped->data().storage_->set_attribute_value(idx, v);
untyped.storage_.set(idx, v);
}, val);
}
} else {