Пример #1
0
GUID ff::Dict::GetGuid(ff::StringRef name, REFGUID defaultValue) const
{
	Value *value = GetValue(name);

	if (value)
	{
		if (value->IsType(Value::Type::Guid))
		{
			return value->AsGuid();
		}
		else
		{
			ValuePtr newValue;

			if (value->Convert(Value::Type::Guid, &newValue))
			{
				return newValue->AsGuid();
			}
		}
	}

	return defaultValue;
}
Пример #2
0
bool ff::Value::operator==(const Value &r) const
{
	if (this == &r)
	{
		return true;
	}

	if (GetType() != r.GetType())
	{
		return false;
	}

	switch (GetType())
	{
		case Type::Null:
			return true;

		case Type::Bool:
			return AsBool() == r.AsBool();

		case Type::Double:
			return AsDouble() == r.AsDouble();

		case Type::Float:
			return AsFloat() == r.AsFloat();

		case Type::Int:
			return AsInt() == r.AsInt();

		case Type::Object:
			return AsObject() == r.AsObject();

		case Type::Point:
			return AsPoint() == r.AsPoint();

		case Type::PointF:
			return AsPointF() == r.AsPointF();

		case Type::Rect:
			return AsRect() == r.AsRect();

		case Type::RectF:
			return AsRectF() == r.AsRectF();

		case Type::String:
			return AsString() == r.AsString();

		case Type::StringVector:
			return AsStringVector() == r.AsStringVector();

		case Type::ValueVector:
			return AsValueVector() == r.AsValueVector();

		case Type::Guid:
			return AsGuid() == r.AsGuid() ? true : false;

		case Type::IntVector:
			return AsIntVector() == r.AsIntVector();

		case Type::DoubleVector:
			return AsDoubleVector() == r.AsDoubleVector();

		case Type::FloatVector:
			return AsFloatVector() == r.AsFloatVector();

		case Type::DataVector:
			return AsDataVector() == r.AsDataVector();

		case Type::Data:
			return AsData() == r.AsData();

		case Type::SavedData:
		case Type::SavedDict:
			return AsSavedData() == r.AsSavedData();

		default:
			assert(false);
			return false;
	}
}