Пример #1
0
bool IntToStringNode::CanConnect(ObjectHandleT<ISlot> mySlot, ObjectHandleT<ISlot> otherSlot)
{
	bool result = false;

	while (true)
	{
		ObjectHandleT<INode> otherNode = otherSlot->Node();
		if (this == otherNode.get())
			break;

		if (!(mySlot->IsInput() ^ otherSlot->IsInput()))
			break;

		if (mySlot->Type() != otherSlot->Type())
			break;

		if (mySlot->Color() != otherSlot->Color())
			break;

		auto connectedSlots = mySlot->GetConnectedSlots();
		result = (std::find_if(connectedSlots->begin(), connectedSlots->end(), [&otherSlot](const ISlot* slot) {
			          return otherSlot->Id() == slot->Id();
			      }) == connectedSlots->end());
		break;
	}

	return result;
}