App: Replace getAttributeAs{Integer,Float} with templated getAttribute
Template was introduced in https://github.com/FreeCAD/FreeCAD/pull/19907
This commit is contained in:
@@ -790,22 +790,22 @@ void PropertyIntegerConstraint::Restore(Base::XMLReader& reader)
|
||||
// read my Element
|
||||
reader.readElement("Integer");
|
||||
// get the value of my Attribute
|
||||
setValue(reader.getAttributeAsInteger("value"));
|
||||
setValue(reader.getAttribute<long>("value"));
|
||||
|
||||
bool createConstraint = false;
|
||||
long minimum = std::numeric_limits<int>::lowest();
|
||||
long maximum = std::numeric_limits<int>::max();
|
||||
long stepsize = 1.0;
|
||||
if (reader.hasAttribute("min")) {
|
||||
minimum = reader.getAttributeAsInteger("min");
|
||||
minimum = reader.getAttribute<long>("min");
|
||||
createConstraint = true;
|
||||
}
|
||||
if (reader.hasAttribute("max")) {
|
||||
maximum = reader.getAttributeAsInteger("max");
|
||||
maximum = reader.getAttribute<long>("max");
|
||||
createConstraint = true;
|
||||
}
|
||||
if (reader.hasAttribute("step")) {
|
||||
stepsize = reader.getAttributeAsInteger("step");
|
||||
stepsize = reader.getAttribute<long>("step");
|
||||
}
|
||||
|
||||
if (createConstraint) {
|
||||
@@ -1340,22 +1340,22 @@ void PropertyFloatConstraint::Restore(Base::XMLReader& reader)
|
||||
// read my Element
|
||||
reader.readElement("Float");
|
||||
// get the value of my Attribute
|
||||
setValue(reader.getAttributeAsFloat("value"));
|
||||
setValue(reader.getAttribute<double>("value"));
|
||||
|
||||
bool createConstraint = false;
|
||||
double minimum = std::numeric_limits<double>::lowest();
|
||||
double maximum = std::numeric_limits<double>::max();
|
||||
double stepsize = 1.0;
|
||||
if (reader.hasAttribute("min")) {
|
||||
minimum = reader.getAttributeAsFloat("min");
|
||||
minimum = reader.getAttribute<double>("min");
|
||||
createConstraint = true;
|
||||
}
|
||||
if (reader.hasAttribute("max")) {
|
||||
maximum = reader.getAttributeAsFloat("max");
|
||||
maximum = reader.getAttribute<double>("max");
|
||||
createConstraint = true;
|
||||
}
|
||||
if (reader.hasAttribute("step")) {
|
||||
stepsize = reader.getAttributeAsFloat("step");
|
||||
stepsize = reader.getAttribute<double>("step");
|
||||
}
|
||||
|
||||
if (createConstraint) {
|
||||
|
||||
Reference in New Issue
Block a user