Introduce specific exception for out of range attribute indexing

This commit is contained in:
Thomas Krijnen
2015-06-17 11:04:28 +00:00
parent 381f711103
commit 1ec14118fe
10 changed files with 748 additions and 742 deletions
+5 -9
View File
@@ -650,7 +650,7 @@ unsigned int ArgumentList::size() const { return (unsigned int) list.size(); }
Argument* ArgumentList::operator [] (unsigned int i) const {
if ( i >= list.size() ) {
throw IfcException("Argument index out of range");
throw IfcAttributeOutOfRangeException("Argument index out of range");
}
return list[i];
}
@@ -951,7 +951,7 @@ bool IfcFile::Init(IfcParse::IfcSpfStream* s) {
} else {
entity = IfcSchema::SchemaEntity(e);
}
} catch (IfcException ex) {
} catch (const IfcException& ex) {
currentId = 0;
Logger::Message(Logger::LOG_ERROR,ex.what());
continue;
@@ -971,7 +971,7 @@ bool IfcFile::Init(IfcParse::IfcSpfStream* s) {
Logger::Message(Logger::LOG_WARNING,ss.str());
}
byguid[guid] = ifc_root;
} catch (IfcException ex) {
} catch (const IfcException& ex) {
Logger::Message(Logger::LOG_ERROR,ex.what());
}
}
@@ -1176,7 +1176,7 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity) {
Logger::Message(Logger::LOG_WARNING,ss.str());
}
byguid[guid] = ifc_root;
} catch (IfcException ex) {
} catch (const IfcException& ex) {
Logger::Message(Logger::LOG_ERROR,ex.what());
}
}
@@ -1230,7 +1230,7 @@ IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity) {
}
refs->push(entity);
}
} catch (IfcParse::IfcException&) {}
} catch (const IfcParse::IfcException&) {}
}
return entity;
@@ -1382,10 +1382,6 @@ IfcSchema::IfcRoot* IfcFile::entityByGuid(const std::string& guid) {
}
}
IfcException::IfcException(std::string e) { error = e; }
IfcException::~IfcException() throw () {}
const char* IfcException::what() const throw() { return error.c_str(); }
// FIXME: Test destructor to delete entity and arg allocations
IfcFile::~IfcFile() {
for( entity_by_id_t::const_iterator it = byid.begin(); it != byid.end(); ++ it ) {