some renamings
This commit is contained in:
31
parser.h
31
parser.h
@@ -54,7 +54,7 @@ namespace usql {
|
||||
std::unique_ptr<Node> value;
|
||||
std::string name;
|
||||
|
||||
SelectColNode(std::unique_ptr<Node> column, const std::string alias) :
|
||||
SelectColNode(std::unique_ptr<Node> column, const std::string& alias) :
|
||||
Node(NodeType::column_name), value(std::move(column)), name(alias) {}
|
||||
};
|
||||
|
||||
@@ -85,6 +85,7 @@ namespace usql {
|
||||
struct ValueNode : Node {
|
||||
ValueNode(NodeType type) : Node(type) {}
|
||||
|
||||
virtual bool isNull() { return false; }
|
||||
virtual long getIntValue() = 0;
|
||||
virtual double getDoubleValue() = 0;
|
||||
virtual std::string getStringValue() = 0;
|
||||
@@ -97,19 +98,19 @@ namespace usql {
|
||||
|
||||
IntValueNode(long value) : ValueNode(NodeType::int_value), value(value) {}
|
||||
|
||||
long getIntValue() { return value; };
|
||||
double getDoubleValue() { return (double) value; };
|
||||
std::string getStringValue() { return std::to_string(value); }
|
||||
long getIntValue() override { return value; };
|
||||
double getDoubleValue() override { return (double) value; };
|
||||
std::string getStringValue() override { return std::to_string(value); }
|
||||
};
|
||||
|
||||
struct FloatValueNode : ValueNode {
|
||||
struct DoubleValueNode : ValueNode {
|
||||
double value;
|
||||
|
||||
FloatValueNode(double value) : ValueNode(NodeType::float_value), value(value) {}
|
||||
DoubleValueNode(double value) : ValueNode(NodeType::float_value), value(value) {}
|
||||
|
||||
long getIntValue() { return (int) value; };
|
||||
double getDoubleValue() { return value; };
|
||||
std::string getStringValue() { return std::to_string(value); }
|
||||
long getIntValue() override { return (long) value; };
|
||||
double getDoubleValue() override { return value; };
|
||||
std::string getStringValue() override { return std::to_string(value); }
|
||||
};
|
||||
|
||||
struct StringValueNode : ValueNode {
|
||||
@@ -117,9 +118,9 @@ namespace usql {
|
||||
|
||||
StringValueNode(std::string value) : ValueNode(NodeType::string_value), value(value) {}
|
||||
|
||||
long getIntValue() { return std::stoi(value); };
|
||||
double getDoubleValue() { return std::stod(value); };
|
||||
std::string getStringValue() { return value; };
|
||||
long getIntValue() override { return std::stoi(value); };
|
||||
double getDoubleValue() override { return std::stod(value); };
|
||||
std::string getStringValue() override { return value; };
|
||||
};
|
||||
|
||||
struct DatabaseValueNode : Node {
|
||||
@@ -185,7 +186,7 @@ namespace usql {
|
||||
std::string table_name;
|
||||
std::vector<ColDefNode> cols_defs;
|
||||
|
||||
CreateTableNode(const std::string name, std::vector<ColDefNode> defs) :
|
||||
CreateTableNode(const std::string& name, std::vector<ColDefNode> defs) :
|
||||
Node(NodeType::create_table), table_name(name), cols_defs(defs) {}
|
||||
};
|
||||
|
||||
@@ -239,7 +240,7 @@ namespace usql {
|
||||
std::string table_name;
|
||||
std::string filename;
|
||||
|
||||
SaveTableNode(const std::string name, std::string file) :
|
||||
SaveTableNode(const std::string& name, std::string file) :
|
||||
Node(NodeType::save_table), table_name(name), filename(file) {}
|
||||
};
|
||||
|
||||
@@ -247,7 +248,7 @@ namespace usql {
|
||||
std::string table_name;
|
||||
std::unique_ptr<Node> where;
|
||||
|
||||
DeleteFromTableNode(const std::string name, std::unique_ptr<Node> where_clause) :
|
||||
DeleteFromTableNode(const std::string& name, std::unique_ptr<Node> where_clause) :
|
||||
Node(NodeType::delete_from), table_name(name), where(std::move(where_clause)) {}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user