public

Inheritance Graph

graph BT
	TriState
	click TriState "classUtil_1_1TriState"

Description

Class that can hold one of three values: true, fals, undefined.

this class is kind of an extended bool and can additionally have the value undefined it can be constructed from, assigned from and compared to bool values and other TriStates

as well as bool on most systems this class uses one byte of memory

Author: Ralf Petring

Date: 2013-01-16

Public Functions

   
   
  TriState()
default constructor, constructs a new TriState with value undefined
   
  TriState(const bool b)
constructor, constructs a new TriState with the given bool as value
   
TriState & operator=(const bool & b)
   
bool operator==(const TriState & other) const
   
bool operator!=(const TriState & other) const
   
bool operator==(const bool other) const
   
bool operator!=(const bool other) const
   
bool isTrue() const
   
bool isFalse() const
   
bool isUndefined() const
   
bool isDefined() const
   
void undefine()

Documentation

function
Util::TriState::TriState

public inline
   
   
TriState( )

default constructor, constructs a new TriState with value undefined

Defined in Util/TriState.h:36


function
Util::TriState::TriState

public inline explicit
     
     
TriState( const bool b )

constructor, constructs a new TriState with the given bool as value

Defined in Util/TriState.h:40


function
Util::TriState::operator=

public inline
     
     
TriState & operator=( const bool & b )

assignment operator for bool

Note: this does not remove default constructors and default assignment operators etc.

Defined in Util/TriState.h:47


function
Util::TriState::operator==

public const inline
     
     
bool operator==( const TriState & other ) const

equality operator

Parameters

other
any TriState

Returns

true iff other is equal to this

Defined in Util/TriState.h:57


function
Util::TriState::operator!=

public const inline
     
     
bool operator!=( const TriState & other ) const

inequality operator

Parameters

other
any TriState

Returns

true iff other is not equal to this

Defined in Util/TriState.h:66


function
Util::TriState::operator==

public const inline
     
     
bool operator==( const bool other ) const

equality operator to bool

Parameters

other
any bool

Returns

true iff other is equal to this

Defined in Util/TriState.h:75


function
Util::TriState::operator!=

public const inline
     
     
bool operator!=( const bool other ) const

inequality operator to bool

Parameters

other
any bool

Returns

true iff other is not equal to this

Defined in Util/TriState.h:84


function
Util::TriState::isTrue

public const inline
   
   
bool isTrue( ) const

Returns

true iff current value is true

Defined in Util/TriState.h:91


function
Util::TriState::isFalse

public const inline
   
   
bool isFalse( ) const

Returns

true iff current value is false

Defined in Util/TriState.h:98


function
Util::TriState::isUndefined

public const inline
   
   
bool isUndefined( ) const

Returns

true iff current value is undefined

Defined in Util/TriState.h:105


function
Util::TriState::isDefined

public const inline
   
   
bool isDefined( ) const

Returns

true iff current value is true OR false

Defined in Util/TriState.h:112


function
Util::TriState::undefine

public inline
   
   
void undefine( )

sets the current value to undefined

Defined in Util/TriState.h:119