Base: make UnitsApi::toNumber method of Quantity

This static method takes Quantity as a parameter, so make it
method of Quantity directly.
This commit is contained in:
Ladislav Michl
2025-04-06 22:38:01 +02:00
parent e3852f7732
commit 8eea79fe05
6 changed files with 41 additions and 58 deletions

View File

@@ -217,5 +217,6 @@ PyObject* UnitsApi::sToNumber(PyObject* /*self*/, PyObject* args)
return nullptr;
}
return Py::new_reference_to(Py::String(toNumber(value, qf)));
const Quantity quantity {value};
return Py::new_reference_to(Py::String(quantity.toNumber(qf)));
}