ifcparse refactoring (#190)

Unify attribute containers, provide latebound attribute access on IfcBaseEntity, more basic tests on Travis
This commit is contained in:
Thomas Krijnen
2017-06-05 17:26:58 +02:00
committed by GitHub
parent 9a43658716
commit 5e0da9725a
49 changed files with 9228 additions and 9416 deletions
+30 -1
View File
@@ -17,8 +17,16 @@
* *
********************************************************************************/
#include "IfcUtil.h"
#include "../ifcparse/IfcBaseClass.h"
#include "../ifcparse/Argument.h"
#include "../ifcparse/IfcException.h"
#include "../ifcparse/IfcEntityList.h"
#ifdef USE_IFC4
#include "../ifcparse/Ifc4-latebound.h"
#else
#include "../ifcparse/Ifc2x3-latebound.h"
#endif
#include <boost/algorithm/string/replace.hpp>
#include <boost/optional.hpp>
@@ -155,3 +163,24 @@ void IfcUtil::unescape_xml(std::string &str)
boost::replace_all(str, "&gt;", ">");
boost::replace_all(str, "&amp;", "&");
}
std::vector<std::string> IfcUtil::IfcBaseEntity::getAttributeNames() const {
std::vector<std::string> return_value;
return_value.reserve(getArgumentCount());
for (unsigned i = 0; i < getArgumentCount(); ++i) {
return_value.push_back(getArgumentName(i));
}
return return_value;
}
std::vector<std::string> IfcUtil::IfcBaseEntity::getInverseAttributeNames() const {
std::vector<std::string> return_value;
std::set<std::string> values = IfcSchema::Type::GetInverseAttributeNames(entity->type());
std::copy(values.begin(), values.end(), std::back_inserter(return_value));
return return_value;
}
Argument* IfcUtil::IfcBaseEntity::getArgumentByName(const std::string& name) const {
unsigned int i = IfcSchema::Type::GetAttributeIndex(type(), name);
return getArgument(i);
}