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) {
63 return std::isdigit(c, std::locale::classic());
83 if (n < 0 || n > limit)
95 bool allowLeadingZeroes,
103 if (!allowLeadingZeroes && input[0] ==
'0')
107 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-");
113 value = input.
substr(0, last);
114 input.
erase(0, last);
121 bool allowLeadingZeroes,
134 }
while (
chop(
".", input));
142 : majorVersion(0), minorVersion(0), patchVersion(0)
157 input.
begin(), input.
end(), [](std::string::value_type c) {
158 return std::isspace(c, std::locale::classic());
164 [](std::string::value_type c) {
165 return std::isspace(c, std::locale::classic());
170 if (left_iter >= right_iter)
176 if (version != input)
182 if (!
chop(
".", version))
188 if (!
chop(
".", version))
196 if (
chop(
"-", version))
207 if (
chop(
"+", version))
217 return version.
empty();
293 isNumeric(right),
"beast::compare : both inputs numeric");
295 int const iLeft(lexicalCastThrow<int>(left));
296 int const iRight(lexicalCastThrow<int>(right));
300 else if (iLeft < iRight)
307 "beast::compare : both inputs non-numeric");
309 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)