rippled
Loading...
Searching...
No Matches
SemanticVersion.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of Beast: https://github.com/vinniefalco/Beast
4 Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#ifndef BEAST_MODULE_CORE_DIAGNOSTIC_SEMANTICVERSION_H_INCLUDED
21#define BEAST_MODULE_CORE_DIAGNOSTIC_SEMANTICVERSION_H_INCLUDED
22
23#include <string>
24#include <vector>
25
26namespace beast {
27
36{
37public:
39
43
46
48
49 SemanticVersion(std::string const& version);
50
55 bool
56 parse(std::string const& input);
57
60 print() const;
61
62 inline bool
63 isRelease() const noexcept
64 {
66 }
67 inline bool
68 isPreRelease() const noexcept
69 {
70 return !isRelease();
71 }
72};
73
77int
78compare(SemanticVersion const& lhs, SemanticVersion const& rhs);
79
80inline bool
82{
83 return compare(lhs, rhs) == 0;
84}
85
86inline bool
88{
89 return compare(lhs, rhs) != 0;
90}
91
92inline bool
94{
95 return compare(lhs, rhs) >= 0;
96}
97
98inline bool
99operator<=(SemanticVersion const& lhs, SemanticVersion const& rhs)
100{
101 return compare(lhs, rhs) <= 0;
102}
103
104inline bool
106{
107 return compare(lhs, rhs) > 0;
108}
109
110inline bool
111operator<(SemanticVersion const& lhs, SemanticVersion const& rhs)
112{
113 return compare(lhs, rhs) < 0;
114}
115
116} // namespace beast
117
118#endif
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
identifier_list metaData
T empty(T... args)
int compare(SemanticVersion const &lhs, SemanticVersion const &rhs)
Compare two SemanticVersions against each other.
bool operator<=(SemanticVersion const &lhs, SemanticVersion const &rhs)
bool operator>=(SemanticVersion const &lhs, SemanticVersion const &rhs)
bool operator>(SemanticVersion const &lhs, SemanticVersion const &rhs)
bool operator<(SemanticVersion const &lhs, SemanticVersion const &rhs)
bool operator==(LockFreeStackIterator< Container, LhsIsConst > const &lhs, LockFreeStackIterator< Container, RhsIsConst > const &rhs)
bool operator!=(LockFreeStackIterator< Container, LhsIsConst > const &lhs, LockFreeStackIterator< Container, RhsIsConst > const &rhs)