Beispiel #1
0
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();
	}
}
Beispiel #2
0
void Variable::operator*=(const Variable &aVariable) {
	if (type == INT) {
		valueInteger *= aVariable.getInteger();
	} else if (type == FLOAT) {
		valueFloat *= aVariable.getFloat();
	}
}
Beispiel #3
0
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;
}
Beispiel #4
0
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();
	}
}
Beispiel #5
0
void Variable::operator%=(const Variable &aVariable) {
	set(getInteger() % aVariable.getInteger());
}