#pragma once #include "exception.h" #include "parser.h" #include class ColumnValue { private: ColumnType m_type; union { int int_value; double float_value; }; }; struct ColValue { virtual bool isNull() { return false; }; virtual bool isInteger() { return false; }; virtual bool isFloat() { return false; }; virtual bool isString() { return false; }; virtual int integerValue() { throw Exception("Not supported"); }; virtual double floatValue() { throw Exception("Not supported"); }; virtual std::string stringValue() { throw Exception("Not supported"); }; virtual void print() {std::cout << "ColValue:" << std::endl; }; }; struct ColNullValue : ColValue { virtual bool isNull() { return true; }; virtual void print() {std::cout << "ColNullValue:" << std::endl; }; }; struct ColIntegerValue : ColValue { ColIntegerValue(int value) : m_integer(value) {}; ColIntegerValue(const ColIntegerValue &other) : m_integer(other.m_integer) {} virtual bool isInteger() { return true; }; virtual int integerValue() { return m_integer; }; virtual double floatValue() { return (double) m_integer; }; virtual std::string stringValue() { return std::to_string(m_integer); }; virtual void print() {std::cout << "ColIntegerValue: " << m_integer <> m_columns; };