25#ifndef SVNXX_TRISTATE_HPP
26#define SVNXX_TRISTATE_HPP
32#if defined(SVNXX_USE_BOOST) || defined(DOXYGEN)
33#include <boost/logic/tribool.hpp>
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)
A three-state Boolean-like type.
constexpr bool unknown(tristate t) noexcept
Test for the unknown tristate state.
static constexpr tristate unknown() noexcept
Factory method for the unknown state.
constexpr tristate operator==(tristate t, bool b) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr tristate operator!=(tristate t, boost::tribool b) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr tristate operator||(boost::tribool b, tristate t) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr tristate operator&&(boost::tribool b, tristate t) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr tristate operator&&(tristate t, bool b) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr tristate operator==(boost::tribool b, tristate t) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr tristate(bool initial_value) noexcept
Constructor for the true and false states.
constexpr tristate operator&&(bool b, tristate t) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr tristate operator!=(tristate t, bool b) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr tristate operator!=(tristate t, tristate u) noexcept
Inquality comparison.
constexpr tristate operator||(bool b, tristate t) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr tristate operator||(tristate t, tristate u) noexcept
Logical disjunction.
constexpr tristate operator||(tristate t, bool b) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr tristate(boost::tribool t) noexcept
Conversion from boost::tribool.
constexpr tristate operator&&(tristate t, boost::tribool b) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr tristate operator==(tristate t, tristate u) noexcept
Equality comparison.
constexpr tristate operator&&(tristate t, tristate u) noexcept
Logical conjunction.
constexpr tristate operator!=(boost::tribool b, tristate t) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr tristate operator!() const noexcept
Logical negation.
constexpr tristate operator==(bool b, tristate t) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr tristate operator==(tristate t, boost::tribool b) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr tristate operator!=(bool b, tristate t) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr tristate operator||(tristate t, boost::tribool b) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Subversion's data types (common implementation)
@ svn_tristate_unknown
state could be true or false
@ svn_tristate_true
state known to be true
@ svn_tristate_false
state known to be false (the constant does not evaulate to false)