mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-28 19:27:10 +00:00
Initialise string to type map
This commit is contained in:
@@ -125,6 +125,7 @@ void %(schema_name)s::InitStringMap() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Type::Enum Type::FromString(const std::string& s) {
|
Type::Enum Type::FromString(const std::string& s) {
|
||||||
|
if (string_map.empty()) InitStringMap();
|
||||||
std::map<std::string,Type::Enum>::const_iterator it = string_map.find(s);
|
std::map<std::string,Type::Enum>::const_iterator it = string_map.find(s);
|
||||||
if ( it == string_map.end() ) throw IfcException("Unable to find find keyword in schema");
|
if ( it == string_map.end() ) throw IfcException("Unable to find find keyword in schema");
|
||||||
else return it->second;
|
else return it->second;
|
||||||
|
|||||||
@@ -1791,6 +1791,7 @@ void Ifc2x3::InitStringMap() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Type::Enum Type::FromString(const std::string& s) {
|
Type::Enum Type::FromString(const std::string& s) {
|
||||||
|
if (string_map.empty()) InitStringMap();
|
||||||
std::map<std::string,Type::Enum>::const_iterator it = string_map.find(s);
|
std::map<std::string,Type::Enum>::const_iterator it = string_map.find(s);
|
||||||
if ( it == string_map.end() ) throw IfcException("Unable to find find keyword in schema");
|
if ( it == string_map.end() ) throw IfcException("Unable to find find keyword in schema");
|
||||||
else return it->second;
|
else return it->second;
|
||||||
|
|||||||
@@ -2091,6 +2091,7 @@ void Ifc4::InitStringMap() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Type::Enum Type::FromString(const std::string& s) {
|
Type::Enum Type::FromString(const std::string& s) {
|
||||||
|
if (string_map.empty()) InitStringMap();
|
||||||
std::map<std::string,Type::Enum>::const_iterator it = string_map.find(s);
|
std::map<std::string,Type::Enum>::const_iterator it = string_map.find(s);
|
||||||
if ( it == string_map.end() ) throw IfcException("Unable to find find keyword in schema");
|
if ( it == string_map.end() ) throw IfcException("Unable to find find keyword in schema");
|
||||||
else return it->second;
|
else return it->second;
|
||||||
|
|||||||
Reference in New Issue
Block a user