All: Reformat according to new standard
This commit is contained in:
committed by
Kacper Donat
parent
eafd18dac0
commit
25c3ba7338
@@ -110,20 +110,24 @@ constexpr auto unitSpecs = std::to_array<UnitSpec>({
|
||||
{ "YoungsModulus" , { -1, 1, -2 } },
|
||||
}); // clang-format on
|
||||
|
||||
Unit::Unit(const int length, // NOLINT
|
||||
const int mass,
|
||||
const int time,
|
||||
const int electricCurrent,
|
||||
const int thermodynamicTemperature,
|
||||
const int amountOfSubstance,
|
||||
const int luminousIntensity,
|
||||
const int angle)
|
||||
Unit::Unit(
|
||||
const int length, // NOLINT
|
||||
const int mass,
|
||||
const int time,
|
||||
const int electricCurrent,
|
||||
const int thermodynamicTemperature,
|
||||
const int amountOfSubstance,
|
||||
const int luminousIntensity,
|
||||
const int angle
|
||||
)
|
||||
: _name {""}
|
||||
{
|
||||
auto cast = [](auto val) {
|
||||
return static_cast<int8_t>(std::clamp<decltype(val)>(val,
|
||||
std::numeric_limits<int8_t>::min(),
|
||||
std::numeric_limits<int8_t>::max()));
|
||||
return static_cast<int8_t>(std::clamp<decltype(val)>(
|
||||
val,
|
||||
std::numeric_limits<int8_t>::min(),
|
||||
std::numeric_limits<int8_t>::max()
|
||||
));
|
||||
};
|
||||
|
||||
_exps[0] = cast(length);
|
||||
@@ -257,10 +261,11 @@ std::string Unit::getString() const
|
||||
|
||||
auto denominatorStr = buildStr(negValIndexes);
|
||||
|
||||
return fmt::format("{}/{}",
|
||||
numeratorStr.empty() ? "1" : numeratorStr,
|
||||
negValIndexes.size() > 1 ? fmt::format("({})", denominatorStr)
|
||||
: denominatorStr);
|
||||
return fmt::format(
|
||||
"{}/{}",
|
||||
numeratorStr.empty() ? "1" : numeratorStr,
|
||||
negValIndexes.size() > 1 ? fmt::format("({})", denominatorStr) : denominatorStr
|
||||
);
|
||||
}
|
||||
|
||||
std::string Unit::representation() const
|
||||
|
||||
Reference in New Issue
Block a user