- Main Page
- Classes
- Files

# node.hpp

Go to the documentation of this file.

    00001 #ifndef NODE_HPP_
    00002 #define NODE_HPP_
    00003
    00004 #include <iosfwd>
    00005 #include <string>
    00006 #include <vector>
    00007
    00008 #include "number.hpp"
    00009
    00011 class node_impl;
    00012
    00014 class node;
    00015
    00017 typedef std::vector<node> node_list;
    00018
    00020 typedef std::vector<std::string> identifier_list;
    00021
    00027 class node {
    00028 public:
    00030   node();
    00032   node(std::istream& stream);
    00036   node(long x);
    00040   node(int x);
    00044   node(double x);
    00048   node(number num);
    00052   node(std::string const& identifier);
    00057   node(char op, node operand);
    00063   node(node left, char op, node right);
    00068   node(identifier_list const& parameters, node definition);
    00073   node(std::string const& name, node_list const& arguments);
    00078   node(node const& n);
    00082   ~node();
    00083
    00087   node& operator=(node const& n);
    00088
    00095   void print(std::ostream& stream, int indent = 0) const;
    00099   number evaluate() const;
    00104   std::string to_string() const;
    00109   identifier_list const& get_parameters() const;
    00110
    00114   void save(std::ostream& stream) const;
    00115
    00116 private:
    00118   static node_impl* make_binary_operator(node, char, node);
    00119
    00120   node_impl* pimpl_;
    00121 };
    00122
    00123 #endif