Improve docs. Make getFieldT(offset) use vector::at.

This commit is contained in:
Bruno Martins
2019-05-20 15:49:00 -04:00
committed by mdavidsaver
parent a29894ee2b
commit 4dd7a18301
3 changed files with 112 additions and 94 deletions

View File

@@ -566,20 +566,6 @@ FieldConstPtr Structure::getFieldImpl(string const & fieldName, bool throws) con
}
}
FieldConstPtr Structure::getFieldImpl(size_t fieldOffset, bool throws) const {
if (fieldOffset < fields.size())
return fields[fieldOffset];
if (throws) {
std::stringstream ss;
ss << "Failed to get field with offset "
<< fieldOffset << " (Invalid offset)";
throw std::runtime_error(ss.str());
} else {
return FieldConstPtr();
}
}
std::ostream& Structure::dump(std::ostream& o) const
{
o << format::indent() << getID() << std::endl;
@@ -794,20 +780,6 @@ FieldConstPtr Union::getFieldImpl(string const & fieldName, bool throws) const {
}
}
FieldConstPtr Union::getFieldImpl(size_t fieldOffset, bool throws) const {
if (fieldOffset < fields.size())
return fields[fieldOffset];
if (throws) {
std::stringstream ss;
ss << "Failed to get field with offset "
<< fieldOffset << " (Invalid offset)";
throw std::runtime_error(ss.str());
} else {
return FieldConstPtr();
}
}
std::ostream& Union::dump(std::ostream& o) const
{
o << format::indent() << getID() << std::endl;