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

394 lines
4.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;
class PRelation
2015-09-22 23:27:34 -05:00
{
string name;
2015-09-23 02:45:53 -05:00
public:
PRelation()
2015-09-23 02:45:53 -05:00
{
name = "~";
2015-09-23 02:45:53 -05:00
}
PRelation(string str)
2015-09-23 02:45:53 -05:00
{
name = str;
}
void setPRelation(string str)
2015-09-23 02:45:53 -05:00
{
name = str;
}
string getName()
{
return name;
}
2015-09-22 23:44:51 -05:00
};
2015-09-22 23:27:34 -05:00
class PAttribute
2015-09-23 02:45:53 -05:00
{
string name;
string type;
string size;
2015-09-23 02:45:53 -05:00
public:
PAttribute()
{
name = "~";
type = "~";
size = "~";
}
PAttribute(string str, string t)
2015-09-23 02:45:53 -05:00
{
name = str;
type = t;
size = "~";
2015-09-23 02:45:53 -05:00
}
PAttribute(string str, string t, string s)
2015-09-23 02:45:53 -05:00
{
name = str;
type = t;
size = s;
2015-09-23 02:45:53 -05:00
}
void setPAttributeName(string str)
{
name = str;
}
void setPAttributeType(string t)
{
type = t;
}
void setPAttributeSize(string s)
{
size = s;
}
string getPAttribute()
2015-09-23 02:45:53 -05:00
{
return name;
}
};
2015-09-22 23:27:34 -05:00
class PUnion
2015-09-22 23:27:34 -05:00
{
string Un1;
string Un2;
2015-09-23 02:45:53 -05:00
public:
PUnion()
{
Un1 = "~";
Un2 = "~";
}
PUnion (string s1, string s2)
2015-09-23 02:45:53 -05:00
{
Un1 = s1;
Un2 = s2;
}
string getPUnion()
2015-09-23 02:45:53 -05:00
{
return "Union of " + Un1 + " and " + Un2;
}
2015-09-22 23:44:51 -05:00
};
2015-09-22 23:27:34 -05:00
class PProduct
2015-09-22 23:27:34 -05:00
{
string Pr1;
string Pr2;
2015-09-23 02:45:53 -05:00
public:
PProduct()
{
Pr1 = "~";
Pr2 = "~";
}
PProduct(string s1, string s2)
2015-09-23 02:45:53 -05:00
{
Pr1 = s1;
Pr2 = s2;
}
string getPProduct()
2015-09-23 02:45:53 -05:00
{
return "Product of " + Pr1 + " and " + Pr2;
}
2015-09-22 23:44:51 -05:00
};
2015-09-22 23:27:34 -05:00
class PDifference
2015-09-22 23:27:34 -05:00
{
string D1;
string D2;
2015-09-23 02:45:53 -05:00
public:
PDifference()
{
D1 = "~";
D2 = "~";
}
PDifference(string s1, string s2)
2015-09-23 02:45:53 -05:00
{
D1 = s1;
D2 = s2;
}
string getPDifference()
2015-09-23 02:45:53 -05:00
{
return "Difference of " + D1 + " and " + D2;
}
2015-09-22 23:44:51 -05:00
};
2015-09-22 23:27:34 -05:00
class PRenaming
2015-09-22 23:27:34 -05:00
{
string newName;
string oldName;
2015-09-23 02:45:53 -05:00
public:
PRenaming()
{
newName = "~";
oldName = "~";
}
PRenaming(string s1, string s2)
2015-09-23 02:45:53 -05:00
{
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
class PProjection
2015-09-22 23:27:34 -05:00
{
string newName;
string oldName;
2015-09-23 02:45:53 -05:00
public:
PProjection()
{
newName = "~";
oldName = "~";
}
PProjection(string s1, string s2)
2015-09-23 02:45:53 -05:00
{
newName = s1;
oldName = s2;
}
string doPProjection()
2015-09-23 02:45:53 -05:00
{
return "Projecting " + oldName + " onto " + newName;
}
2015-09-22 23:44:51 -05:00
};
2015-09-22 23:27:34 -05:00
class POperand
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
POperand()
2015-09-22 23:44:51 -05:00
{
op = "~";
2015-09-22 23:44:51 -05:00
}
POperand(string str)
2015-09-22 23:44:51 -05:00
{
op = str;
}
void setPOperand(string str)
2015-09-22 23:44:51 -05:00
{
op = str;
}
string getPOperand()
2015-09-22 23:44:51 -05:00
{
return op;
}
};
class POp
2015-09-22 23:27:34 -05:00
{
string op;
2015-09-22 23:44:51 -05:00
public:
POp()
2015-09-22 23:44:51 -05:00
{
op = "~";
2015-09-22 23:44:51 -05:00
}
POp(string str)
2015-09-22 23:44:51 -05:00
{
op = str;
}
void setPOp(string str)
2015-09-22 23:44:51 -05:00
{
op = str;
}
string getPOp()
2015-09-22 23:44:51 -05:00
{
return op;
}
};
class PComparison
2015-09-22 23:27:34 -05:00
{
POp op;
POperand operand1;
POperand operand2;
2015-09-22 23:27:34 -05:00
2015-09-22 23:44:51 -05:00
public:
PComparison()
{
op.setPOp("~");
operand1.setPOperand("~");
operand2.setPOperand("~");
}
PComparison(string str1, string str2, string str3)
2015-09-22 23:44:51 -05:00
{
operand1.setPOperand(str1);
op.setPOp(str2);
operand2.setPOperand(str3);
2015-09-22 23:44:51 -05:00
}
void setPComparison(string str1, string str2, string str3)
2015-09-22 23:44:51 -05:00
{
operand1.setPOperand(str1);
op.setPOp(str2);
operand2.setPOperand(str3);
2015-09-22 23:44:51 -05:00
}
string getPComparison()
2015-09-22 23:44:51 -05:00
{
return operand1.getPOperand() + " " + op.getPOp() + " " + operand2.getPOperand();
2015-09-22 23:44:51 -05:00
}
};
class PConjunction
2015-09-22 23:27:34 -05:00
{
string conj;
2015-09-22 23:44:51 -05:00
public:
PConjunction()
{
conj = "~";
}
PConjunction(string str)
2015-09-22 23:44:51 -05:00
{
conj = str;
}
void setPConjunction(string str)
2015-09-22 23:44:51 -05:00
{
conj = str;
}
string getPConjunction()
2015-09-22 23:44:51 -05:00
{
return conj;
}
};
class PCondition
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
PCondition()
2015-09-23 02:45:53 -05:00
{
cond = "~";
2015-09-23 02:45:53 -05:00
}
PCondition(string str)
2015-09-22 23:44:51 -05:00
{
cond = str;
}
void setPCondition(string str)
2015-09-22 23:44:51 -05:00
{
cond = str;
}
string getPCondition()
2015-09-22 23:44:51 -05:00
{
return cond;
}
};
class PSelection
2015-09-22 23:27:34 -05:00
{
string select;
2015-09-22 23:44:51 -05:00
public:
PSelection()
{
select = "~";
}
PSelection(string str)
2015-09-22 23:44:51 -05:00
{
select = str;
}
string getPSelection()
2015-09-22 23:44:51 -05:00
{
return select;
}
};
2015-09-23 02:45:53 -05:00
class PExpression
2015-09-23 02:45:53 -05:00
{
PRelation rel;
PSelection sel;
PProjection proj;
PRenaming ren;
PUnion un;
PDifference diff;
PProduct prod;
string temp;
2015-09-23 02:45:53 -05:00
public:
PExpression()
2015-09-23 02:45:53 -05:00
{
}
PExpression(string str)
2015-09-23 02:45:53 -05:00
{
temp = str;
2015-09-23 02:45:53 -05:00
}
void setPExpression(string str)
2015-09-23 02:45:53 -05:00
{
temp = str;
2015-09-23 02:45:53 -05:00
}
string getPExpression()
2015-09-23 02:45:53 -05:00
{
return temp;
2015-09-23 02:45:53 -05:00
}
};