move handling of get all operation to sep method

This commit is contained in:
Stephen Birarda 2016-03-08 11:39:28 -08:00
parent bfb9801b22
commit 063826638e
2 changed files with 15 additions and 7 deletions

View file

@ -190,13 +190,7 @@ void AssetServer::handleAssetMappingOperation(QSharedPointer<ReceivedMessage> me
break;
}
case AssetMappingOperationType::GetAll: {
replyPacket->writePrimitive(AssetServerError::NoError);
auto count = _fileMappings.size();
replyPacket->writePrimitive(count);
for (auto it = _fileMappings.cbegin(); it != _fileMappings.cend(); ++ it) {
replyPacket->writeString(it.key());
replyPacket->write(QByteArray::fromHex(it.value().toString().toLocal8Bit()));
}
handleGetAllMappingOperation(*message, senderNode, *replyPacket);
break;
}
case AssetMappingOperationType::Set: {
@ -229,6 +223,19 @@ void AssetServer::handleGetMappingOperation(ReceivedMessage& message, SharedNode
}
}
void AssetServer::handleGetAllMappingOperation(ReceivedMessage& message, SharedNodePointer senderNode, NLPacketList& replyPacket) {
replyPacket.writePrimitive(AssetServerError::NoError);
auto count = _fileMappings.size();
replyPacket.writePrimitive(count);
for (auto it = _fileMappings.cbegin(); it != _fileMappings.cend(); ++ it) {
replyPacket.writeString(it.key());
replyPacket.write(QByteArray::fromHex(it.value().toString().toUtf8()));
}
}
void AssetServer::handleSetMappingOperation(ReceivedMessage& message, SharedNodePointer senderNode, NLPacketList& replyPacket) {
if (senderNode->getCanRez()) {
QString assetPath = message.readString();

View file

@ -42,6 +42,7 @@ private:
using Mappings = QVariantHash;
void handleGetMappingOperation(ReceivedMessage& message, SharedNodePointer senderNode, NLPacketList& replyPacket);
void handleGetAllMappingOperation(ReceivedMessage& message, SharedNodePointer senderNode, NLPacketList& replyPacket);
void handleSetMappingOperation(ReceivedMessage& message, SharedNodePointer senderNode, NLPacketList& replyPacket);
void handleDeleteMappingOperation(ReceivedMessage& message, SharedNodePointer senderNode, NLPacketList& replyPacket);