1#include <xrpl/beast/core/LexicalCast.h>
2#include <xrpl/beast/core/SemanticVersion.h>
3#include <xrpl/beast/utility/instrumentation.h>
19 for (
auto const& x : list)
45 auto ret = input.
find(what);
62 input.
begin(), input.
end(), [](std::string::value_type c) { return std::isdigit(c, std::locale::classic()); });
81 if (n < 0 || n > limit)
98 if (!allowLeadingZeroes && input[0] ==
'0')
101 auto last = input.
find_first_not_of(
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-");
107 value = input.
substr(0, last);
108 input.
erase(0, last);
125 }
while (
chop(
".", input));
147 input.
begin(), input.
end(), [](std::string::value_type c) { return std::isspace(c, std::locale::classic()); });
150 return std::isspace(c, std::locale::classic());
154 if (left_iter >= right_iter)
160 if (version != input)
166 if (!
chop(
".", version))
172 if (!
chop(
".", version))
180 if (
chop(
"-", version))
191 if (
chop(
"+", version))
201 return version.
empty();
272 XRPL_ASSERT(
isNumeric(right),
"beast::compare : both inputs numeric");
274 int const iLeft(lexicalCastThrow<int>(left));
275 int const iRight(lexicalCastThrow<int>(right));
279 else if (iLeft < iRight)
284 XRPL_ASSERT(!
isNumeric(right),
"beast::compare : both inputs non-numeric");
286 int result = left.compare(right);
A Semantic Version number.
bool parse(std::string const &input)
Parse a semantic version string.
identifier_list preReleaseIdentifiers
bool isPreRelease() const noexcept
std::string print() const
Produce a string from semantic version components.
bool isRelease() const noexcept
T find_first_not_of(T... args)
int compare(SemanticVersion const &lhs, SemanticVersion const &rhs)
Compare two SemanticVersions against each other.
bool isNumeric(std::string const &s)
bool chop(std::string const &what, std::string &input)
std::string print_identifiers(SemanticVersion::identifier_list const &list)
bool extract_identifiers(SemanticVersion::identifier_list &identifiers, bool allowLeadingZeroes, std::string &input)
bool extract_identifier(std::string &value, bool allowLeadingZeroes, std::string &input)
bool lexicalCastChecked(Out &out, In in)
Intelligently convert from one type to another.
bool chopUInt(int &value, int limit, std::string &input)