From 8f900d22ca1119f55b8bc95393fa4879c157988d Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 8 Jul 2015 18:58:35 -0700 Subject: [PATCH] prefer typename to class for templates --- libraries/networking/src/PacketList.cpp | 12 ++++++------ libraries/networking/src/PacketList.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libraries/networking/src/PacketList.cpp b/libraries/networking/src/PacketList.cpp index db0b4fc90c..8a89058144 100644 --- a/libraries/networking/src/PacketList.cpp +++ b/libraries/networking/src/PacketList.cpp @@ -15,13 +15,13 @@ #include "NLPacket.h" -template PacketList::PacketList(PacketType::Value packetType) : +template PacketList::PacketList(PacketType::Value packetType) : _packetType(packetType) { } -template std::unique_ptr PacketList::createPacketWithExtendedHeader() { +template std::unique_ptr PacketList::createPacketWithExtendedHeader() { // use the static create method to create a new packet auto packet = T::create(_packetType); @@ -32,16 +32,16 @@ template std::unique_ptr PacketList::createPacketWithExte } } -template template qint64 PacketList::readPrimitive(U* data) { +template template qint64 PacketList::readPrimitive(U* data) { return QIODevice::read(reinterpret_cast(data), sizeof(U)); } -template template qint64 PacketList::writePrimitive(const U& data) { +template template qint64 PacketList::writePrimitive(const U& data) { static_assert(!std::is_pointer::value, "T must not be a pointer"); return QIODevice::write(reinterpret_cast(&data), sizeof(U)); } -template qint64 PacketList::writeData(const char* data, qint64 maxSize) { +template qint64 PacketList::writeData(const char* data, qint64 maxSize) { if (!_currentPacket) { // we don't have a current packet, time to set one up _currentPacket = createPacketWithExtendedHeader(); @@ -112,7 +112,7 @@ template qint64 PacketList::writeData(const char* data, qint64 maxS } } -template void PacketList::closeCurrentPacket() { +template void PacketList::closeCurrentPacket() { // move the current packet to our list of packets _packets.insert(std::move(_currentPacket)); } diff --git a/libraries/networking/src/PacketList.h b/libraries/networking/src/PacketList.h index 851949ac07..8fd901d28a 100644 --- a/libraries/networking/src/PacketList.h +++ b/libraries/networking/src/PacketList.h @@ -18,7 +18,7 @@ class NLPacket; -template class PacketList : public QIODevice { +template class PacketList : public QIODevice { public: PacketList(PacketType::Value packetType);