|
Subversion
|
Go to the documentation of this file.
25 #ifndef SVNXX_TRISTATE_HPP
26 #define SVNXX_TRISTATE_HPP
32 #if defined(SVNXX_USE_BOOST) || defined(DOXYGEN)
33 #include <boost/logic/tribool.hpp>
37 namespace subversion {
75 using safe_bool = void (impl::*)();
79 : value(unknown_value)
94 constexpr
tristate(
bool initial_value) noexcept
95 : value(initial_value ? true_value : false_value)
103 constexpr
operator safe_bool() const noexcept
105 return value == true_value ? &impl::trueval : 0;
133 return (value == false_value ?
tristate(
true)
134 : (value == true_value ?
tristate(
false)
140 enum : std::uint8_t {
146 #if defined(SVNXX_USE_BOOST) || defined(DOXYGEN)
154 : value(boost::indeterminate(t) ? unknown_value
155 : (t ? true_value : false_value))
164 constexpr
operator boost::tribool() const noexcept
166 return (value == true_value ? boost::tribool(
true)
167 : (value == false_value ? boost::tribool(
false)
168 : boost::tribool(boost::indeterminate)));
180 return bool(t) == bool(!t);
217 return (
bool(!t) ||
bool(!u) ?
tristate(
false)
218 : (
bool(t) &&
bool(u) ?
tristate(
true)
240 #if defined(SVNXX_USE_BOOST) || defined(DOXYGEN)
296 return (
bool(!t) &&
bool(!u) ?
tristate(
false)
297 : (
bool(t) ||
bool(u) ?
tristate(
true)
319 #if defined(SVNXX_USE_BOOST) || defined(DOXYGEN)
376 : ((t && u) || (!t && !u)));
397 #if defined(SVNXX_USE_BOOST) || defined(DOXYGEN)
454 : !((t && u) || (!t && !u)));
475 #if defined(SVNXX_USE_BOOST) || defined(DOXYGEN)
501 #endif // SVNXX_TRISTATE_HPP
constexpr tristate operator&&(boost::tribool b, tristate t) noexcept
Subversion's data types (common implementation)
constexpr tristate operator==(tristate t, tristate u) noexcept
Equality comparison.
constexpr tristate operator==(tristate t, bool b) noexcept
constexpr tristate operator&&(tristate t, boost::tribool b) noexcept
constexpr tristate operator!=(tristate t, bool b) noexcept
constexpr tristate(boost::tribool t) noexcept
Conversion from boost::tribool.
@ svn_tristate_true
state known to be true
constexpr tristate operator!=(bool b, tristate t) noexcept
constexpr tristate operator&&(bool b, tristate t) noexcept
constexpr tristate operator!=(boost::tribool b, tristate t) noexcept
constexpr tristate operator!=(tristate t, boost::tribool b) noexcept
constexpr tristate operator&&(tristate t, bool b) noexcept
constexpr tristate operator!() const noexcept
Logical negation.
constexpr tristate operator&&(tristate t, tristate u) noexcept
Logical conjunction.
constexpr tristate operator||(tristate t, bool b) noexcept
static constexpr tristate unknown() noexcept
Factory method for the unknown state.
constexpr tristate operator||(bool b, tristate t) noexcept
constexpr tristate operator||(boost::tribool b, tristate t) noexcept
constexpr tristate operator==(boost::tribool b, tristate t) noexcept
@ svn_tristate_false
state known to be false (the constant does not evaulate to false)
constexpr tristate operator==(bool b, tristate t) noexcept
constexpr bool unknown(tristate t) noexcept
Test for the unknown tristate state.
constexpr tristate(bool initial_value) noexcept
Constructor for the true and false states.
constexpr tristate operator!=(tristate t, tristate u) noexcept
Inquality comparison.
A three-state Boolean-like type.
constexpr tristate operator||(tristate t, boost::tribool b) noexcept
constexpr tristate operator||(tristate t, tristate u) noexcept
Logical disjunction.
constexpr tristate operator==(tristate t, boost::tribool b) noexcept
@ svn_tristate_unknown
state could be true or false