Throw exceptions rather than return default 0

This commit is contained in:
bgbsww
2024-07-19 08:53:55 -04:00
parent 3efba18ad4
commit 4e0f64f57a
2 changed files with 53 additions and 5 deletions

View File

@@ -111,20 +111,18 @@ unsigned int Base::XMLReader::getAttributeCount() const
long Base::XMLReader::getAttributeAsInteger(const char* AttrName, const char* defaultValue) const
{
const int base = 10;
return strtol(getAttribute(AttrName, defaultValue), nullptr, base);
return stol(getAttribute(AttrName, defaultValue));
}
unsigned long Base::XMLReader::getAttributeAsUnsigned(const char* AttrName,
const char* defaultValue) const
{
const int base = 10;
return strtoul(getAttribute(AttrName, defaultValue), nullptr, base);
return stoul(getAttribute(AttrName, defaultValue), nullptr);
}
double Base::XMLReader::getAttributeAsFloat(const char* AttrName, const char* defaultValue) const
{
return strtod(getAttribute(AttrName, defaultValue), nullptr);
return stod(getAttribute(AttrName, defaultValue), nullptr);
}
const char* Base::XMLReader::getAttribute(const char* AttrName, // NOLINT