refactor: Use more scoped enums (#7086)

This commit is contained in:
Alex Kremer
2026-05-11 16:39:48 +01:00
committed by GitHub
parent 779b49cd93
commit cdee9a675c
379 changed files with 2771 additions and 2864 deletions

View File

@@ -10,24 +10,11 @@
#include <map>
#include <memory>
#include <mutex>
#include <optional>
#include <utility>
namespace xrpl {
// DEPRECATED use beast::severities::Severity instead
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum LogSeverity {
LSInvalid = -1, // used to indicate an invalid severity
LSTrace = 0, // Very low-level progress information, details inside
// an operation
LSDebug = 1, // Function-level progress information, operations
LSInfo = 2, // Server-level progress information, major operations
LSWarning = 3, // Conditions that warrant human attention, may indicate
// a problem
LSError = 4, // A condition that indicates a problem
LSFatal = 5 // A severe condition that indicates a server problem
};
/** Manages partitions for logging. */
class Logs
{
@@ -39,17 +26,17 @@ private:
std::string partition_;
public:
Sink(std::string partition, beast::severities::Severity thresh, Logs& logs);
Sink(std::string partition, beast::Severity thresh, Logs& logs);
Sink(Sink const&) = delete;
Sink&
operator=(Sink const&) = delete;
void
write(beast::severities::Severity level, std::string const& text) override;
write(beast::Severity level, std::string const& text) override;
void
writeAlways(beast::severities::Severity level, std::string const& text) override;
writeAlways(beast::Severity level, std::string const& text) override;
};
/** Manages a system file containing logged output.
@@ -136,12 +123,12 @@ private:
std::mutex mutable mutex_;
std::map<std::string, std::unique_ptr<beast::Journal::Sink>, boost::beast::iless> sinks_;
beast::severities::Severity thresh_;
beast::Severity thresh_;
File file_;
bool silent_ = false;
public:
Logs(beast::severities::Severity level);
Logs(beast::Severity level);
Logs(Logs const&) = delete;
Logs&
@@ -161,18 +148,18 @@ public:
beast::Journal
journal(std::string const& name);
beast::severities::Severity
beast::Severity
threshold() const;
void
threshold(beast::severities::Severity thresh);
threshold(beast::Severity thresh);
std::vector<std::pair<std::string, std::string>>
partitionSeverities() const;
void
write(
beast::severities::Severity level,
beast::Severity level,
std::string const& partition,
std::string const& text,
bool console);
@@ -192,36 +179,25 @@ public:
}
virtual std::unique_ptr<beast::Journal::Sink>
makeSink(std::string const& partition, beast::severities::Severity startingLevel);
makeSink(std::string const& partition, beast::Severity startingLevel);
public:
static LogSeverity
fromSeverity(beast::severities::Severity level);
static beast::severities::Severity
toSeverity(LogSeverity level);
static std::string
toString(LogSeverity s);
toString(beast::Severity s);
static LogSeverity
static std::optional<beast::Severity>
fromString(std::string const& s);
private:
// Need to be named before converting
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum {
// Maximum line length for log messages.
// If the message exceeds this length it will be truncated with
// ellipses.
MaximumMessageCharacters = 12 * 1024
};
// Maximum line length for log messages.
// If the message exceeds this length it will be truncated with ellipses.
static constexpr auto kMAXIMUM_MESSAGE_CHARACTERS = 12 * 1024;
static void
format(
std::string& output,
std::string const& message,
beast::severities::Severity severity,
beast::Severity severity,
std::string const& partition);
};

View File

@@ -21,12 +21,12 @@ public:
}
[[nodiscard]] uint256 const&
asUint256() const
asUInt256() const
{
return hash_;
}
uint256&
asUint256()
asUInt256()
{
return hash_;
}
@@ -93,7 +93,7 @@ template <>
inline std::size_t
extract(SHAMapHash const& key)
{
return *reinterpret_cast<std::size_t const*>(key.asUint256().data());
return *reinterpret_cast<std::size_t const*>(key.asUInt256().data());
}
} // namespace xrpl

View File

@@ -120,7 +120,7 @@ std::string
trimWhitespace(std::string str);
std::optional<std::uint64_t>
toUint64(std::string const& s);
toUInt64(std::string const& s);
/** Determines if the given string looks like a TOML-file hosting domain.

View File

@@ -62,9 +62,7 @@ private:
{
using run_time = std::pair<std::string, typename clock_type::duration>;
// Need to be named before converting
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum { MaxTop = 10 };
static constexpr auto kMAX_TOP = 10;
std::size_t suites = 0;
std::size_t cases = 0;
@@ -148,11 +146,11 @@ Reporter<Unused>::Results::add(SuiteResults const& r)
});
if (iter != top.end())
{
if (top.size() == MaxTop)
if (top.size() == kMAX_TOP)
top.resize(top.size() - 1);
top.emplace(iter, r.name, elapsed);
}
else if (top.size() < MaxTop)
else if (top.size() < kMAX_TOP)
{
top.emplace_back(r.name, elapsed);
}

View File

@@ -2,29 +2,25 @@
#include <xrpl/beast/utility/instrumentation.h>
#include <cstdint>
#include <sstream>
namespace beast {
/** A namespace for easy access to logging severity values. */
namespace severities {
/** Severity level / threshold of a Journal message. */
// Hundreds of usages via logging macros
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum Severity {
KAll = 0,
enum class Severity : std::uint8_t {
All = 0,
KTrace = KAll,
KDebug = 1,
KInfo = 2,
KWarning = 3,
KError = 4,
KFatal = 5,
Trace = All,
Debug = 1,
Info = 2,
Warning = 3,
Error = 4,
Fatal = 5,
KDisabled = 6,
KNone = KDisabled
Disabled = 6,
None = Disabled
};
} // namespace severities
/** A generic endpoint for log messages.
@@ -44,9 +40,6 @@ public:
class Sink;
private:
// Severity level / threshold of a Journal message.
using Severity = severities::Severity;
// Invariant: sink_ always points to a valid Sink
Sink* sink_;
@@ -183,7 +176,7 @@ public:
{
public:
/** Create a stream which produces no output. */
explicit Stream() : sink_(getNullSink()), level_(severities::KDisabled)
explicit Stream() : sink_(getNullSink()), level_(Severity::Disabled)
{
}
@@ -194,7 +187,7 @@ public:
Stream(Sink& sink, Severity level) : sink_(sink), level_(level)
{
XRPL_ASSERT(
level_ < severities::KDisabled, "beast::Journal::Stream::Stream : maximum level");
level_ < Severity::Disabled, "beast::Journal::Stream::Stream : maximum level");
}
/** Construct or copy another Stream. */
@@ -297,37 +290,37 @@ public:
[[nodiscard]] Stream
trace() const
{
return {*sink_, severities::KTrace};
return {*sink_, Severity::Trace};
}
[[nodiscard]] Stream
debug() const
{
return {*sink_, severities::KDebug};
return {*sink_, Severity::Debug};
}
[[nodiscard]] Stream
info() const
{
return {*sink_, severities::KInfo};
return {*sink_, Severity::Info};
}
[[nodiscard]] Stream
warn() const
{
return {*sink_, severities::KWarning};
return {*sink_, Severity::Warning};
}
[[nodiscard]] Stream
error() const
{
return {*sink_, severities::KError};
return {*sink_, Severity::Error};
}
[[nodiscard]] Stream
fatal() const
{
return {*sink_, severities::KFatal};
return {*sink_, Severity::Fatal};
}
/** @} */
};

View File

@@ -36,7 +36,7 @@ public:
}
[[nodiscard]] bool
active(beast::severities::Severity level) const override
active(beast::Severity level) const override
{
return sink_.active(level);
}
@@ -53,27 +53,27 @@ public:
sink_.console(output);
}
[[nodiscard]] beast::severities::Severity
[[nodiscard]] beast::Severity
threshold() const override
{
return sink_.threshold();
}
void
threshold(beast::severities::Severity thresh) override
threshold(beast::Severity thresh) override
{
sink_.threshold(thresh);
}
void
write(beast::severities::Severity level, std::string const& text) override
write(beast::Severity level, std::string const& text) override
{
using beast::Journal;
sink_.write(level, prefix_ + text);
}
void
writeAlways(severities::Severity level, std::string const& text) override
writeAlways(Severity level, std::string const& text) override
{
using beast::Journal;
sink_.writeAlways(level, prefix_ + text);

View File

@@ -5,7 +5,7 @@
namespace xrpl {
/** A PropertyStream::Sink which produces a json::Value of type objectValue. */
/** A PropertyStream::Sink which produces a json::Value of type ValueType::Object. */
class JsonPropertyStream : public beast::PropertyStream
{
public:

View File

@@ -70,24 +70,22 @@ public:
static constexpr unsigned kNEST_LIMIT{25};
private:
// 53 files, protocol-wide
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum TokenType {
TokenEndOfStream = 0,
TokenObjectBegin,
TokenObjectEnd,
TokenArrayBegin,
TokenArrayEnd,
TokenString,
TokenInteger,
TokenDouble,
TokenTrue,
TokenFalse,
TokenNull,
TokenArraySeparator,
TokenMemberSeparator,
TokenComment,
TokenError
enum class TokenType {
EndOfStream = 0,
ObjectBegin,
ObjectEnd,
ArrayBegin,
ArrayEnd,
String,
Integer,
Double,
True,
False,
Null,
ArraySeparator,
MemberSeparator,
Comment,
Error
};
class Token

View File

@@ -15,22 +15,20 @@ namespace json {
/** \brief Type of the value held by a Value object.
*/
// Used throughout JSON layer
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum ValueType {
NullValue = 0, ///< 'null' value
IntValue, ///< signed integer value
UintValue, ///< unsigned integer value
RealValue, ///< double value
StringValue, ///< UTF-8 string value
BooleanValue, ///< bool value
ArrayValue, ///< array value (ordered list)
ObjectValue ///< object value (collection of name/value pairs).
enum class ValueType {
Null = 0, ///< 'null' value
Int, ///< signed integer value
UInt, ///< unsigned integer value
Real, ///< double value
String, ///< UTF-8 string value
Boolean, ///< bool value
Array, ///< array value (ordered list)
Object ///< object value (collection of name/value pairs).
};
/** \brief Lightweight wrapper to tag static string.
*
* Value constructor and objectValue member assignment takes advantage of the
* Value constructor and ValueType::Object member assignment takes advantage of the
* StaticString and avoid the cost of string duplication when storing the
* string or the member name.
*
@@ -104,8 +102,8 @@ operator!=(StaticString x, std::string const& y)
/** \brief Represents a <a HREF="http://www.json.org">JSON</a> value.
*
* This class is a discriminated union wrapper that can represent a:
* - signed integer [range: Value::minInt - Value::maxInt]
* - unsigned integer (range: 0 - Value::maxUInt)
* - signed integer [range: Value::kMIN_INT - Value::kMAX_INT]
* - unsigned integer (range: 0 - Value::kMAX_UINT)
* - double
* - UTF-8 string
* - boolean
@@ -116,16 +114,16 @@ operator!=(StaticString x, std::string const& y)
* The type of the held value is represented by a #ValueType and
* can be obtained using type().
*
* values of an #objectValue or #arrayValue can be accessed using operator[]()
* methods. Non const methods will automatically create the a #nullValue element
* values of an ValueType::Object or ValueType::Array can be accessed using operator[]()
* methods. Non const methods will automatically create the a ValueType::Null element
* if it does not exist.
* The sequence of an #arrayValue will be automatically resize and initialized
* with #nullValue. resize() can be used to enlarge or truncate an #arrayValue.
* The sequence of an ValueType::Array will be automatically resize and initialized
* with ValueType::Null. resize() can be used to enlarge or truncate an ValueType::Array.
*
* The get() methods can be used to obtain a default value in the case the
* required element does not exist.
*
* It is possible to iterate over the list of a #objectValue values using
* It is possible to iterate over the list of a ValueType::Object values using
* the getMemberNames() method.
*/
class Value
@@ -143,15 +141,13 @@ public:
static Value const kNULL;
static constexpr Int kMIN_INT = std::numeric_limits<Int>::min();
static constexpr Int kMAX_INT = std::numeric_limits<Int>::max();
static constexpr UInt kMAX_U_INT = std::numeric_limits<UInt>::max();
static constexpr UInt kMAX_UINT = std::numeric_limits<UInt>::max();
private:
class CZString
{
public:
// Stored as int field, implicit conversion
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum DuplicationPolicy { NoDuplication = 0, Duplicate, DuplicateOnCopy };
enum class DuplicationPolicy { NoDuplication = 0, Duplicate, DuplicateOnCopy };
CZString(int index);
CZString(char const* cstr, DuplicationPolicy allocate);
@@ -182,19 +178,19 @@ public:
/** \brief Create a default Value of the given type.
This is a very useful constructor.
To create an empty array, pass arrayValue.
To create an empty object, pass objectValue.
To create an empty array, pass ValueType::Array.
To create an empty object, pass ValueType::Object.
Another Value can then be set to this one by assignment.
This is useful since clear() and resize() will not alter types.
Examples:
\code
json::Value null_value; // null
json::Value arr_value(json::arrayValue); // []
json::Value obj_value(json::objectValue); // {}
json::Value arr_value(json::ValueType::Array); // []
json::Value obj_value(json::ValueType::Object); // {}
\endcode
*/
Value(ValueType type = NullValue);
Value(ValueType type = ValueType::Null);
Value(Int value);
Value(UInt value);
Value(double value);
@@ -290,7 +286,7 @@ public:
operator bool() const;
/// Remove all object members and array elements.
/// \pre type() is arrayValue, objectValue, or nullValue
/// \pre type() is ValueType::Array, ValueType::Object, or ValueType::Null
/// \post type() is unchanged
void
clear();
@@ -367,7 +363,7 @@ public:
///
/// Do nothing if it did not exist.
/// \return the removed Value, or null.
/// \pre type() is objectValue or nullValue
/// \pre type() is ValueType::Object or ValueType::Null
/// \post type() is unchanged
Value
removeMember(char const* key);
@@ -388,8 +384,8 @@ public:
/// \brief Return a list of the member names.
///
/// If null, return an empty list.
/// \pre type() is objectValue or nullValue
/// \post if type() was nullValue, it remains nullValue
/// \pre type() is ValueType::Object or ValueType::Null
/// \post if type() was ValueType::Null, it remains ValueType::Null
[[nodiscard]] Members
getMemberNames() const;
@@ -469,16 +465,14 @@ operator>=(Value const& x, Value const& y)
* string value memory management done by Value.
*
* - makeMemberName() and releaseMemberName() are called to respectively
* duplicate and free an json::objectValue member name.
* duplicate and free an json::ValueType::Object member name.
* - duplicateStringValue() and releaseStringValue() are called similarly to
* duplicate and free a json::stringValue value.
* duplicate and free a json::ValueType::String value.
*/
class ValueAllocator
{
public:
// Need to be named before converting
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum { Unknown = (unsigned)-1 };
static constexpr auto kUNKNOWN = (unsigned)-1;
virtual ~ValueAllocator() = default;
@@ -487,7 +481,7 @@ public:
virtual void
releaseMemberName(char* memberName) = 0;
virtual char*
duplicateStringValue(char const* value, unsigned int length = Unknown) = 0;
duplicateStringValue(char const* value, unsigned int length = kUNKNOWN) = 0;
virtual void
releaseStringValue(char* value) = 0;
};
@@ -523,12 +517,12 @@ public:
[[nodiscard]] Value
key() const;
/// Return the index of the referenced Value. -1 if it is not an arrayValue.
/// Return the index of the referenced Value. -1 if it is not an ValueType::Array.
[[nodiscard]] UInt
index() const;
/// Return the member name of the referenced Value. "" if it is not an
/// objectValue.
/// ValueType::Object.
[[nodiscard]] char const*
memberName() const;

View File

@@ -204,31 +204,31 @@ writeValue(Write const& write, Value const& value)
{
switch (value.type())
{
case NullValue:
case ValueType::Null:
write("null", 4);
break;
case IntValue:
case ValueType::Int:
writeString(write, valueToString(value.asInt()));
break;
case UintValue:
case ValueType::UInt:
writeString(write, valueToString(value.asUInt()));
break;
case RealValue:
case ValueType::Real:
writeString(write, valueToString(value.asDouble()));
break;
case StringValue:
case ValueType::String:
writeString(write, valueToQuotedString(value.asCString()));
break;
case BooleanValue:
case ValueType::Boolean:
writeString(write, valueToString(value.asBool()));
break;
case ArrayValue: {
case ValueType::Array: {
write("[", 1);
int const size = value.size();
for (int index = 0; index < size; ++index)
@@ -241,7 +241,7 @@ writeValue(Write const& write, Value const& value)
break;
}
case ObjectValue: {
case ValueType::Object: {
Value::Members const members = value.getMemberNames();
write("{", 1);
for (auto it = members.begin(); it != members.end(); ++it)

View File

@@ -67,7 +67,7 @@ public:
[[nodiscard]] virtual json::Value
getJson(bool isAdmin) const = 0;
/** Returns a json::objectValue. */
/** Returns a json::ValueType::Object. */
[[nodiscard]] virtual json::Value
getJson(uint256 const& amendment, bool isAdmin) const = 0;

View File

@@ -6,20 +6,16 @@
namespace xrpl::NodeStore {
// Need to be named before converting
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum {
// This is only used to pre-allocate the array for
// batch objects and does not affect the amount written.
//
BatchWritePreallocationSize = 256,
// This is only used to pre-allocate the array for
// batch objects and does not affect the amount written.
//
static constexpr auto kBATCH_WRITE_PREALLOCATION_SIZE = 256;
// This sets a limit on the maximum number of writes
// in a batch. Actual usage can be twice this since
// we have a new batch growing as we write the old.
//
BatchWriteLimitSize = 65536
};
// This sets a limit on the maximum number of writes
// in a batch. Actual usage can be twice this since
// we have a new batch growing as we write the old.
//
static constexpr auto kBATCH_WRITE_LIMIT_SIZE = 65536;
/** Return codes from Backend operations. */
enum class Status {

View File

@@ -61,7 +61,7 @@ setVersion(json::Value& parent, unsigned int apiVersion, bool betaEnabled)
{
XRPL_ASSERT(apiVersion != kAPI_INVALID_VERSION, "xrpl::RPC::setVersion : input is valid");
auto& retObj = parent[jss::version] = json::ObjectValue;
auto& retObj = parent[jss::version] = json::ValueType::Object;
if (apiVersion == kAPI_VERSION_IF_UNSPECIFIED)
{

View File

@@ -267,10 +267,10 @@ getOrThrow(json::Value const& v, xrpl::SField const& field)
{
using namespace xrpl;
std::string const b58 = getOrThrow<std::string>(v, field);
if (auto pubKeyBlob = strUnHex(b58); pubKeyBlob && publicKeyType(makeSlice(*pubKeyBlob)))
if (auto pubKeyBlob = strUnHex(b58);
pubKeyBlob.has_value() && publicKeyType(makeSlice(*pubKeyBlob)))
{
return PublicKey{makeSlice(
*pubKeyBlob)}; // NOLINT(bugprone-unchecked-optional-access) checked in condition above
return PublicKey{makeSlice(*pubKeyBlob)};
}
for (auto const tokenType : {TokenType::NodePublic, TokenType::AccountPublic})
{

View File

@@ -129,23 +129,20 @@ fieldCode(int id, int index)
class SField
{
public:
// Need to be named before converting
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum {
SMdNever = 0x00,
SMdChangeOrig = 0x01, // original value when it changes
SMdChangeNew = 0x02, // new value when it changes
SMdDeleteFinal = 0x04, // final value when it is deleted
SMdCreate = 0x08, // value when it's created
SMdAlways = 0x10, // value when node containing it is affected at all
SMdBaseTen = 0x20, // value is treated as base 10, overriding behavior
SMdPseudoAccount = 0x40, // if this field is set in an ACCOUNT_ROOT
// _only_, then it is a pseudo-account
SMdNeedsAsset = 0x80, // This field needs to be associated with an
// asset before it is serialized as a ledger
// object. Intended for STNumber.
SMdDefault = SMdChangeOrig | SMdChangeNew | SMdDeleteFinal | SMdCreate
};
static constexpr auto kSMD_NEVER = 0x00;
static constexpr auto kSMD_CHANGE_ORIG = 0x01; // original value when it changes
static constexpr auto kSMD_CHANGE_NEW = 0x02; // new value when it changes
static constexpr auto kSMD_DELETE_FINAL = 0x04; // final value when it is deleted
static constexpr auto kSMD_CREATE = 0x08; // value when it's created
static constexpr auto kSMD_ALWAYS = 0x10; // value when node containing it is affected at all
static constexpr auto kSMD_BASE_TEN = 0x20; // value is treated as base 10, overriding behavior
static constexpr auto kSMD_PSEUDO_ACCOUNT = 0x40; // if this field is set in an ACCOUNT_ROOT
// _only_, then it is a pseudo-account
static constexpr auto kSMD_NEEDS_ASSET = 0x80; // This field needs to be associated with an
// asset before it is serialized as a ledger
// object. Intended for STNumber.
static constexpr auto kSMD_DEFAULT =
kSMD_CHANGE_ORIG | kSMD_CHANGE_NEW | kSMD_DELETE_FINAL | kSMD_CREATE;
enum class IsSigning : unsigned char { No, Yes };
static IsSigning const kNOT_SIGNING = IsSigning::No;
@@ -175,7 +172,7 @@ public:
SerializedTypeID tid,
int fv,
char const* fn,
int meta = SMdDefault,
int meta = kSMD_DEFAULT,
IsSigning signing = IsSigning::Yes);
explicit SField(PrivateAccessTagT, int fc, char const* fn);

View File

@@ -241,7 +241,7 @@ public:
[[nodiscard]] std::string
getText() const override;
[[nodiscard]] json::Value getJson(JsonOptions = JsonOptions::KNone) const override;
[[nodiscard]] json::Value getJson(JsonOptions = JsonOptions::Values::None) const override;
void
add(Serializer& s) const override;

View File

@@ -18,23 +18,23 @@ struct JsonOptions
using underlying_t = unsigned int;
underlying_t value;
// Bitwise flags with operator~
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum Values : underlying_t {
// clang-format off
KNone = 0b0000'0000,
KIncludeDate = 0b0000'0001,
KDisableApiPriorV2 = 0b0000'0010,
enum class Values : underlying_t {
None = 0b0000'0000,
IncludeDate = 0b0000'0001,
DisableApiPriorV2 = 0b0000'0010,
// IMPORTANT `kALL` must be union of all of the above; see also operator~
KAll = 0b0000'0011
// clang-format on
// IMPORTANT `All` must be union of all of the above; see also operator~
All = IncludeDate | DisableApiPriorV2 // 0b0000'0011
};
constexpr JsonOptions(underlying_t v) noexcept : value(v)
{
}
constexpr JsonOptions(Values v) noexcept : value(static_cast<JsonOptions::underlying_t>(v))
{
}
[[nodiscard]] constexpr explicit
operator underlying_t() const noexcept
{
@@ -69,18 +69,18 @@ struct JsonOptions
[[nodiscard]] constexpr JsonOptions friend
operator~(JsonOptions v) noexcept
{
return {~v.value & static_cast<underlying_t>(KAll)};
return {~v.value & static_cast<underlying_t>(Values::All)};
}
};
template <typename T>
requires requires(T const& t) {
{ t.getJson(JsonOptions::KNone) } -> std::convertible_to<json::Value>;
{ t.getJson(JsonOptions::Values::None) } -> std::convertible_to<json::Value>;
}
json::Value
toJson(T const& t)
{
return t.getJson(JsonOptions::KNone);
return t.getJson(JsonOptions::Values::None);
}
namespace detail {
@@ -148,7 +148,7 @@ public:
[[nodiscard]] virtual std::string
getText() const;
[[nodiscard]] virtual json::Value getJson(JsonOptions = JsonOptions::KNone) const;
[[nodiscard]] virtual json::Value getJson(JsonOptions = JsonOptions::Values::None) const;
virtual void
add(Serializer& s) const;

View File

@@ -38,7 +38,7 @@ public:
getText() const override;
[[nodiscard]] json::Value
getJson(JsonOptions options = JsonOptions::KNone) const override;
getJson(JsonOptions options = JsonOptions::Values::None) const override;
/** Returns the 'key' (or 'index') of this item.
The key identifies this entry's position in

View File

@@ -132,7 +132,7 @@ public:
getText() const override;
// TODO(tom): options should be an enum.
[[nodiscard]] json::Value getJson(JsonOptions = JsonOptions::KNone) const override;
[[nodiscard]] json::Value getJson(JsonOptions = JsonOptions::Values::None) const override;
void
addWithoutSigningFields(Serializer& s) const;

View File

@@ -161,7 +161,7 @@ STValidation::STValidation(SerialIter& sit, LookupNodeID&& lookupNodeID, bool ch
if (checkSignature && !isValid())
{
JLOG(debugLog().error()) << "Invalid signature in validation: "
<< getJson(JsonOptions::KNone);
<< getJson(JsonOptions::Values::None);
Throw<std::runtime_error>("Invalid signature in validation");
}

View File

@@ -27,7 +27,7 @@ TYPED_SFIELD(sfWasLockingChainSend, UINT8, 19)
TYPED_SFIELD(sfWithdrawalPolicy, UINT8, 20)
// 16-bit integers (common)
TYPED_SFIELD(sfLedgerEntryType, UINT16, 1, SField::SMdNever)
TYPED_SFIELD(sfLedgerEntryType, UINT16, 1, SField::kSMD_NEVER)
TYPED_SFIELD(sfTransactionType, UINT16, 2)
TYPED_SFIELD(sfSignerWeight, UINT16, 3)
TYPED_SFIELD(sfTransferFee, UINT16, 4)
@@ -48,7 +48,7 @@ TYPED_SFIELD(sfNetworkID, UINT32, 1)
TYPED_SFIELD(sfFlags, UINT32, 2)
TYPED_SFIELD(sfSourceTag, UINT32, 3)
TYPED_SFIELD(sfSequence, UINT32, 4)
TYPED_SFIELD(sfPreviousTxnLgrSeq, UINT32, 5, SField::SMdDeleteFinal)
TYPED_SFIELD(sfPreviousTxnLgrSeq, UINT32, 5, SField::kSMD_DELETE_FINAL)
TYPED_SFIELD(sfLedgerSequence, UINT32, 6)
TYPED_SFIELD(sfCloseTime, UINT32, 7)
TYPED_SFIELD(sfParentCloseTime, UINT32, 8)
@@ -138,12 +138,12 @@ TYPED_SFIELD(sfXChainClaimID, UINT64, 20)
TYPED_SFIELD(sfXChainAccountCreateCount, UINT64, 21)
TYPED_SFIELD(sfXChainAccountClaimCount, UINT64, 22)
TYPED_SFIELD(sfAssetPrice, UINT64, 23)
TYPED_SFIELD(sfMaximumAmount, UINT64, 24, SField::SMdBaseTen|SField::SMdDefault)
TYPED_SFIELD(sfOutstandingAmount, UINT64, 25, SField::SMdBaseTen|SField::SMdDefault)
TYPED_SFIELD(sfMPTAmount, UINT64, 26, SField::SMdBaseTen|SField::SMdDefault)
TYPED_SFIELD(sfMaximumAmount, UINT64, 24, SField::kSMD_BASE_TEN|SField::kSMD_DEFAULT)
TYPED_SFIELD(sfOutstandingAmount, UINT64, 25, SField::kSMD_BASE_TEN|SField::kSMD_DEFAULT)
TYPED_SFIELD(sfMPTAmount, UINT64, 26, SField::kSMD_BASE_TEN|SField::kSMD_DEFAULT)
TYPED_SFIELD(sfIssuerNode, UINT64, 27)
TYPED_SFIELD(sfSubjectNode, UINT64, 28)
TYPED_SFIELD(sfLockedAmount, UINT64, 29, SField::SMdBaseTen|SField::SMdDefault)
TYPED_SFIELD(sfLockedAmount, UINT64, 29, SField::kSMD_BASE_TEN|SField::kSMD_DEFAULT)
TYPED_SFIELD(sfVaultNode, UINT64, 30)
TYPED_SFIELD(sfLoanBrokerNode, UINT64, 31)
@@ -167,17 +167,17 @@ TYPED_SFIELD(sfLedgerHash, UINT256, 1)
TYPED_SFIELD(sfParentHash, UINT256, 2)
TYPED_SFIELD(sfTransactionHash, UINT256, 3)
TYPED_SFIELD(sfAccountHash, UINT256, 4)
TYPED_SFIELD(sfPreviousTxnID, UINT256, 5, SField::SMdDeleteFinal)
TYPED_SFIELD(sfPreviousTxnID, UINT256, 5, SField::kSMD_DELETE_FINAL)
TYPED_SFIELD(sfLedgerIndex, UINT256, 6)
TYPED_SFIELD(sfWalletLocator, UINT256, 7)
TYPED_SFIELD(sfRootIndex, UINT256, 8, SField::SMdAlways)
TYPED_SFIELD(sfRootIndex, UINT256, 8, SField::kSMD_ALWAYS)
TYPED_SFIELD(sfAccountTxnID, UINT256, 9)
TYPED_SFIELD(sfNFTokenID, UINT256, 10)
TYPED_SFIELD(sfEmitParentTxnID, UINT256, 11)
TYPED_SFIELD(sfEmitNonce, UINT256, 12)
TYPED_SFIELD(sfEmitHookHash, UINT256, 13)
TYPED_SFIELD(sfAMMID, UINT256, 14,
SField::SMdPseudoAccount | SField::SMdDefault)
SField::kSMD_PSEUDO_ACCOUNT | SField::kSMD_DEFAULT)
// 256-bit (uncommon)
TYPED_SFIELD(sfBookDirectory, UINT256, 16)
@@ -200,30 +200,30 @@ TYPED_SFIELD(sfHookNamespace, UINT256, 32)
TYPED_SFIELD(sfHookSetTxnID, UINT256, 33)
TYPED_SFIELD(sfDomainID, UINT256, 34)
TYPED_SFIELD(sfVaultID, UINT256, 35,
SField::SMdPseudoAccount | SField::SMdDefault)
SField::kSMD_PSEUDO_ACCOUNT | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfParentBatchID, UINT256, 36)
TYPED_SFIELD(sfLoanBrokerID, UINT256, 37,
SField::SMdPseudoAccount | SField::SMdDefault)
SField::kSMD_PSEUDO_ACCOUNT | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfLoanID, UINT256, 38)
// number (common)
TYPED_SFIELD(sfNumber, NUMBER, 1)
TYPED_SFIELD(sfAssetsAvailable, NUMBER, 2, SField::SMdNeedsAsset | SField::SMdDefault)
TYPED_SFIELD(sfAssetsMaximum, NUMBER, 3, SField::SMdNeedsAsset | SField::SMdDefault)
TYPED_SFIELD(sfAssetsTotal, NUMBER, 4, SField::SMdNeedsAsset | SField::SMdDefault)
TYPED_SFIELD(sfLossUnrealized, NUMBER, 5, SField::SMdNeedsAsset | SField::SMdDefault)
TYPED_SFIELD(sfDebtTotal, NUMBER, 6, SField::SMdNeedsAsset | SField::SMdDefault)
TYPED_SFIELD(sfDebtMaximum, NUMBER, 7, SField::SMdNeedsAsset | SField::SMdDefault)
TYPED_SFIELD(sfCoverAvailable, NUMBER, 8, SField::SMdNeedsAsset | SField::SMdDefault)
TYPED_SFIELD(sfAssetsAvailable, NUMBER, 2, SField::kSMD_NEEDS_ASSET | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfAssetsMaximum, NUMBER, 3, SField::kSMD_NEEDS_ASSET | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfAssetsTotal, NUMBER, 4, SField::kSMD_NEEDS_ASSET | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfLossUnrealized, NUMBER, 5, SField::kSMD_NEEDS_ASSET | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfDebtTotal, NUMBER, 6, SField::kSMD_NEEDS_ASSET | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfDebtMaximum, NUMBER, 7, SField::kSMD_NEEDS_ASSET | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfCoverAvailable, NUMBER, 8, SField::kSMD_NEEDS_ASSET | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfLoanOriginationFee, NUMBER, 9)
TYPED_SFIELD(sfLoanServiceFee, NUMBER, 10)
TYPED_SFIELD(sfLatePaymentFee, NUMBER, 11)
TYPED_SFIELD(sfClosePaymentFee, NUMBER, 12)
TYPED_SFIELD(sfPrincipalOutstanding, NUMBER, 13, SField::SMdNeedsAsset | SField::SMdDefault)
TYPED_SFIELD(sfPrincipalOutstanding, NUMBER, 13, SField::kSMD_NEEDS_ASSET | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfPrincipalRequested, NUMBER, 14)
TYPED_SFIELD(sfTotalValueOutstanding, NUMBER, 15, SField::SMdNeedsAsset | SField::SMdDefault)
TYPED_SFIELD(sfTotalValueOutstanding, NUMBER, 15, SField::kSMD_NEEDS_ASSET | SField::kSMD_DEFAULT)
TYPED_SFIELD(sfPeriodicPayment, NUMBER, 16)
TYPED_SFIELD(sfManagementFeeOutstanding, NUMBER, 17, SField::SMdNeedsAsset | SField::SMdDefault)
TYPED_SFIELD(sfManagementFeeOutstanding, NUMBER, 17, SField::kSMD_NEEDS_ASSET | SField::kSMD_DEFAULT)
// int32
TYPED_SFIELD(sfLoanScale, INT32, 1)
@@ -269,9 +269,9 @@ TYPED_SFIELD(sfLPTokenBalance, AMOUNT, 31)
TYPED_SFIELD(sfPublicKey, VL, 1)
TYPED_SFIELD(sfMessageKey, VL, 2)
TYPED_SFIELD(sfSigningPubKey, VL, 3)
TYPED_SFIELD(sfTxnSignature, VL, 4, SField::SMdDefault, SField::kNOT_SIGNING)
TYPED_SFIELD(sfTxnSignature, VL, 4, SField::kSMD_DEFAULT, SField::kNOT_SIGNING)
TYPED_SFIELD(sfURI, VL, 5)
TYPED_SFIELD(sfSignature, VL, 6, SField::SMdDefault, SField::kNOT_SIGNING)
TYPED_SFIELD(sfSignature, VL, 6, SField::kSMD_DEFAULT, SField::kNOT_SIGNING)
TYPED_SFIELD(sfDomain, VL, 7)
TYPED_SFIELD(sfFundCode, VL, 8)
TYPED_SFIELD(sfRemoveCode, VL, 9)
@@ -284,7 +284,7 @@ TYPED_SFIELD(sfMemoFormat, VL, 14)
// variable length (uncommon)
TYPED_SFIELD(sfFulfillment, VL, 16)
TYPED_SFIELD(sfCondition, VL, 17)
TYPED_SFIELD(sfMasterSignature, VL, 18, SField::SMdDefault, SField::kNOT_SIGNING)
TYPED_SFIELD(sfMasterSignature, VL, 18, SField::kSMD_DEFAULT, SField::kNOT_SIGNING)
TYPED_SFIELD(sfUNLModifyValidator, VL, 19)
TYPED_SFIELD(sfValidatorToDisable, VL, 20)
TYPED_SFIELD(sfValidatorToReEnable, VL, 21)
@@ -326,7 +326,7 @@ TYPED_SFIELD(sfBorrower, ACCOUNT, 25)
TYPED_SFIELD(sfCounterparty, ACCOUNT, 26)
// vector of 256-bit
TYPED_SFIELD(sfIndexes, VECTOR256, 1, SField::SMdNever)
TYPED_SFIELD(sfIndexes, VECTOR256, 1, SField::kSMD_NEVER)
TYPED_SFIELD(sfHashes, VECTOR256, 2)
TYPED_SFIELD(sfAmendments, VECTOR256, 3)
TYPED_SFIELD(sfNFTokenOffers, VECTOR256, 4)
@@ -387,13 +387,13 @@ UNTYPED_SFIELD(sfCredential, OBJECT, 33)
UNTYPED_SFIELD(sfRawTransaction, OBJECT, 34)
UNTYPED_SFIELD(sfBatchSigner, OBJECT, 35)
UNTYPED_SFIELD(sfBook, OBJECT, 36)
UNTYPED_SFIELD(sfCounterpartySignature, OBJECT, 37, SField::SMdDefault, SField::kNOT_SIGNING)
UNTYPED_SFIELD(sfCounterpartySignature, OBJECT, 37, SField::kSMD_DEFAULT, SField::kNOT_SIGNING)
// array of objects (common)
// ARRAY/1 is reserved for end of array
// sfSigningAccounts has never been used.
//UNTYPED_SFIELD(sfSigningAccounts, ARRAY, 2)
UNTYPED_SFIELD(sfSigners, ARRAY, 3, SField::SMdDefault, SField::kNOT_SIGNING)
UNTYPED_SFIELD(sfSigners, ARRAY, 3, SField::kSMD_DEFAULT, SField::kNOT_SIGNING)
UNTYPED_SFIELD(sfSignerEntries, ARRAY, 4)
UNTYPED_SFIELD(sfTemplate, ARRAY, 5)
UNTYPED_SFIELD(sfNecessary, ARRAY, 6)
@@ -421,4 +421,4 @@ UNTYPED_SFIELD(sfUnauthorizeCredentials, ARRAY, 27)
UNTYPED_SFIELD(sfAcceptedCredentials, ARRAY, 28)
UNTYPED_SFIELD(sfPermissions, ARRAY, 29)
UNTYPED_SFIELD(sfRawTransactions, ARRAY, 30)
UNTYPED_SFIELD(sfBatchSigners, ARRAY, 31, SField::SMdDefault, SField::kNOT_SIGNING)
UNTYPED_SFIELD(sfBatchSigners, ARRAY, 31, SField::kSMD_DEFAULT, SField::kNOT_SIGNING)

View File

@@ -67,7 +67,7 @@ struct Entry : public beast::List<Entry>::Node
int refcount;
// Exponentially decaying balance of resource consumption
DecayingSample<DecayWindowSeconds, clock_type> local_balance;
DecayingSample<kDECAY_WINDOW_SECONDS, clock_type> local_balance;
// Normalized balance contribution from imports
int remote_balance;

View File

@@ -180,16 +180,16 @@ public:
json::Value
getJson()
{
return getJson(WarningThreshold);
return getJson(kWARNING_THRESHOLD);
}
/** Returns a json::objectValue. */
/** Returns a json::ValueType::Object. */
json::Value
getJson(int threshold)
{
clock_type::time_point const now(clock_.now());
json::Value ret(json::ObjectValue);
json::Value ret(json::ValueType::Object);
std::scoped_lock const _(lock_);
for (auto& inboundEntry : inbound_)
@@ -197,7 +197,7 @@ public:
int const localBalance = inboundEntry.local_balance.value(now);
if ((localBalance + inboundEntry.remote_balance) >= threshold)
{
json::Value& entry = (ret[inboundEntry.toString()] = json::ObjectValue);
json::Value& entry = (ret[inboundEntry.toString()] = json::ValueType::Object);
entry[jss::local] = localBalance;
entry[jss::remote] = inboundEntry.remote_balance;
entry[jss::type] = "inbound";
@@ -208,7 +208,7 @@ public:
int const localBalance = outboundEntry.local_balance.value(now);
if ((localBalance + outboundEntry.remote_balance) >= threshold)
{
json::Value& entry = (ret[outboundEntry.toString()] = json::ObjectValue);
json::Value& entry = (ret[outboundEntry.toString()] = json::ValueType::Object);
entry[jss::local] = localBalance;
entry[jss::remote] = outboundEntry.remote_balance;
entry[jss::type] = "outbound";
@@ -219,7 +219,7 @@ public:
int const localBalance = adminEntry.local_balance.value(now);
if ((localBalance + adminEntry.remote_balance) >= threshold)
{
json::Value& entry = (ret[adminEntry.toString()] = json::ObjectValue);
json::Value& entry = (ret[adminEntry.toString()] = json::ValueType::Object);
entry[jss::local] = localBalance;
entry[jss::remote] = adminEntry.remote_balance;
entry[jss::type] = "admin";
@@ -243,7 +243,7 @@ public:
{
Gossip::Item item;
item.balance = inboundEntry.local_balance.value(now);
if (item.balance >= MinimumGossipBalance)
if (item.balance >= kMINIMUM_GOSSIP_BALANCE)
{
item.address = inboundEntry.key->address;
gossip.items.push_back(item);
@@ -363,10 +363,10 @@ public:
static Disposition
disposition(int balance)
{
if (balance >= DropThreshold)
if (balance >= kDROP_THRESHOLD)
return Disposition::Drop;
if (balance >= WarningThreshold)
if (balance >= kWARNING_THRESHOLD)
return Disposition::Warn;
return Disposition::Ok;
@@ -461,7 +461,7 @@ public:
std::scoped_lock const _(lock_);
bool notify(false);
auto const elapsed = clock_.now();
if (entry.balance(clock_.now()) >= WarningThreshold && elapsed != entry.lastWarningTime)
if (entry.balance(clock_.now()) >= kWARNING_THRESHOLD && elapsed != entry.lastWarningTime)
{
charge(entry, kFEE_WARNING);
notify = true;
@@ -485,10 +485,10 @@ public:
bool drop(false);
clock_type::time_point const now(clock_.now());
int const balance(entry.balance(now));
if (balance >= DropThreshold)
if (balance >= kDROP_THRESHOLD)
{
JLOG(journal_.warn()) << "Consumer entry " << entry << " dropped with balance "
<< balance << " at or above drop threshold " << DropThreshold;
<< balance << " at or above drop threshold " << kDROP_THRESHOLD;
// Adding feeDrop at this point keeps the dropped connection
// from re-connecting for at least a little while after it is

View File

@@ -5,30 +5,23 @@
namespace xrpl::Resource {
/** Tunable constants. */
// Need to be named before converting
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum {
// Balance at which a warning is issued
WarningThreshold = 5000
// Balance at which the consumer is disconnected
,
DropThreshold = 25000
// balance at which a warning is issued
static constexpr auto kWARNING_THRESHOLD = 5000;
// The number of seconds in the exponential decay window
// (This should be a power of two)
,
DecayWindowSeconds = 32
// balance at which the consumer is disconnected
static constexpr auto kDROP_THRESHOLD = 25000;
// The minimum balance required in order to include a load source in gossip
,
MinimumGossipBalance = 1000
};
// seconds in exponential decay window (power of two)
static constexpr auto kDECAY_WINDOW_SECONDS = 32;
// minimum balance to include a load source in gossip
static constexpr auto kMINIMUM_GOSSIP_BALANCE = 1000;
// The number of seconds until an inactive table item is removed
std::chrono::seconds constexpr kSECONDS_UNTIL_EXPIRATION{300};
static constexpr std::chrono::seconds kSECONDS_UNTIL_EXPIRATION{300};
// Number of seconds until imported gossip expires
std::chrono::seconds constexpr kGOSSIP_EXPIRATION_SECONDS{30};
static constexpr std::chrono::seconds kGOSSIP_EXPIRATION_SECONDS{30};
} // namespace xrpl::Resource

View File

@@ -38,16 +38,9 @@ protected:
using endpoint_type = boost::asio::ip::tcp::endpoint;
using yield_context = boost::asio::yield_context;
// Need to be named before converting
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum {
// Size of our read/write buffer
BufferSize = 4 * 1024,
// Max seconds without completing a message
TimeoutSeconds = 30,
TimeoutSecondsLocal = 3 // used for localhost clients
};
static constexpr auto kBUFFER_SIZE = 4 * 1024; // size of read/write buffer
static constexpr auto kTIMEOUT_SECONDS = 30; // max seconds without completing a message
static constexpr auto kTIMEOUT_SECONDS_LOCAL = 3; // used for localhost clients
struct Buffer
{
@@ -252,7 +245,8 @@ BaseHTTPPeer<Handler, Impl>::startTimer()
boost::beast::get_lowest_layer(impl().stream_)
.expires_after(
std::chrono::seconds(
remote_address_.address().is_loopback() ? TimeoutSecondsLocal : TimeoutSeconds));
remote_address_.address().is_loopback() ? kTIMEOUT_SECONDS_LOCAL
: kTIMEOUT_SECONDS));
}
// Convenience for discarding the error code
@@ -364,7 +358,7 @@ BaseHTTPPeer<Handler, Impl>::doWriter(
for (;;)
{
if (!writer->prepare(BufferSize, resume))
if (!writer->prepare(kBUFFER_SIZE, resume))
return;
error_code ec;
auto const bytesTransferred = boost::asio::async_write(

View File

@@ -62,9 +62,7 @@ class ServerImpl : public Server
private:
using clock_type = std::chrono::system_clock;
// Need to be named before converting
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum { HistorySize = 100 };
static constexpr auto kHISTORY_SIZE = 100;
Handler& handler_;
beast::Journal const j_;

View File

@@ -22,9 +22,7 @@ private:
using CacheType = KeyCache;
public:
// Need to be named before converting
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum { DefaultCacheTargetSize = 0 };
static constexpr auto kDEFAULT_CACHE_TARGET_SIZE = 0;
using key_type = uint256;
using clock_type = typename CacheType::clock_type;
@@ -41,7 +39,7 @@ public:
clock_type& clock,
beast::Journal j,
beast::insight::Collector::ptr const& collector = beast::insight::NullCollector::make(),
std::size_t targetSize = DefaultCacheTargetSize,
std::size_t targetSize = kDEFAULT_CACHE_TARGET_SIZE,
std::chrono::seconds expiration = std::chrono::minutes{2})
: cache_(name, targetSize, expiration, clock, j, collector), gen_(1)
{

View File

@@ -123,9 +123,8 @@ public:
Transactor(Transactor const&) = delete;
Transactor&
operator=(Transactor const&) = delete;
// 68 transactor subclass files
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum ConsequencesFactoryType { Normal, Blocker, Custom };
enum class ConsequencesFactoryType { Normal, Blocker, Custom };
/** Process the transaction. */
ApplyResult

View File

@@ -25,7 +25,7 @@ not have the relevant amendments enabled_. It's intentionally a pain in the neck
so that bad code gets caught and fixed as early as possible.
*/
// Bitwise flags, 86 files
// Bitwise flags, 86 files, used in macros files
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum Privilege {
NoPriv = 0x0000, // The transaction can not do any of the enumerated operations

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class AccountDelete : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Blocker};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Blocker;
explicit AccountDelete(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -8,7 +8,7 @@ namespace xrpl {
class AccountSet : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Custom};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Custom;
explicit AccountSet(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class SetRegularKey : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Blocker};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Blocker;
explicit SetRegularKey(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -24,7 +24,7 @@ private:
std::vector<SignerEntries::SignerEntry> signers_;
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Blocker};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Blocker;
explicit SignerListSet(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -12,7 +12,7 @@ constexpr size_t kXBRIDGE_MAX_ACCOUNT_CREATE_CLAIMS = 128;
class XChainCreateBridge : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit XChainCreateBridge(ApplyContext& ctx) : Transactor(ctx)
{
@@ -45,7 +45,7 @@ public:
class BridgeModify : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit BridgeModify(ApplyContext& ctx) : Transactor(ctx)
{
@@ -95,7 +95,7 @@ class XChainClaim : public Transactor
{
public:
// Blocker since we cannot accurately calculate the consequences
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Blocker};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Blocker;
explicit XChainClaim(ApplyContext& ctx) : Transactor(ctx)
{
@@ -133,7 +133,7 @@ public:
class XChainCommit : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Custom};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Custom;
static TxConsequences
makeTxConsequences(PreflightContext const& ctx);
@@ -179,7 +179,7 @@ public:
class XChainCreateClaimID : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit XChainCreateClaimID(ApplyContext& ctx) : Transactor(ctx)
{
@@ -222,7 +222,7 @@ class XChainAddClaimAttestation : public Transactor
{
public:
// Blocker since we cannot accurately calculate the consequences
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Blocker};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Blocker;
explicit XChainAddClaimAttestation(ApplyContext& ctx) : Transactor(ctx)
{
@@ -256,7 +256,7 @@ class XChainAddAccountCreateAttestation : public Transactor
{
public:
// Blocker since we cannot accurately calculate the consequences
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Blocker};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Blocker;
explicit XChainAddAccountCreateAttestation(ApplyContext& ctx) : Transactor(ctx)
{
@@ -314,7 +314,7 @@ public:
class XChainCreateAccountCommit : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit XChainCreateAccountCommit(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class CheckCancel : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit CheckCancel(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class CheckCash : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit CheckCash(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class CheckCreate : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit CheckCreate(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class CredentialAccept : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit CredentialAccept(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class CredentialCreate : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit CredentialCreate(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class CredentialDelete : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit CredentialDelete(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class DelegateSet : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit DelegateSet(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -45,7 +45,7 @@ namespace xrpl {
class AMMBid : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit AMMBid(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ class Sandbox;
class AMMClawback : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit AMMClawback(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -37,7 +37,7 @@ namespace xrpl {
class AMMCreate : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit AMMCreate(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -13,7 +13,7 @@ namespace xrpl {
class AMMDelete : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit AMMDelete(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -42,7 +42,7 @@ class Sandbox;
class AMMDeposit : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit AMMDeposit(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -30,7 +30,7 @@ namespace xrpl {
class AMMVote : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit AMMVote(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -50,7 +50,7 @@ enum class WithdrawAll : bool { No = false, Yes };
class AMMWithdraw : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit AMMWithdraw(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -8,7 +8,7 @@ namespace xrpl {
class OfferCancel : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit OfferCancel(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -12,7 +12,7 @@ class Sandbox;
class OfferCreate : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Custom};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Custom;
/** Construct a Transactor subclass that creates an offer in the ledger. */
explicit OfferCreate(ApplyContext& ctx) : Transactor(ctx)

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class DIDDelete : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit DIDDelete(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class DIDSet : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit DIDSet(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class EscrowCancel : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit EscrowCancel(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class EscrowCreate : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Custom};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Custom;
explicit EscrowCreate(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class EscrowFinish : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit EscrowFinish(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class LoanBrokerCoverClawback : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit LoanBrokerCoverClawback(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class LoanBrokerCoverDeposit : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit LoanBrokerCoverDeposit(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class LoanBrokerCoverWithdraw : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit LoanBrokerCoverWithdraw(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class LoanBrokerDelete : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit LoanBrokerDelete(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class LoanBrokerSet : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit LoanBrokerSet(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class LoanDelete : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit LoanDelete(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class LoanManage : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit LoanManage(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class LoanPay : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit LoanPay(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -8,7 +8,7 @@ namespace xrpl {
class LoanSet : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit LoanSet(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -20,7 +20,7 @@ private:
transferNFToken(AccountID const& buyer, AccountID const& seller, uint256 const& nfTokenID);
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit NFTokenAcceptOffer(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class NFTokenBurn : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit NFTokenBurn(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class NFTokenCancelOffer : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit NFTokenCancelOffer(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class NFTokenCreateOffer : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit NFTokenCreateOffer(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -9,7 +9,7 @@ namespace xrpl {
class NFTokenMint : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit NFTokenMint(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class NFTokenModify : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit NFTokenModify(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -16,7 +16,7 @@ namespace xrpl {
class OracleDelete : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit OracleDelete(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -16,7 +16,7 @@ namespace xrpl {
class OracleSet : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit OracleSet(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class DepositPreauth : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit DepositPreauth(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -13,7 +13,7 @@ class Payment : public Transactor
static std::size_t const kMAX_PATH_LENGTH = 8;
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Custom};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Custom;
explicit Payment(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class PaymentChannelClaim : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit PaymentChannelClaim(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class PaymentChannelCreate : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Custom};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Custom;
explicit PaymentChannelCreate(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class PaymentChannelFund : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Custom};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Custom;
explicit PaymentChannelFund(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class PermissionedDomainDelete : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit PermissionedDomainDelete(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class PermissionedDomainSet : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit PermissionedDomainSet(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -9,7 +9,7 @@ namespace xrpl {
class Batch : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit Batch(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class Change : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit Change(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -11,7 +11,7 @@ public:
NfTokenPageLink = 1,
};
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit LedgerStateFix(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class TicketCreate : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Custom};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Custom;
constexpr static std::uint32_t kMIN_VALID_COUNT = 1;

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class Clawback : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit Clawback(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -16,7 +16,7 @@ struct MPTAuthorizeArgs
class MPTokenAuthorize : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit MPTokenAuthorize(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -27,7 +27,7 @@ struct MPTCreateArgs
class MPTokenIssuanceCreate : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit MPTokenIssuanceCreate(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class MPTokenIssuanceDestroy : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit MPTokenIssuanceDestroy(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class MPTokenIssuanceSet : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit MPTokenIssuanceSet(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -8,7 +8,7 @@ namespace xrpl {
class TrustSet : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit TrustSet(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class VaultClawback : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit VaultClawback(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class VaultCreate : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit VaultCreate(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class VaultDelete : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit VaultDelete(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class VaultDeposit : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit VaultDeposit(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class VaultSet : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit VaultSet(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -7,7 +7,7 @@ namespace xrpl {
class VaultWithdraw : public Transactor
{
public:
static constexpr ConsequencesFactoryType kCONSEQUENCES_FACTORY{Normal};
static constexpr auto kCONSEQUENCES_FACTORY = ConsequencesFactoryType::Normal;
explicit VaultWithdraw(ApplyContext& ctx) : Transactor(ctx)
{

View File

@@ -14,19 +14,20 @@
#include <iostream>
#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <utility>
#include <vector>
namespace xrpl {
Logs::Sink::Sink(std::string partition, beast::severities::Severity thresh, Logs& logs)
Logs::Sink::Sink(std::string partition, beast::Severity thresh, Logs& logs)
: beast::Journal::Sink(thresh, false), logs_(logs), partition_(std::move(partition))
{
}
void
Logs::Sink::write(beast::severities::Severity level, std::string const& text)
Logs::Sink::write(beast::Severity level, std::string const& text)
{
if (level < threshold())
return;
@@ -35,7 +36,7 @@ Logs::Sink::write(beast::severities::Severity level, std::string const& text)
}
void
Logs::Sink::writeAlways(beast::severities::Severity level, std::string const& text)
Logs::Sink::writeAlways(beast::Severity level, std::string const& text)
{
logs_.write(level, partition_, text, console());
}
@@ -107,7 +108,7 @@ Logs::File::writeln(char const* text)
//------------------------------------------------------------------------------
Logs::Logs(beast::severities::Severity thresh) : thresh_(thresh) // default severity
Logs::Logs(beast::Severity thresh) : thresh_(thresh) // default severity
{
}
@@ -137,14 +138,14 @@ Logs::journal(std::string const& name)
return beast::Journal(get(name));
}
beast::severities::Severity
beast::Severity
Logs::threshold() const
{
return thresh_;
}
void
Logs::threshold(beast::severities::Severity thresh)
Logs::threshold(beast::Severity thresh)
{
std::scoped_lock const lock(mutex_);
thresh_ = thresh;
@@ -159,13 +160,13 @@ Logs::partitionSeverities() const
std::scoped_lock const lock(mutex_);
list.reserve(sinks_.size());
for (auto const& [name, sink] : sinks_)
list.emplace_back(name, toString(fromSeverity(sink->threshold())));
list.emplace_back(name, toString(sink->threshold()));
return list;
}
void
Logs::write(
beast::severities::Severity level,
beast::Severity level,
std::string const& partition,
std::string const& text,
bool console)
@@ -192,84 +193,27 @@ Logs::rotate()
}
std::unique_ptr<beast::Journal::Sink>
Logs::makeSink(std::string const& name, beast::severities::Severity threshold)
Logs::makeSink(std::string const& name, beast::Severity threshold)
{
return std::make_unique<Sink>(name, threshold, *this);
}
LogSeverity
Logs::fromSeverity(beast::severities::Severity level)
{
using namespace beast::severities;
switch (level)
{
case KTrace:
return LSTrace;
case KDebug:
return LSDebug;
case KInfo:
return LSInfo;
case KWarning:
return LSWarning;
case KError:
return LSError;
// LCOV_EXCL_START
default:
UNREACHABLE("xrpl::Logs::fromSeverity : invalid severity");
[[fallthrough]];
// LCOV_EXCL_STOP
case KFatal:
break;
}
return LSFatal;
}
beast::severities::Severity
Logs::toSeverity(LogSeverity level)
{
using namespace beast::severities;
switch (level)
{
case LSTrace:
return KTrace;
case LSDebug:
return KDebug;
case LSInfo:
return KInfo;
case LSWarning:
return KWarning;
case LSError:
return KError;
// LCOV_EXCL_START
default:
UNREACHABLE("xrpl::Logs::toSeverity : invalid severity");
[[fallthrough]];
// LCOV_EXCL_STOP
case LSFatal:
break;
}
return KFatal;
}
std::string
Logs::toString(LogSeverity s)
Logs::toString(beast::Severity s)
{
switch (s)
{
case LSTrace:
case beast::Severity::Trace:
return "Trace";
case LSDebug:
case beast::Severity::Debug:
return "Debug";
case LSInfo:
case beast::Severity::Info:
return "Info";
case LSWarning:
case beast::Severity::Warning:
return "Warning";
case LSError:
case beast::Severity::Error:
return "Error";
case LSFatal:
case beast::Severity::Fatal:
return "Fatal";
// LCOV_EXCL_START
default:
@@ -279,35 +223,35 @@ Logs::toString(LogSeverity s)
}
}
LogSeverity
std::optional<beast::Severity>
Logs::fromString(std::string const& s)
{
if (boost::iequals(s, "trace"))
return LSTrace;
return beast::Severity::Trace;
if (boost::iequals(s, "debug"))
return LSDebug;
return beast::Severity::Debug;
if (boost::iequals(s, "info") || boost::iequals(s, "information"))
return LSInfo;
return beast::Severity::Info;
if (boost::iequals(s, "warn") || boost::iequals(s, "warning") || boost::iequals(s, "warnings"))
return LSWarning;
return beast::Severity::Warning;
if (boost::iequals(s, "error") || boost::iequals(s, "errors"))
return LSError;
return beast::Severity::Error;
if (boost::iequals(s, "fatal") || boost::iequals(s, "fatals"))
return LSFatal;
return beast::Severity::Fatal;
return LSInvalid;
return std::nullopt;
}
void
Logs::format(
std::string& output,
std::string const& message,
beast::severities::Severity severity,
beast::Severity severity,
std::string const& partition)
{
output.reserve(message.size() + partition.size() + 100);
@@ -318,22 +262,22 @@ Logs::format(
if (!partition.empty())
output += partition + ":";
using namespace beast::severities;
using beast::Severity;
switch (severity)
{
case KTrace:
case Severity::Trace:
output += "TRC ";
break;
case KDebug:
case Severity::Debug:
output += "DBG ";
break;
case KInfo:
case Severity::Info:
output += "NFO ";
break;
case KWarning:
case Severity::Warning:
output += "WRN ";
break;
case KError:
case Severity::Error:
output += "ERR ";
break;
// LCOV_EXCL_START
@@ -341,7 +285,7 @@ Logs::format(
UNREACHABLE("xrpl::Logs::format : invalid severity");
[[fallthrough]];
// LCOV_EXCL_STOP
case KFatal:
case Severity::Fatal:
output += "FTL ";
break;
}
@@ -349,9 +293,9 @@ Logs::format(
output += message;
// Limit the maximum length of the output
if (output.size() > MaximumMessageCharacters)
if (output.size() > kMAXIMUM_MESSAGE_CHARACTERS)
{
output.resize(MaximumMessageCharacters - 3);
output.resize(kMAXIMUM_MESSAGE_CHARACTERS - 3);
output += "...";
}

View File

@@ -101,7 +101,7 @@ trimWhitespace(std::string str)
}
std::optional<std::uint64_t>
toUint64(std::string const& s)
toUInt64(std::string const& s)
{
std::uint64_t result = 0;
if (beast::lexicalCastChecked(result, s))

View File

@@ -204,12 +204,7 @@ class StatsDCollectorImp : public StatsDCollector,
public std::enable_shared_from_this<StatsDCollectorImp>
{
private:
// Need to be named before converting
// NOLINTNEXTLINE(cppcoreguidelines-use-enum-class)
enum {
// MaxPacketSize = 484
MaxPacketSize = 1472
};
static constexpr auto kMAX_PACKET_SIZE = 1472;
Journal journal_;
IP::Endpoint address_;
@@ -392,7 +387,7 @@ public:
!s.empty(),
"beast::insight::detail::StatsDCollectorImp::sendBuffers : "
"non-empty payload");
if (!buffers.empty() && (size + length) > MaxPacketSize)
if (!buffers.empty() && (size + length) > kMAX_PACKET_SIZE)
{
log(buffers);
socket_.async_send(

View File

@@ -12,14 +12,14 @@ namespace beast {
class NullJournalSink : public Journal::Sink
{
public:
NullJournalSink() : Sink(severities::KDisabled, false)
NullJournalSink() : Sink(Severity::Disabled, false)
{
}
~NullJournalSink() override = default;
[[nodiscard]] bool
active(severities::Severity) const override
active(Severity) const override
{
return false;
}
@@ -35,24 +35,24 @@ public:
{
}
[[nodiscard]] severities::Severity
[[nodiscard]] Severity
threshold() const override
{
return severities::KDisabled;
return Severity::Disabled;
}
void
threshold(severities::Severity) override
threshold(Severity) override
{
}
void
write(severities::Severity, std::string const&) override
write(Severity, std::string const&) override
{
}
void
writeAlways(severities::Severity, std::string const&) override
writeAlways(Severity, std::string const&) override
{
}
};
@@ -92,7 +92,7 @@ Journal::Sink::console(bool output)
console_ = output;
}
severities::Severity
Severity
Journal::Sink::threshold() const
{
return thresh_;

View File

@@ -186,11 +186,11 @@ json::Value
JobQueue::getJson(int c)
{
using namespace std::chrono_literals;
json::Value ret(json::ObjectValue);
json::Value ret(json::ValueType::Object);
ret["threads"] = workers_.getNumberOfThreads();
json::Value priorities = json::ArrayValue;
json::Value priorities = json::ValueType::Array;
std::scoped_lock const lock(mutex_);
@@ -210,7 +210,7 @@ JobQueue::getJson(int c)
if ((stats.count != 0) || (waiting != 0) || (stats.latencyPeak != 0ms) || (running != 0))
{
json::Value& pri = priorities.append(json::ObjectValue);
json::Value& pri = priorities.append(json::ValueType::Object);
pri["job_type"] = data.name();

Some files were not shown because too many files have changed in this diff Show More