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

Integer number. More...

#include <Integer.h>

Inheritance diagram for TBTK::Integer:
TBTK::PseudoSerializable

Public Member Functions

 Integer ()
 
constexpr Integer (int value)
 
 Integer (const std::string &serialization, Serializable::Mode mode)
 
constexpr operator int () const
 
Integeroperator= (int rhs)
 
Integeroperator+= (const Integer &rhs)
 
Integeroperator-= (const Integer &rhs)
 
Integeroperator*= (const Integer &rhs)
 
Integeroperator/= (const Integer &rhs)
 
Integeroperator++ ()
 
Integer operator++ (int)
 
Integeroperator-- ()
 
Integer operator-- (int)
 
std::string serialize (Serializable::Mode mode) const
 

Friends

void to_json (nlohmann::json &j, const Integer &integer)
 
void from_json (const nlohmann::json &j, Integer &integer)
 

Detailed Description

Integer number.

Constructor & Destructor Documentation

◆ Integer() [1/3]

TBTK::Integer::Integer ( )
inline

Constructor.

◆ Integer() [2/3]

constexpr TBTK::Integer::Integer ( int  value)
inlineconstexpr

Constructor.

Parameters
valueThe value to initilize the Integer with.

◆ Integer() [3/3]

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

Constructs an Index from a serialization string.

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

Member Function Documentation

◆ operator int()

constexpr TBTK::Integer::operator int ( ) const
inlineconstexpr

Type conversion operator.

◆ operator*=()

Integer& TBTK::Integer::operator*= ( const Integer rhs)
inline

Multiplication assignment operator.

Parameters
rhsThe right hand side.
Returns
The Integer after the multiplication has occured.

◆ operator++() [1/2]

Integer& TBTK::Integer::operator++ ( )
inline

Increment operator.

Returns
The Integer after the increment has occured.

◆ operator++() [2/2]

Integer TBTK::Integer::operator++ ( int  )
inline

Increment operator.

Returns
The Integer before the increment has occured.

◆ operator+=()

Integer& TBTK::Integer::operator+= ( const Integer rhs)
inline

Addition assignment operator.

Parameters
rhsThe right hand side.
Returns
The Integer after the addition has occured.

◆ operator--() [1/2]

Integer& TBTK::Integer::operator-- ( )
inline

Decrement operator.

Returns
The Integer after the decrease has occured.

◆ operator--() [2/2]

Integer TBTK::Integer::operator-- ( int  )
inline

Decrement operator.

Returns
The Integer before the decrease has occured.

◆ operator-=()

Integer& TBTK::Integer::operator-= ( const Integer rhs)
inline

Subtraction assignment operator.

Parameters
rhsThe right hand side.
Returns
The Integer after the subtraction has occured.

◆ operator/=()

Integer& TBTK::Integer::operator/= ( const Integer rhs)
inline

Division assignment operator.

Parameters
rhsThe right hand side.
Returns
The Integer after the division has occured.

◆ operator=()

Integer& TBTK::Integer::operator= ( int  rhs)
inline

Assignment operator.

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

◆ serialize()

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

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

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

Friends And Related Function Documentation

◆ from_json

void from_json ( const nlohmann::json &  j,
Integer integer 
)
friend

Implements the Nlohmann json interface for conversion from json.

Parameters
jThe json input.
integerThe Integer to convert to.

◆ to_json

void to_json ( nlohmann::json &  j,
const Integer integer 
)
friend

Implements the Nlohmann json interface for conversion to json.

Parameters
jThe json output.
integerThe Integer to convert.

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