20#include <xrpl/beast/core/LexicalCast.h>
21#include <xrpl/beast/core/SemanticVersion.h>
22#include <xrpl/beast/utility/instrumentation.h>
34 for (
auto const& x : list)
60 auto ret = input.
find(what);
77 input.
begin(), input.
end(), [](std::string::value_type c) {
78 return std::isdigit(c, std::locale::classic());
98 if (n < 0 || n > limit)
110 bool allowLeadingZeroes,
118 if (!allowLeadingZeroes && input[0] ==
'0')
122 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-");
128 value = input.
substr(0, last);
129 input.
erase(0, last);
136 bool allowLeadingZeroes,
149 }
while (
chop(
".", input));
157 : majorVersion(0), minorVersion(0), patchVersion(0)
172 input.
begin(), input.
end(), [](std::string::value_type c) {
173 return std::isspace(c, std::locale::classic());
179 [](std::string::value_type c) {
180 return std::isspace(c, std::locale::classic());
185 if (left_iter >= right_iter)
191 if (version != input)
197 if (!
chop(
".", version))
203 if (!
chop(
".", version))
211 if (
chop(
"-", version))
222 if (
chop(
"+", version))
232 return version.
empty();
308 isNumeric(right),
"beast::compare : both inputs numeric");
310 int const iLeft(lexicalCastThrow<int>(left));
311 int const iRight(lexicalCastThrow<int>(right));
315 else if (iLeft < iRight)
322 "beast::compare : both inputs non-numeric");
324 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)