Subversion
Data Structures | Public Member Functions | Static Public Member Functions | Related Functions
apache::subversion::svnxx::tristate Class Reference

A three-state Boolean-like type. More...

#include <svnxx/tristate.hpp>

Public Member Functions

constexpr tristate (bool initial_value) noexcept
 Constructor for the true and false states.
 
constexpr operator safe_bool () const noexcept
 Safe conversion to bool. More...
 
constexpr tristate operator! () const noexcept
 Logical negation. More...
 
constexpr tristate (boost::tribool t) noexcept
 Conversion from boost::tribool. More...
 
constexpr operator boost::tribool () const noexcept
 Conversion to boost::tribool. More...
 

Static Public Member Functions

static constexpr tristate unknown () noexcept
 Factory method for the unknown state.
 

Related Functions

(Note that these are not member functions.)

constexpr bool unknown (tristate t) noexcept
 Test for the unknown tristate state. More...
 
constexpr tristate operator&& (tristate t, tristate u) noexcept
 Logical conjunction. More...
 
constexpr tristate operator&& (tristate t, bool b) noexcept
 
constexpr tristate operator&& (bool b, tristate t) noexcept
 
constexpr tristate operator&& (tristate t, boost::tribool b) noexcept
 
constexpr tristate operator&& (boost::tribool b, tristate t) noexcept
 
constexpr tristate operator|| (tristate t, tristate u) noexcept
 Logical disjunction. More...
 
constexpr tristate operator|| (tristate t, bool b) noexcept
 
constexpr tristate operator|| (bool b, tristate t) noexcept
 
constexpr tristate operator|| (tristate t, boost::tribool b) noexcept
 
constexpr tristate operator|| (boost::tribool b, tristate t) noexcept
 
constexpr tristate operator== (tristate t, tristate u) noexcept
 Equality comparison. More...
 
constexpr tristate operator== (tristate t, bool b) noexcept
 
constexpr tristate operator== (bool b, tristate t) noexcept
 
constexpr tristate operator== (tristate t, boost::tribool b) noexcept
 
constexpr tristate operator== (boost::tribool b, tristate t) noexcept
 
constexpr tristate operator!= (tristate t, tristate u) noexcept
 Inquality comparison. More...
 
constexpr tristate operator!= (tristate t, bool b) noexcept
 
constexpr tristate operator!= (bool b, tristate t) noexcept
 
constexpr tristate operator!= (tristate t, boost::tribool b) noexcept
 
constexpr tristate operator!= (boost::tribool b, tristate t) noexcept
 

Detailed Description

A three-state Boolean-like type.

tristate values represent one of three states:

tristate constructors, methods and operators are all compile-time constant expressions and can be used to initialize other constexpr values. And unlike most other types, comparisons and logical operations between tristate values return a tristate, not a bool.

Given a tristate value t, the state it represents can be uniquely determined by the following coding pattern:

