This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
dmspine64backup/Parserv3.h

309 lines
3.3 KiB
C
Raw Normal View History

2015-09-22 23:27:34 -05:00
#include <string> // std::string
#include <iostream> // std::cout
#include <sstream> // std::stringstream
#include <vector>
#include <string>
using namespace std;
2015-09-22 23:44:51 -05:00
class Relation
2015-09-22 23:27:34 -05:00
{
string name;
2015-09-23 02:45:53 -05:00
public:
Relation()
{
}
Relation(string str)
{
name = str;
}
void setRelation(string str)
{
name = str;
}
string getName()
{
return name;
}
2015-09-22 23:44:51 -05:00
};
2015-09-22 23:27:34 -05:00
2015-09-23 02:45:53 -05:00
class Attribute
{
string name;
public:
Attribute(string str)
{
name = str;
}
void setAttribute(string str)
{
name = str;
}
string getAttribute()
{
return name;
}
};
2015-09-22 23:27:34 -05:00
class Union
{
string Un1;
string Un2;
2015-09-23 02:45:53 -05:00
public:
Union (string s1, string s2)
{
Un1 = s1;
Un2 = s2;
}
string getUnion()
{
return "Union of " + Un1 + " and " + Un2;
}
2015-09-22 23:44:51 -05:00
};
2015-09-22 23:27:34 -05:00
class Product
{
string Pr1;
string Pr2;
2015-09-23 02:45:53 -05:00
public:
Product(string s1, string s2)
{
Pr1 = s1;
Pr2 = s2;
}
string getProduct()
{
return "Product of " + Pr1 + " and " + Pr2;
}
2015-09-22 23:44:51 -05:00
};
2015-09-22 23:27:34 -05:00
2015-09-22 23:44:51 -05:00
class Difference
2015-09-22 23:27:34 -05:00
{
string D1;
string D2;
2015-09-23 02:45:53 -05:00
public:
Difference(string s1, string s2)
{
D1 = s1;
D2 = s2;
}
string getDifference()
{
return "Difference of " + D1 + " and " + D2;
}
2015-09-22 23:44:51 -05:00
};
2015-09-22 23:27:34 -05:00
2015-09-22 23:44:51 -05:00
class Renaming
2015-09-22 23:27:34 -05:00
{
string newName;
string oldName;
2015-09-23 02:45:53 -05:00
public:
Renaming(string s1, string s2)
{
newName = s1;
oldName = s2;
}
string doRename()
{
return "Renaming " + oldName + " to " + newName;
}
2015-09-22 23:44:51 -05:00
};
2015-09-22 23:27:34 -05:00
2015-09-22 23:44:51 -05:00
class Projection
2015-09-22 23:27:34 -05:00
{
string newName;
string oldName;
2015-09-23 02:45:53 -05:00
public:
Projection(string s1, string s2)
{
newName = s1;
oldName = s2;
}
string doProjection()
{
return "Projecting " + oldName + " onto " + newName;
}
2015-09-22 23:44:51 -05:00
};
2015-09-22 23:27:34 -05:00
2015-09-22 23:44:51 -05:00
class Operand
2015-09-22 23:27:34 -05:00
{
string op;
2015-09-22 23:44:51 -05:00
public:
2015-09-22 23:27:34 -05:00
2015-09-22 23:44:51 -05:00
Operand()
{
}
Operand(string str)
{
op = str;
}
void setOperand(string str)
{
op = str;
}
string getOperand()
{
return op;
}
};
class Op
2015-09-22 23:27:34 -05:00
{
string op;
2015-09-22 23:44:51 -05:00
public:
Op()
{
}
Op(string str)
{
op = str;
}
void setOp(string str)
{
op = str;
}
string getOp()
{
return op;
}
};
class Comparison
2015-09-22 23:27:34 -05:00
{
Op op;
Operand operand1;
Operand operand2;
2015-09-22 23:44:51 -05:00
public:
2015-09-22 23:27:34 -05:00
2015-09-22 23:44:51 -05:00
Comparison(string str1, string str2, string str3)
{
operand1.setOperand(str1);
op.setOp(str2);
operand2.setOperand(str3);
}
void setComparison(string str1, string str2, string str3)
{
operand1.setOperand(str1);
op.setOp(str2);
operand2.setOperand(str3);
}
string getComparison()
{
return operand1.getOperand() + " " + op.getOp() + " " + operand2.getOperand();
}
};
class Conjunction
2015-09-22 23:27:34 -05:00
{
string conj;
2015-09-22 23:44:51 -05:00
public:
Conjunction(string str)
{
conj = str;
}
void setConjunction(string str)
{
conj = str;
}
string getConjunction()
{
return conj;
}
};
class Condition
2015-09-22 23:27:34 -05:00
{
string cond;
2015-09-22 23:44:51 -05:00
public:
2015-09-23 02:45:53 -05:00
Condition()
{
}
2015-09-22 23:44:51 -05:00
Condition(string str)
{
cond = str;
}
void setCondition(string str)
{
cond = str;
}
string getCondition()
{
return cond;
}
};
class Selection
2015-09-22 23:27:34 -05:00
{
string select;
2015-09-22 23:44:51 -05:00
public:
Selection(string str)
{
select = str;
}
string getSelection()
{
return select;
}
};
2015-09-23 02:45:53 -05:00
class Expression
{
string exp;
public:
Expression()
{
}
Expression(string str)
{
exp = str;
}
void setExpression(string str)
{
exp = str;
}
string getExpression()
{
return exp;
}
};