#pragma once #include #include #include class number { public: number() = default; /** * \brief Return a hexadecimal string representation of this number. */ std::string to_hex_string() const; /** * \brief Return a decimal string representation of this number. */ std::string to_dec_string() const; /** * \brief Return the result of the addition of a number and this number. * * \param n The number to add to this number. */ number operator+(const number &n) const; /** * \brief Tells whether the number passed as parameter is strictly less * than this number. * * \param n The number to compare with this number. */ bool operator<(const number &n) const; /** * \brief Tells whether the number passed as parameter is strictly greater * than this number. * * \param n The number to compare with this number. */ bool operator>(const number &n) const; /** * \brief Tells whether the number passed as parameter is less than or * equal to this number. * * \param n The number to compare with this number. */ bool operator<=(const number &n) const; /** * \brief Tells whether the number passed as parameter is greater than or * equal to this number. * * \param n The number to compare with this number. */ bool operator>=(const number &n) const; /** * \brief Tells whether the number passed as parameter is equal to this * number. * * \param n The number to compare with this number. */ bool operator==(const number &n) const; /** * \brief Tells whether the number passed as parameter is not equal to this * number. * * \param n The number to compare with this number. */ bool operator!=(const number &n) const; private: /* First item is the least significant. */ std::list _operands; }; std::ostream &operator<<(std::ostream &, const number &);