Changeset View
Changeset View
Standalone View
Standalone View
src/private/protocol.cpp
Show First 20 Lines • Show All 376 Lines • ▼ Show 20 Line(s) | |||||
377 | { | 377 | { | ||
378 | auto iter = sFactoryPrivate->registrar.constFind(type); | 378 | auto iter = sFactoryPrivate->registrar.constFind(type); | ||
379 | if (iter == sFactoryPrivate->registrar.constEnd()) { | 379 | if (iter == sFactoryPrivate->registrar.constEnd()) { | ||
380 | return QSharedPointer<Response>::create(); | 380 | return QSharedPointer<Response>::create(); | ||
381 | } | 381 | } | ||
382 | return iter->second(); | 382 | return iter->second(); | ||
383 | } | 383 | } | ||
384 | 384 | | |||
385 | CommandPtr Factory::deserializeImpl(QIODevice *device) | | |||
386 | { | | |||
387 | device->waitForReadyRead(sizeof(Command::Type)); | | |||
388 | Command::Type cmdType; | | |||
389 | if (device->peek((char *) &cmdType, sizeof(Command::Type)) != sizeof(Command::Type)) { | | |||
390 | throw ProtocolException("Failed to peek command type"); | | |||
391 | } | | |||
392 | | ||||
393 | if (cmdType & Command::_ResponseBit) { | | |||
394 | return Factory::response(Command::Type(cmdType & ~Command::_ResponseBit)); | | |||
395 | } else { | | |||
396 | return Factory::command(cmdType); | | |||
397 | } | | |||
398 | } | | |||
399 | | ||||
400 | | ||||
401 | | ||||
402 | | ||||
403 | | ||||
404 | /******************************************************************************/ | 385 | /******************************************************************************/ | ||
405 | 386 | | |||
406 | 387 | | |||
407 | 388 | | |||
408 | 389 | | |||
409 | 390 | | |||
410 | /******************************************************************************/ | 391 | /******************************************************************************/ | ||
411 | 392 | | |||
▲ Show 20 Lines • Show All 377 Lines • ▼ Show 20 Line(s) | 769 | return stream << item.id | |||
789 | << item.mimeType | 770 | << item.mimeType | ||
790 | << item.remoteId | 771 | << item.remoteId | ||
791 | << item.remoteRevision; | 772 | << item.remoteRevision; | ||
792 | } | 773 | } | ||
793 | 774 | | |||
794 | QDebug operator<<(QDebug _dbg, const ChangeNotification::Item &item) | 775 | QDebug operator<<(QDebug _dbg, const ChangeNotification::Item &item) | ||
795 | { | 776 | { | ||
796 | QDebug dbg(_dbg.noquote()); | 777 | QDebug dbg(_dbg.noquote()); | ||
797 | return dbg << "Item" << item.id << "(RID:" << item.remoteId | 778 | return dbg << "Item" << item.id << "(RID:" << item.remoteId | ||
dvratil: You can commit this, but commit it as a separate commit, please. | |||||
798 | << ", RREV:" << item.remoteRevision << ", mimetype: " << item.mimeType; | 779 | << ", RREV:" << item.remoteRevision << ", mimetype: " << item.mimeType; | ||
799 | } | 780 | } | ||
800 | 781 | | |||
801 | 782 | | |||
802 | DataStream &operator>>(DataStream &stream, ChangeNotification::Relation &relation) | 783 | DataStream &operator>>(DataStream &stream, ChangeNotification::Relation &relation) | ||
803 | { | 784 | { | ||
804 | return stream >> relation.type | 785 | return stream >> relation.type | ||
805 | >> relation.leftId | 786 | >> relation.leftId | ||
Show All 26 Lines |
You can commit this, but commit it as a separate commit, please.