25 #ifndef SVNXX_REVISION_HPP 26 #define SVNXX_REVISION_HPP 38 namespace subversion {
62 template<
typename Duration>
63 using time = std::chrono::time_point<std::chrono::system_clock, Duration>;
68 using usec = std::chrono::microseconds;
74 enum class kind : std::int8_t
91 : tag(
kind::unspecified)
106 if (revkind == kind::number || revkind == kind::date)
107 throw std::invalid_argument(
"invalid svn::revision::kind");
126 date(std::chrono::time_point_cast<usec>(time_))
156 if (tag != kind::number)
157 throw std::logic_error(
"svn::revision kind != number");
169 if (tag != kind::date)
170 throw std::logic_error(
"svn::revision kind != date");
171 return std::chrono::time_point_cast<D>(date);
199 else if (
kind == revision::kind::number)
201 else if (
kind == revision::kind::date)
253 else if (
kind == revision::kind::number)
255 else if (
kind == revision::kind::date)
298 else if (
kind == revision::kind::number)
300 else if (
kind == revision::kind::date)
341 return (a == b || !(a > b));
379 return (a == b || !(a < b));
386 #endif // SVNXX_REVISION_HPP .svn/entries current revision
tristate operator<=(const revision &a, const revision &b)
Ordering: less-or-equal (operator <=).
Subversion's data types (common implementation)
tristate operator>(const revision &a, const revision &b)
Ordering: greater-than (operator >).
number get_number() const
Return the revision number.
kind
Revision kind discriminator (see svn_opt_revision_kind).
(rev of most recent change) - 1
std::chrono::microseconds usec
The resolution of the stored date/time.
revision::number revnum
revision::number alias for convenience.
#define SVN_INVALID_REVNUM
The 'official' invalid revision number.
std::chrono::time_point< std::chrono::system_clock, Duration > time
Revision by date/time uses the system clock.
revision(time< D > time_) noexcept
Construct a dated revision from a system clock time point.
A three-state Boolean-like type.
number
Revision number type.
revision() noexcept
Default constructor.
tristate operator>=(const revision &a, const revision &b)
Ordering: greater-or-equal (operator >=).
tristate operator<(const revision &a, const revision &b)
Ordering: less-than (operator <).
Option and argument parsing for Subversion command lines (common implementation)
static constexpr tristate unknown() noexcept
Factory method for the unknown state.
A revision, see svn_opt_revision_t.
long int svn_revnum_t
A revision number.
No revision information given.
bool operator!=(const revision &a, const revision &b)
Inequality comparison.
revision(number revnum_) noexcept
Construct a numbered revision.
rev of most recent change
revision & operator=(const revision &that)
Assignment operator.
kind get_kind() const noexcept
Return the revision kind.
time< D > get_date() const
Return the revision date/time as a system clock time point.
bool operator==(const revision &a, const revision &b)
Equality comparison.
revision(kind revkind)
Construct a revision of the given kind.