Review feedback from @gregtatcam, plus a few extras

- Rename MantissaRange::Get to MantissaRange::Access. The name doesn't
  really matter, but since the intent of the class is to control access
  to one function, this works.
- Exclude the MantissaScale enum from linting for
  readability-enum-initial-value. clang-tidy was complaining that
  "error: initial values in enum 'xrpl::MantissaRange::MantissaScale'
  are not consistent, consider explicit initialization of all, none or
  only the first enumerator", but I don't care. I just need Large to
  match the last value.
- Add a static_assert in setCurrentTransactionRules, so that if another
  MantissaScale is added (and Large is properly updated), the engineer
  won't forget to add a case for it there.
This commit is contained in:
Ed Hennis
2026-06-25 19:02:53 -04:00
parent 4ff398ba2d
commit 2a5b1b4e17
3 changed files with 8 additions and 4 deletions

View File

@@ -127,6 +127,7 @@ struct MantissaRange final
using rep = std::uint64_t;
enum class MantissaScale {
// NOLINTBEGIN(readability-enum-initial-value) - The values don't matter, except for Large
// Small can be removed when either featureSingleAssetVault or featureLendingProtocol are
// retired
Small,
@@ -140,6 +141,7 @@ struct MantissaRange final
// in the extremely unlikely case that a downstream project made use of it. Note that
// because the behavior changed, this may still be a breaking change.
Large = Large330,
// NOLINTEND(readability-enum-initial-value)
};
// This entire enum can be removed when the last relevant amendment is retired
@@ -178,7 +180,7 @@ struct MantissaRange final
return kScales;
}
class Get
class Access
{
static constexpr MantissaRange const&
mantissaRange(MantissaScale scale);