mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
ifcparse refactoring (#190)
Unify attribute containers, provide latebound attribute access on IfcBaseEntity, more basic tests on Travis
This commit is contained in:
@@ -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, ">", ">");
|
||||
boost::replace_all(str, "&", "&");
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user