Subversion
Public Types | Public Member Functions | Related Functions
apache::subversion::svnxx::revision Class Reference

A revision, see svn_opt_revision_t. More...

#include <svnxx/revision.hpp>

Public Types

enum  number : svn_revnum_t { number::invalid = SVN_INVALID_REVNUM }
 Revision number type. More...
 
enum  kind : std::int8_t {
  unspecified = svn_opt_revision_unspecified,
  number = svn_opt_revision_number,
  date = svn_opt_revision_date,
  committed = svn_opt_revision_committed,
  previous = svn_opt_revision_previous,
  base = svn_opt_revision_base,
  working = svn_opt_revision_working,
  head = svn_opt_revision_head
}
 Revision kind discriminator (see svn_opt_revision_kind).
 
template<typename Duration >
using time = std::chrono::time_point< std::chrono::system_clock, Duration >
 Revision by date/time uses the system clock.
 
using usec = std::chrono::microseconds
 The resolution of the stored date/time.
 

Public Member Functions

 revision () noexcept
 Default constructor. More...
 
 revision (kind revkind)
 Construct a revision of the given kind. More...
 
 revision (number revnum_) noexcept
 Construct a numbered revision. More...
 
template<typename D >
 revision (time< D > time_) noexcept
 Construct a dated revision from a system clock time point. More...
 
revisionoperator= (const revision &that)
 Assignment operator. More...
 
kind get_kind () const noexcept
 Return the revision kind.
 
number get_number () const
 Return the revision number. More...
 
template<typename D >
time< D > get_date () const
 Return the revision date/time as a system clock time point. More...
 

Related Functions

(Note that these are not member functions.)

using revnum = revision::number
 revision::number alias for convenience.
 
bool operator== (const revision &a, const revision &b)
 Equality comparison.
 
bool operator!= (const revision &a, const revision &b)
 Inequality comparison.
 
tristate operator< (const revision &a, const revision &b)
 Ordering: less-than (operator <). More...
 
tristate operator> (const revision &a, const revision &b)
 Ordering: greater-than (operator >). More...
 
tristate operator<= (const revision &a, const revision &b)
 Ordering: less-or-equal (operator <=). More...
 
tristate operator>= (const revision &a, const revision &b)
 Ordering: greater-or-equal (operator >=). More...
 

Detailed Description

A revision, see svn_opt_revision_t.

The revision can represent a revision number, a point in time in the repository or a property of the working copy or repository node (see revision::kind).

Definition at line 48 of file revision.hpp.

Member Enumeration Documentation

◆ number

Revision number type.

Enumerator
invalid 

Invalid revision number.

Definition at line 54 of file revision.hpp.

Constructor & Destructor Documentation

◆ revision() [1/4]

apache::subversion::svnxx::revision::revision ( )
inlinenoexcept

Default constructor.

Postcondition
get_kind() == kind::unspecified.

Definition at line 90 of file revision.hpp.

Referenced by operator=().

◆ revision() [2/4]

apache::subversion::svnxx::revision::revision ( kind  revkind)
inlineexplicit

Construct a revision of the given kind.

Precondition
The revkind argument may be any kind value except kind::number or kind::date, which require additional parameters and therefore have their own constructors.
Postcondition
get_kind() == revkind.
Exceptions
std::invalid_argumentif the revkind value precondition is not met.

Definition at line 103 of file revision.hpp.

◆ revision() [3/4]

apache::subversion::svnxx::revision::revision ( number  revnum_)
inlineexplicitnoexcept

Construct a numbered revision.

Postcondition
get_kind() == kind::number.

Definition at line 114 of file revision.hpp.

◆ revision() [4/4]

template<typename D >
apache::subversion::svnxx::revision::revision ( time< D >  time_)
inlineexplicitnoexcept

Construct a dated revision from a system clock time point.

Postcondition
get_kind() == kind::date.

Definition at line 124 of file revision.hpp.

Member Function Documentation

◆ get_date()

template<typename D >
time<D> apache::subversion::svnxx::revision::get_date ( ) const
inline

Return the revision date/time as a system clock time point.

Precondition
get_kind() == kind::date.
Exceptions
std::logic_errorif the precondition is not met.

Definition at line 167 of file revision.hpp.

Referenced by operator<(), operator==(), and operator>().

◆ get_number()

number apache::subversion::svnxx::revision::get_number ( ) const
inline

Return the revision number.

Precondition
get_kind() == kind::number.
Exceptions
std::logic_errorif the precondition is not met.

Definition at line 154 of file revision.hpp.

Referenced by operator<(), operator==(), and operator>().

◆ operator=()

revision& apache::subversion::svnxx::revision::operator= ( const revision that)
inline

Assignment operator.

Uses in-place destruction/construction to maintain the immutability of the revision kind.

Definition at line 134 of file revision.hpp.

References revision().

Friends And Related Function Documentation

◆ operator<()

tristate operator< ( const revision a,
const revision b 
)
related

Ordering: less-than (operator <).

Returns
a tristate result of comparing two revision values, according to the following table:
<
number
date
other
number
a.get_number() < b.get_number()
unknown
unknown
date
unknown
a.get_date() < b.get_date()
unknown
other
unknown
unknown
unknown

Definition at line 248 of file revision.hpp.

References get_date(), get_kind(), get_number(), and apache::subversion::svnxx::tristate::unknown().

◆ operator<=()

tristate operator<= ( const revision a,
const revision b 
)
related

Ordering: less-or-equal (operator <=).

Returns
a tristate result of comparing two revision values, according to the following table:
<=
number
date
other
number
a.get_number() <= b.get_number()
unknown
unknown
date
unknown
a.get_date() <= b.get_date()
unknown
other
unknown
unknown
true† or unknown
true when a.get_kind() == b.get_kind().

Definition at line 339 of file revision.hpp.

◆ operator>()

tristate operator> ( const revision a,
const revision b 
)
related

Ordering: greater-than (operator >).

Returns
a tristate result of comparing two revision values, according to the following table:
>
number
date
other
number
a.get_number() > b.get_number()
unknown
unknown
date
unknown
a.get_date() > b.get_date()
unknown
other
unknown
unknown
unknown

Definition at line 293 of file revision.hpp.

References get_date(), get_kind(), get_number(), and apache::subversion::svnxx::tristate::unknown().

◆ operator>=()

tristate operator>= ( const revision a,
const revision b 
)
related

Ordering: greater-or-equal (operator >=).

Returns
a tristate result of comparing two revision values, according to the following table:
>=
number
date
other
number
a.get_number() >= b.get_number()
unknown
unknown
date
unknown
a.get_date() >= b.get_date()
unknown
other
unknown
unknown
true† or unknown
true when a.get_kind() == b.get_kind().

Definition at line 377 of file revision.hpp.


The documentation for this class was generated from the following file: