![Logo](svn-square.jpg) |
Subversion
|
Go to the documentation of this file.
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
@ invalid
Invalid revision number.
Subversion's data types (common implementation)
tristate operator>(const revision &a, const revision &b)
Ordering: greater-than (operator >).
Option and argument parsing for Subversion command lines (common implementation)
#define SVN_INVALID_REVNUM
The 'official' invalid revision number.
number get_number() const
Return the revision number.
@ svn_opt_revision_date
revision given as date
number
Revision number type.
revision(kind revkind)
Construct a revision of the given kind.
std::chrono::time_point< std::chrono::system_clock, Duration > time
Revision by date/time uses the system clock.
@ svn_opt_revision_working
current, plus local mods
@ svn_opt_revision_base
.svn/entries current revision
revision & operator=(const revision &that)
Assignment operator.
revision(time< D > time_) noexcept
Construct a dated revision from a system clock time point.
std::chrono::microseconds usec
The resolution of the stored date/time.
@ svn_opt_revision_unspecified
No revision information given.
@ svn_opt_revision_head
repository youngest
tristate operator<=(const revision &a, const revision &b)
Ordering: less-or-equal (operator <=).
revision::number revnum
revision::number alias for convenience.
revision() noexcept
Default constructor.
revision(number revnum_) noexcept
Construct a numbered revision.
@ svn_opt_revision_committed
rev of most recent change
static constexpr tristate unknown() noexcept
Factory method for the unknown state.
@ svn_opt_revision_previous
(rev of most recent change) - 1
tristate operator<(const revision &a, const revision &b)
Ordering: less-than (operator <).
tristate operator>=(const revision &a, const revision &b)
Ordering: greater-or-equal (operator >=).
bool operator==(const revision &a, const revision &b)
Equality comparison.
A revision, see svn_opt_revision_t.
long int svn_revnum_t
A revision number.
kind
Revision kind discriminator (see svn_opt_revision_kind).
bool operator!=(const revision &a, const revision &b)
Inequality comparison.
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.
@ svn_opt_revision_number
revision given as number
A three-state Boolean-like type.