Пример #1
0
			Constant(const Constant& other)
			: kind_(other.kind_) {
				switch (other.kind()) {
					case NULLVAL:
						break;
					case BOOLEAN:
						bool_ = other.boolValue();
						break;
					case INTEGER:
						integer_ = other.integerValue().copy();
						break;
					case FLOATINGPOINT:
						float_ = other.floatValue();
						break;
					case CHARACTER:
						character_ = other.characterValue();
						break;
					case STRING:
						string_ = other.stringValue();
						break;
				}
			}
Пример #2
0
			bool operator==(const Constant& other) const {
				if (kind() != other.kind()) {
					return false;
				}
				
				switch (kind()) {
					case NULLVAL:
						return true;
					case BOOLEAN:
						return boolValue() == other.boolValue();
					case INTEGER:
						return integerValue() == other.integerValue();
					case FLOATINGPOINT:
						return floatValue() == other.floatValue();
					case CHARACTER:
						return characterValue() == other.characterValue();
					case STRING:
						return stringValue() == other.stringValue();
				}
				
				return false;
			}