-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathObject.h
49 lines (46 loc) · 1.44 KB
/
Object.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Project: CS 460 Spring 2017 Project 3
// File: Object.h
// Author: Dr. Watts
// Desciption: Object class for Scheme to C++ translation
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
enum obj_type {NONETYPE, INT, REAL, STRING, LIST};
class Object
{
public:
Object();
Object (const int & value);
Object (const double & value);
Object (const string & value);
bool operator == (const Object & O) const;
bool operator != (const Object & O) const;
bool operator < (const Object & O) const;
bool operator <= (const Object & O) const;
bool operator > (const Object & O) const;
bool operator >= (const Object & O) const;
Object operator + (const Object & O) const;
Object operator - (const Object & O) const;
Object operator * (const Object & O) const;
Object operator / (const Object & O) const;
friend bool numberp (const Object & O);
friend bool symbolp (const Object & O);
friend bool listp (const Object & O);
friend bool zerop (const Object & O);
friend bool nullp (const Object & O);
friend bool charp (const Object & O);
friend bool stringp (const Object & O);
friend Object listop (const string & S, const Object & O);
friend Object cons (const Object & O1, const Object O2);
friend ostream & operator << (ostream & outs, const Object & O);
private:
Object (stringstream & ss);
void MakeName ();
obj_type type;
string name;
int intval;
double realval;
string strval;
vector <Object> listval;
};