Go to the documentation of this file.
23 #ifndef COM_DAFER45_TBTK_INTEGER
24 #define COM_DAFER45_TBTK_INTEGER
28 #ifndef TBTK_DISABLE_NLOHMANN_JSON
29 # include "TBTK/json.hpp"
34 #if TBTK_WRAP_PRIMITIVE_TYPES
45 constexpr
Integer(
int value) : value(value) {}
56 constexpr
operator int()
const{
return value; };
160 #ifndef TBTK_DISABLE_NLOHMANN_JSON
166 nlohmann::to_json(j, integer.value);
174 nlohmann::from_json(j, integer.value);
183 const std::string &serialization,
187 case Serializable::Mode::JSON:
188 value = stoi(serialization);
192 "Integer::Integer()",
193 "Only Serializable::Mode::JSON is supported yet.",
201 case Serializable::Mode::JSON:
202 return std::to_string(value);
205 "Integer::serialize()",
206 "Only Serializable::Mode::JSON is supported yet.",
Integer & operator=(int rhs)
Definition: Integer.h:63
Integer number.
Definition: Integer.h:37
Integer & operator/=(const Integer &rhs)
Definition: Integer.h:107
Integer & operator--()
Definition: Integer.h:135
Integer & operator-=(const Integer &rhs)
Definition: Integer.h:85
friend void to_json(nlohmann::json &j, const Integer &integer)
Definition: Integer.h:165
std::string serialize(Serializable::Mode mode) const
Definition: Integer.h:199
Integer()
Definition: Integer.h:40
Integer & operator+=(const Integer &rhs)
Definition: Integer.h:74
Integer & operator++()
Definition: Integer.h:116
Base class for psudo-serializable objects.
Integer & operator*=(const Integer &rhs)
Definition: Integer.h:96
Integer operator++(int)
Definition: Integer.h:125
friend void from_json(const nlohmann::json &j, Integer &integer)
Definition: Integer.h:173
constexpr Integer(int value)
Definition: Integer.h:45
Mode
Definition: Serializable.h:47
Definition: PseudoSerializable.h:31
Integer operator--(int)
Definition: Integer.h:144