Calculator  Step 6
Public Member Functions | Private Member Functions | Private Attributes | List of all members
node_number Class Reference

#include <node_impl.hpp>

Inheritance diagram for node_number:
node_impl

Public Member Functions

 node_number (number value)
 
 node_number (std::istream &stream)
 
number value () const
 
- Public Member Functions inherited from node_impl
 node_impl ()
 
virtual ~node_impl ()
 
 node_impl (node_impl &&)=default
 
node_imploperator= (node_impl &&)=default
 
void print (std::ostream &stream, int indent) const
 
number evaluate () const
 
std::string to_string () const
 
identifier_list const & get_parameters () const
 
void save (std::ostream &stream) const
 

Private Member Functions

virtual void print_node (std::ostream &stream, int indent) const override
 
virtual number evaluate_node () const override
 
virtual void save_node (std::ostream &stream) const override
 

Private Attributes

number value_
 

Additional Inherited Members

- Static Public Member Functions inherited from node_impl
static std::shared_ptr< node_implread_node (std::istream &stream)
 

Detailed Description

Number data type. Used for numeric literals.

Definition at line 68 of file node_impl.hpp.

Constructor & Destructor Documentation

node_number::node_number ( number  value)

Definition at line 125 of file node_impl.cpp.

126 : node_impl{}, value_{value}
127 {}
number value_
Definition: node_impl.hpp:78
node_number::node_number ( std::istream &  stream)

Definition at line 129 of file node_impl.cpp.

130 : node_impl{}, value_{stream}
131 {}
number value_
Definition: node_impl.hpp:78

Member Function Documentation

number node_number::evaluate_node ( ) const
overrideprivatevirtual

Implements node_impl.

Definition at line 145 of file node_impl.cpp.

References value().

147 {
148  return value();
149 }
number value() const
Definition: node_impl.cpp:133
void node_number::print_node ( std::ostream &  stream,
int  indent 
) const
overrideprivatevirtual

Implements node_impl.

Definition at line 139 of file node_impl.cpp.

References value().

141 {
142  stream << std::setw(indent) << "" << value() << '\n';
143 }
number value() const
Definition: node_impl.cpp:133
void node_number::save_node ( std::ostream &  stream) const
overrideprivatevirtual

Implements node_impl.

Definition at line 151 of file node_impl.cpp.

References number::save(), and value().

153 {
154  stream << "number ";
155  value().save(stream);
156  stream << '\n';
157 }
number value() const
Definition: node_impl.cpp:133
void save(std::ostream &stream) const
Definition: number.cpp:39
number node_number::value ( ) const

Definition at line 133 of file node_impl.cpp.

References value_.

Referenced by evaluate_node(), print_node(), and save_node().

135 {
136  return value_;
137 }
number value_
Definition: node_impl.hpp:78

Member Data Documentation

number node_number::value_
private

Definition at line 78 of file node_impl.hpp.

Referenced by value().


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