コード例 #1
0
bool IObjectMapPropertyType<KeyType, ValueType>::DoDeserialize(
	BidirectionalSerializer &bidi, KeyType &key, ValueType &value)
{
	IDeserializer *deserializer = bidi.Deserializer();

	Command item;

	if(deserializer->BeginCommand(item))
	{
		OrkAssert(item.Type() == Command::EITEM);

		if(item.Type() != Command::EITEM)
		{
			deserializer->EndCommand(item);
			bidi.Fail();
			return false;
		}

		Command attribute;
		deserializer->BeginCommand(attribute);
		
		OrkAssert(attribute.Type() == Command::EATTRIBUTE);
		OrkAssert(attribute.Name() == "key");

		if(attribute.Type() != Command::EATTRIBUTE || attribute.Name() != "key")
		{
			deserializer->EndCommand(attribute);
			bidi.Fail();
			return false;
		}

		deserializer->Hint("map_key");
		bidi | key;
		deserializer->EndCommand(attribute);

		deserializer->Hint("map_value");
		bidi | value;
		deserializer->EndCommand(item);

		return true;
	}

	return false;
}
コード例 #2
0
bool AccessorObjectPropertyObject::Deserialize(IDeserializer &serializer, Object *object) const
{
    Object *object_property = (object->*mObjectAccessor)();
	Command command;
	serializer.BeginCommand(command);

	OrkAssertI(command.Type() == Command::EOBJECT,
		"AccessorObjectPropertyObject::Deserialize::Expected an Object command!\n");

	if(command.Type() == Command::EOBJECT)
	{
		object_property->Deserialize(serializer);
	}

	serializer.EndCommand(command);

    return true;
}