Calculator Step 3

- Main Page
- Classes
- Files

- File List
- File Members

node.hpp
Go to the documentation of this file.
1 #ifndef NODE_HPP_
2 #define NODE_HPP_
3
4 #include <iosfwd>
5 #include <string>
6 #include <memory>
7
9 class node_impl;
10
16 class node {
17 public:
19 node();
23 node(double number);
27 node(std::string identifier);
32 node(node identifier, node number);
37 node(char op, node operand);
43 node(node left, char op, node right);
44
45 ~node() = default;
46 node(node const&) = default;
47 node(node&&) = default;
48 node& operator=(node const&) = default;
49 node& operator=(node&&) = default;
50
57 void print(std::ostream& stream, int indent = 0) const;
61 double evaluate() const;
66 std::string to_string() const;
67
68 private:
70 static std::shared_ptr<node_impl> make_binary_operator(node, char, node);
71
72 std::shared_ptr<node_impl> pimpl_;
73 };
74
75 #endif
node_impl
Definition: node_impl.hpp:17
node
Definition: node.hpp:16
node::pimpl_
std::shared_ptr< node_impl > pimpl_
Definition: node.hpp:72
node::make_binary_operator
static std::shared_ptr< node_impl > make_binary_operator(node, char, node)
Factory function to make the binary operator nodes.
Definition: node.cpp:6
node::operator=
node & operator=(node const &)=default
node::print
void print(std::ostream &stream, int indent=0) const
Definition: node.cpp:44
node::to_string
std::string to_string() const
Definition: node.cpp:56
node::evaluate
double evaluate() const
Definition: node.cpp:50
node::node
node()
Definition: node.cpp:20
node::~node
~node()=default