source: liacs/coco/assignment4/MStatement.cc@ 329

Last change on this file since 329 was 2, checked in by Rick van der Zwet, 15 years ago

Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)

File size: 2.0 KB
RevLine 
[2]1
2#include "MOperator.h"
3#include "MStatement.h"
4#include <string>
5
6using namespace std;
7
8MStatement::MStatement(MOperator op, const char *comment) {
9 MStatement::SetOperator(op);
10 MStatement::SetOperand1(NULL);
11 MStatement::SetOperand2(NULL);
12 MStatement::SetOperand3(NULL);
13 MStatement::SetComment(comment);
14}
15
16MStatement::MStatement(MOperator op, MOperand *opnd1, const char *comment) {
17 MStatement::SetOperator(op);
18 MStatement::SetOperand1(opnd1);
19 MStatement::SetOperand2(NULL);
20 MStatement::SetOperand3(NULL);
21 MStatement::SetComment(comment);
22}
23
24MStatement::MStatement(MOperator op, MOperand *opnd1, MOperand *opnd2,
25 const char *comment) {
26 MStatement::SetOperator(op);
27 MStatement::SetOperand1(opnd1);
28 MStatement::SetOperand2(opnd2);
29 MStatement::SetOperand3(NULL);
30 MStatement::SetComment(comment);
31}
32
33MStatement::MStatement(MOperator op, MOperand *opnd1, MOperand *opnd2,
34 MOperand *opnd3, const char *comment) {
35 MStatement::SetOperator(op);
36 MStatement::SetOperand1(opnd1);
37 MStatement::SetOperand2(opnd2);
38 MStatement::SetOperand3(opnd3);
39 MStatement::SetComment(comment);
40}
41
42MStatement::~MStatement() {
43 delete comment;
44}
45
46MOperator MStatement::GetOperator() const {
47 return moperator;
48}
49
50void MStatement::SetOperator(MOperator op) {
51 moperator = op;
52}
53
54MOperand *MStatement::GetOperand1() const {
55 return operand1;
56}
57
58void MStatement::SetOperand1(MOperand *operand) {
59 operand1 = operand;
60}
61
62MOperand *MStatement::GetOperand2() const {
63 return operand2;
64}
65
66void MStatement::SetOperand2(MOperand *operand) {
67 operand2 = operand;
68}
69
70MOperand *MStatement::GetOperand3() const {
71 return operand3;
72}
73
74void MStatement::SetOperand3(MOperand *operand) {
75 operand3 = operand;
76}
77
78void MStatement::Dump(FILE *file, int indent) {
79 //XXX: Dump operand, operators # Comment
80}
81
82const char *MStatement::GetComment() const {
83 return (comment);
84}
85
86void MStatement::SetComment(const char *value) {
87 comment = value;
88}
89
90string MStatement::GetLabel() const {
91 return label;
92}
93
94void MStatement::SetLabel(string value) {
95 label = value;
96}
Note: See TracBrowser for help on using the repository browser.