3#include <xrpl/beast/core/SemanticVersion.h>
4#include <xrpl/beast/utility/instrumentation.h>
5#include <xrpl/json/json_value.h>
6#include <xrpl/protocol/jss.h>
37template <
unsigned int Version>
62 XRPL_ASSERT(apiVersion !=
kApiInvalidVersion,
"xrpl::RPC::setVersion : input is valid");
73 retObj[jss::first] = kFirstVersion.
print();
74 retObj[jss::good] = kGoodVersion.
print();
75 retObj[jss::last] = kLastVersion.
print();
110 auto const& rawVersion = jv[jss::api_version];
111 switch (rawVersion.type())
114 if (rawVersion.asInt() < 0)
118 auto const apiVersion = rawVersion.asUInt();
119 if (apiVersion < kMinVersion || apiVersion > maxVersion)
135template <
unsigned MinVer,
unsigned MaxVer,
typename Fn,
typename... Args>
139 (MaxVer >= MinVer) &&
146 static constexpr auto kSize = MaxVer + 1 - MinVer;
153 }(std::make_index_sequence<kSize>{});
156template <
typename Fn,
typename... Args>
A Semantic Version number.
std::string print() const
Produce a string from semantic version components.
bool isMember(char const *key) const
Return true if the object has a member named key.
@ UInt
unsigned integer value
@ Int
signed integer value
@ Object
object value (collection of name/value pairs).
API version numbers used in later API versions.
static constexpr auto kApiInvalidVersion
void setVersion(json::Value &parent, unsigned int apiVersion, bool betaEnabled)
static constexpr auto kApiMinimumSupportedVersion
static constexpr std::integral_constant< unsigned, Version > kApiVersion
static constexpr auto kApiCommandLineVersion
static constexpr auto kApiMaximumValidVersion
static constexpr auto kApiVersionIfUnspecified
static constexpr auto kApiBetaVersion
unsigned int getAPIVersionNumber(json::Value const &jv, bool betaEnabled)
Retrieve the api version number from the json value.
static constexpr auto kApiMaximumSupportedVersion
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
void forApiVersions(Fn const &fn, Args &&... args)
void forAllApiVersions(Fn const &fn, Args &&... args)