#1730 correctly register inverse attributes on rooted types

This commit is contained in:
Thomas Krijnen
2021-09-10 09:27:07 +02:00
parent 3bebfcd8a7
commit 09d6f1130d
2 changed files with 10 additions and 7 deletions
+1 -1
View File
@@ -283,7 +283,7 @@ public:
std::string createTimestamp() const;
size_t load(unsigned entity_instance_name, const IfcParse::entity* entity, Argument**& attributes, size_t num_attributes);
size_t load(unsigned entity_instance_name, const IfcParse::entity* entity, Argument**& attributes, size_t num_attributes, int attribute_index=-1);
void seek_to(const IfcEntityInstanceData& data);
void try_read_semicolon();
+9 -6
View File
@@ -685,7 +685,7 @@ namespace {
// Reads the arguments from a list of token
// Aditionally, registers the ids (i.e. #[\d]+) in the inverse map
//
size_t IfcParse::IfcFile::load(unsigned entity_instance_name, const IfcParse::entity* entity, Argument**& attributes, size_t num_attributes) {
size_t IfcParse::IfcFile::load(unsigned entity_instance_name, const IfcParse::entity* entity, Argument**& attributes, size_t num_attributes, int attribute_index) {
Token next = tokens->Next();
std::vector<Argument*>* vector = 0;
@@ -707,23 +707,26 @@ size_t IfcParse::IfcFile::load(unsigned entity_instance_name, const IfcParse::en
ArgumentList* alist = new ArgumentList();
// entity is passed along here, after all the it is the type of the instance
// that owns the list that is significant for inverse attributes
alist->size() = load(entity_instance_name, entity, alist->arguments(), 0);
alist->size() = load(entity_instance_name, entity, alist->arguments(), 0, attribute_index == -1 ? (int)filler.index() : attribute_index);
filler.push_back(alist);
} else {
return_value++;
if ( TokenFunc::isIdentifier(next) ) {
if (TokenFunc::isIdentifier(next)) {
if (!parsing_complete_) {
register_inverse(entity_instance_name, entity, next, (int) filler.index());
register_inverse(entity_instance_name, entity, next, attribute_index == -1 ? (int)filler.index() : attribute_index);
}
} if ( TokenFunc::isKeyword(next) ) {
}
if (TokenFunc::isKeyword(next)) {
try {
filler.push_back(new EntityArgument(next));
} catch ( IfcException& e ) {
} catch (IfcException& e) {
Logger::Message(Logger::LOG_ERROR, e.what());
}
} else {
filler.push_back(new TokenArgument(next));
}
}
next = tokens->Next();
}