void Variable::operator/=(const Variable &aVariable) { if (aVariable.getFloat() == 0.f || !aVariable.getInteger()) { throw "DIVISION BY ZERO"; } if (type == INT) { valueInteger /= aVariable.getInteger(); } else if (type == FLOAT) { valueFloat /= aVariable.getFloat(); } }
void Variable::operator*=(const Variable &aVariable) { if (type == INT) { valueInteger *= aVariable.getInteger(); } else if (type == FLOAT) { valueFloat *= aVariable.getFloat(); } }
Variable::commandPrompResults Variable::CompareWith(const Variable &aVariable) const { Variable::Type type = aVariable.getType(); if (type == FLOAT || type == FLOAT) { return CompareWithFloat(aVariable.getFloat()); } else if (type == INT && type == INT) { return CompareWithInt(aVariable.getInteger()); } else if (type == STRING || type == STRING) { return CompareWithString(aVariable.getString()); } return UNDEFCMP; }
void Variable::operator=(const Variable &aVariable) { Variable::Type type = aVariable.getType(); if (type == INT) { set(aVariable.getInteger()); } else if (type == FLOAT) { set(aVariable.getFloat()); } else if (type == STRING) { set(aVariable.getString()); } else { clear(); } }
void Variable::operator%=(const Variable &aVariable) { set(getInteger() % aVariable.getInteger()); }