mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-25 05:25:55 +00:00
refactor: use east const convention (#5409)
This change refactors the codebase to use the "east const convention", and adds a clang-format rule to follow this convention.
This commit is contained in:
@@ -139,27 +139,27 @@ class FeatureCollections
|
||||
{
|
||||
if (i >= features.size())
|
||||
LogicError("Invalid FeatureBitset index");
|
||||
const auto& sequence = features.get<Feature::byIndex>();
|
||||
auto const& sequence = features.get<Feature::byIndex>();
|
||||
return sequence[i];
|
||||
}
|
||||
size_t
|
||||
getIndex(Feature const& feature) const
|
||||
{
|
||||
const auto& sequence = features.get<Feature::byIndex>();
|
||||
auto const& sequence = features.get<Feature::byIndex>();
|
||||
auto const it_to = sequence.iterator_to(feature);
|
||||
return it_to - sequence.begin();
|
||||
}
|
||||
Feature const*
|
||||
getByFeature(uint256 const& feature) const
|
||||
{
|
||||
const auto& feature_index = features.get<Feature::byFeature>();
|
||||
auto const& feature_index = features.get<Feature::byFeature>();
|
||||
auto const feature_it = feature_index.find(feature);
|
||||
return feature_it == feature_index.end() ? nullptr : &*feature_it;
|
||||
}
|
||||
Feature const*
|
||||
getByName(std::string const& name) const
|
||||
{
|
||||
const auto& name_index = features.get<Feature::byName>();
|
||||
auto const& name_index = features.get<Feature::byName>();
|
||||
auto const name_it = name_index.find(name);
|
||||
return name_it == name_index.end() ? nullptr : &*name_it;
|
||||
}
|
||||
@@ -240,7 +240,7 @@ FeatureCollections::getRegisteredFeature(std::string const& name) const
|
||||
}
|
||||
|
||||
void
|
||||
check(bool condition, const char* logicErrorMessage)
|
||||
check(bool condition, char const* logicErrorMessage)
|
||||
{
|
||||
if (!condition)
|
||||
LogicError(logicErrorMessage);
|
||||
@@ -437,9 +437,13 @@ featureToName(uint256 const& f)
|
||||
uint256 const feature##name = registerFeature(#name, supported, vote);
|
||||
#define XRPL_FIX(name, supported, vote) \
|
||||
uint256 const fix##name = registerFeature("fix" #name, supported, vote);
|
||||
#define XRPL_RETIRE(name) \
|
||||
[[deprecated("The referenced amendment has been retired"), maybe_unused]] \
|
||||
|
||||
// clang-format off
|
||||
#define XRPL_RETIRE(name) \
|
||||
[[deprecated("The referenced amendment has been retired")]] \
|
||||
[[maybe_unused]] \
|
||||
uint256 const retired##name = retireFeature(#name);
|
||||
// clang-format on
|
||||
|
||||
#include <xrpl/protocol/detail/features.macro>
|
||||
|
||||
@@ -455,7 +459,7 @@ featureToName(uint256 const& f)
|
||||
//
|
||||
// Use initialization of one final static variable to set
|
||||
// featureCollections::readOnly.
|
||||
[[maybe_unused]] static const bool readOnlySet =
|
||||
[[maybe_unused]] static bool const readOnlySet =
|
||||
featureCollections.registrationIsDone();
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
Reference in New Issue
Block a user