if (t) {
// t is true
}
else if (!t) {
// t is false
else {
// t is unknown
}
Note
Inspired by boost::tribool

Definition at line 69 of file tristate.hpp.

Constructor & Destructor Documentation

◆ tristate()

constexpr apache::subversion::svnxx::tristate::tristate ( boost::tribool  t)
inlineconstexprnoexcept

Conversion from boost::tribool.

Returns
a tribool value equivalent to the t.
Note
Avalible only if SVNXX_USE_BOOST is defined.

Definition at line 153 of file tristate.hpp.

Member Function Documentation

◆ operator boost::tribool()

constexpr apache::subversion::svnxx::tristate::operator boost::tribool ( ) const
inlineconstexprnoexcept

Conversion to boost::tribool.

Returns
a boost::tribool value equivalent to the tristate value.
Note
Avalible only if SVNXX_USE_BOOST is defined.

Definition at line 164 of file tristate.hpp.

◆ operator safe_bool()

constexpr apache::subversion::svnxx::tristate::operator safe_bool ( ) const
inlineconstexprnoexcept

Safe conversion to bool.

Returns
a true-like value only when this tristate is the true state.

Definition at line 103 of file tristate.hpp.

◆ operator!()

constexpr tristate apache::subversion::svnxx::tristate::operator! ( ) const
inlineconstexprnoexcept

Logical negation.

Returns
the logical negation of a tristate, according to the following table:
!
false
true
true
false
unknown
unknown

Definition at line 131 of file tristate.hpp.

References unknown().

Friends And Related Function Documentation

◆ operator!=() [1/5]

constexpr tristate operator!= ( bool  b,
tristate  t 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 470 of file tristate.hpp.

◆ operator!=() [2/5]

constexpr tristate operator!= ( boost::tribool  b,
tristate  t 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
Avalible only if SVNXX_USE_BOOST is defined.

Definition at line 491 of file tristate.hpp.

◆ operator!=() [3/5]

constexpr tristate operator!= ( tristate  t,
bool  b 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 461 of file tristate.hpp.

◆ operator!=() [4/5]

constexpr tristate operator!= ( tristate  t,
boost::tribool  b 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
Avalible only if SVNXX_USE_BOOST is defined.

Definition at line 481 of file tristate.hpp.

◆ operator!=() [5/5]

constexpr tristate operator!= ( tristate  t,
tristate  u 
)
related

Inquality comparison.

Returns
the result of comparing two tristate values for inequality, according to the following table:
!=
false
true
unknown
false
false
true
unknown
true
true
false
unknown
unknown
unknown
unknown
unknown

Definition at line 451 of file tristate.hpp.

References unknown().

◆ operator&&() [1/5]

constexpr tristate operator&& ( bool  b,
tristate  t 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 235 of file tristate.hpp.

◆ operator&&() [2/5]

constexpr tristate operator&& ( boost::tribool  b,
tristate  t 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
Avalible only if SVNXX_USE_BOOST is defined.

Definition at line 256 of file tristate.hpp.

◆ operator&&() [3/5]

constexpr tristate operator&& ( tristate  t,
bool  b 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 226 of file tristate.hpp.

◆ operator&&() [4/5]

constexpr tristate operator&& ( tristate  t,
boost::tribool  b 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
Avalible only if SVNXX_USE_BOOST is defined.

Definition at line 246 of file tristate.hpp.

◆ operator&&() [5/5]

constexpr tristate operator&& ( tristate  t,
tristate  u 
)
related

Logical conjunction.

Returns
the result of a logical AND of two tristate values, according to the following table:
&&
false
true
unknown
false
false
false
false
true
false
true
unknown
unknown
false
unknown
unknown

Definition at line 215 of file tristate.hpp.

References unknown().

◆ operator==() [1/5]

constexpr tristate operator== ( bool  b,
tristate  t 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 392 of file tristate.hpp.

◆ operator==() [2/5]

constexpr tristate operator== ( boost::tribool  b,
tristate  t 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
Avalible only if SVNXX_USE_BOOST is defined.

Definition at line 413 of file tristate.hpp.

◆ operator==() [3/5]

constexpr tristate operator== ( tristate  t,
bool  b 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 383 of file tristate.hpp.

◆ operator==() [4/5]

constexpr tristate operator== ( tristate  t,
boost::tribool  b 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
Avalible only if SVNXX_USE_BOOST is defined.

Definition at line 403 of file tristate.hpp.

◆ operator==() [5/5]

constexpr tristate operator== ( tristate  t,
tristate  u 
)
related

Equality comparison.

Returns
the result of comparing two tristate values for equality, according to the following table:
==
false
true
unknown
false
true
false
unknown
true
false
true
unknown
unknown
unknown
unknown
unknown

Definition at line 373 of file tristate.hpp.

References unknown().

◆ operator||() [1/5]

constexpr tristate operator|| ( bool  b,
tristate  t 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 314 of file tristate.hpp.

◆ operator||() [2/5]

constexpr tristate operator|| ( boost::tribool  b,
tristate  t 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
Avalible only if SVNXX_USE_BOOST is defined.

Definition at line 335 of file tristate.hpp.

◆ operator||() [3/5]

constexpr tristate operator|| ( tristate  t,
bool  b 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 305 of file tristate.hpp.

◆ operator||() [4/5]

constexpr tristate operator|| ( tristate  t,
boost::tribool  b 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
Avalible only if SVNXX_USE_BOOST is defined.

Definition at line 325 of file tristate.hpp.

◆ operator||() [5/5]

constexpr tristate operator|| ( tristate  t,
tristate  u 
)
related

Logical disjunction.

Returns
the result of a logical OR of two tristate values, according to the following table:
||
false
true
unknown
false
false
true
unknown
true
true
true
true
unknown
unknown
true
unknown

Definition at line 294 of file tristate.hpp.

References unknown().

◆ unknown()

constexpr bool unknown ( tristate  t)
related

Test for the unknown tristate state.

Returns
true only if t is the unknown state.

Definition at line 178 of file tristate.hpp.


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