Calculator
Step 6
|
#include <number_impl.hpp>
Public Member Functions | |
number_rational (rational< long long > value) | |
number_rational (long long num) | |
number_rational (long long num, long long den) | |
rational< long long > | value () const |
virtual std::shared_ptr < number_impl > | promote_to_void () |
virtual std::shared_ptr < number_impl > | promote_to_double () |
Public Member Functions inherited from number_impl | |
virtual | ~number_impl () |
void | print (std::ostream &stream) const |
std::string | to_string () const |
void | save (std::ostream &stream) const |
bool | equals (number_impl const &rhs) const |
bool | less (number_impl const &rhs) const |
std::shared_ptr< number_impl > | add (number_impl const &rhs) |
std::shared_ptr< number_impl > | subtract (number_impl const &rhs) |
std::shared_ptr< number_impl > | multiply (number_impl const &rhs) |
std::shared_ptr< number_impl > | divide (number_impl const &rhs) |
void | add_ref () |
void | del_ref () |
std::shared_ptr< number_impl > | promote (number_impl &rhs) const |
virtual std::shared_ptr < number_impl > | promote_to_long () |
virtual std::shared_ptr < number_impl > | promote_to_rational () |
Private Member Functions | |
virtual std::string | do_to_string () const |
virtual void | do_save (std::ostream &stream) const |
virtual bool | do_equals (number_impl const &rhs) const |
virtual bool | do_less (number_impl const &rhs) const |
virtual std::shared_ptr < number_impl > | do_add (number_impl const &rhs) |
virtual std::shared_ptr < number_impl > | do_subtract (number_impl const &rhs) |
virtual std::shared_ptr < number_impl > | do_multiply (number_impl const &rhs) |
virtual std::shared_ptr < number_impl > | do_divide (number_impl const &rhs) |
virtual std::shared_ptr < number_impl > | do_promote (number_impl &rhs) const |
Private Attributes | |
rational< long long > | value_ |
Additional Inherited Members | |
Static Public Member Functions inherited from number_impl | |
static std::shared_ptr < number_impl > | read_library (std::istream &stream) |
Protected Member Functions inherited from number_impl | |
number_impl () | |
Represent a rational number. For the greatest range, always use long
to represent the numerator and denominator.
Definition at line 122 of file number_impl.hpp.
|
inline |
Definition at line 124 of file number_impl.hpp.
|
inline |
Definition at line 125 of file number_impl.hpp.
|
inline |
Definition at line 126 of file number_impl.hpp.
|
privatevirtual |
Implements number_impl.
Definition at line 271 of file number_impl.cpp.
References value(), and value_.
|
privatevirtual |
Implements number_impl.
Definition at line 298 of file number_impl.cpp.
References rational< T >::denominator(), rational< T >::numerator(), value(), and value_.
|
privatevirtual |
Implements number_impl.
Definition at line 259 of file number_impl.cpp.
References value().
|
privatevirtual |
Implements number_impl.
Definition at line 265 of file number_impl.cpp.
References value().
|
privatevirtual |
Implements number_impl.
Definition at line 289 of file number_impl.cpp.
References value(), and value_.
|
privatevirtual |
Implements number_impl.
Definition at line 310 of file number_impl.cpp.
References number_impl::promote_to_rational().
|
privatevirtual |
|
privatevirtual |
Implements number_impl.
Definition at line 280 of file number_impl.cpp.
References value(), and value_.
|
privatevirtual |
|
virtual |
|
virtual |
Reimplemented from number_impl.
Definition at line 316 of file number_impl.cpp.
|
inline |
Definition at line 127 of file number_impl.hpp.
References value_.
Referenced by do_add(), do_divide(), do_equals(), do_less(), do_multiply(), do_save(), do_subtract(), do_to_string(), and promote_to_double().
|
private |
Definition at line 141 of file number_impl.hpp.
Referenced by do_add(), do_divide(), do_multiply(), do_subtract(), and value().