Exemplo n.º 1
0
//------------------------------------------------------------------------------
ObjectHandle reflectedCast(const ObjectHandle& other, const TypeId& typeIdDest,
                           const IDefinitionManager& definitionManager)
{
	std::shared_ptr<IObjectHandleStorage> storage =
	std::make_shared<ObjectHandleStorageReflectedCast>(other.storage(), typeIdDest, definitionManager);
	return ObjectHandle(storage);
}
Exemplo n.º 2
0
//------------------------------------------------------------------------------
ObjectHandle reflectedRoot(const ObjectHandle& source, const IDefinitionManager& definitionManager)
{
	if (!source.isValid())
	{
		return source;
	}

	auto root = source.storage();
	auto reflectedRoot = definitionManager.getObjectDefinition(root) != nullptr ? root : nullptr;
	for (;;)
	{
		auto inner = root->inner();
		if (inner == nullptr)
		{
			break;
		}
		root = inner;
		reflectedRoot = definitionManager.getObjectDefinition(root) != nullptr ? root : nullptr;
	}
	return ObjectHandle(reflectedRoot);
}