TBTK
Need a break? Support the development by playing Polarity Puzzles
TBTK::Boolean Class Reference

Boolean number. More...

#include <Boolean.h>

Inheritance diagram for TBTK::Boolean:
TBTK::PseudoSerializable

Public Member Functions

 Boolean ()
 
constexpr Boolean (bool value)
 
 Boolean (const std::string &serialization, Serializable::Mode mode)
 
constexpr operator bool () const
 
Booleanoperator= (bool rhs)
 
std::string serialize (Serializable::Mode mode) const
 

Friends

void to_json (nlohmann::json &j, const Boolean &boolean)
 
void from_json (const nlohmann::json &j, Boolean &boolean)
 

Detailed Description

Boolean number.

Constructor & Destructor Documentation

◆ Boolean() [1/3]

TBTK::Boolean::Boolean ( )
inline

Constructor.

◆ Boolean() [2/3]

constexpr TBTK::Boolean::Boolean ( bool  value)
inlineconstexpr

Constructor.

Parameters
valueThe value to initilize the Boolean with.

◆ Boolean() [3/3]

TBTK::Boolean::Boolean ( const std::string &  serialization,
Serializable::Mode  mode 
)
inline

Constructs an Boolean from a serialization string.

Parameters
serializationSerialization string from which to construct the Boolean.
modeMode with which the string has been serialized.

Member Function Documentation

◆ operator bool()

constexpr TBTK::Boolean::operator bool ( ) const
inlineconstexpr

Type conversion operator.

◆ operator=()

Boolean& TBTK::Boolean::operator= ( bool  rhs)
inline

Assignment operator.

Parameters
valueThe value to assign the Boolean.
Returns
The Boolean after assignment has occured.

◆ serialize()

std::string TBTK::Boolean::serialize ( Serializable::Mode  mode) const
inline

Serialize Boolean. Note that Boolean is PseudoSerializable rather than Serializable. This means that the Serializable interface is implemented non-virtually.

Parameters
modeSerialization mode.
Returns
Serialized string representation of the Boolean.

Friends And Related Function Documentation

◆ from_json

void from_json ( const nlohmann::json &  j,
Boolean boolean 
)
friend

Implements the Nlohmann json interface for conversion from json.

Parameters
jThe json input.
booleanThe Boolean to convert to.

◆ to_json

void to_json ( nlohmann::json &  j,
const Boolean boolean 
)
friend

Implements the Nlohmann json interface for conversion to json.

Parameters
jThe json output.
booleanThe Boolean to convert.

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