mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 18:13:29 +02:00
move templates below class in PacketList
This commit is contained in:
parent
1f689c8fe6
commit
8c188d6478
1 changed files with 12 additions and 8 deletions
|
@ -35,14 +35,8 @@ public:
|
|||
|
||||
void setExtendedHeader(const QByteArray& extendedHeader) { _extendedHeader = extendedHeader; }
|
||||
|
||||
template<typename U> qint64 readPrimitive(U* data) {
|
||||
return QIODevice::read(reinterpret_cast<char*>(data), sizeof(U));
|
||||
}
|
||||
|
||||
template<typename U> qint64 writePrimitive(const U& data) {
|
||||
static_assert(!std::is_pointer<U>::value, "U must not be a pointer");
|
||||
return QIODevice::write(reinterpret_cast<const char*>(&data), sizeof(U));
|
||||
}
|
||||
template<typename U> qint64 readPrimitive(U* data);
|
||||
template<typename U> qint64 writePrimitive(const U& data);
|
||||
protected:
|
||||
qint64 writeData(const char* data, qint64 maxSize);
|
||||
qint64 readData(char* data, qint64 maxSize) { return 0; }
|
||||
|
@ -63,4 +57,14 @@ private:
|
|||
QByteArray _extendedHeader;
|
||||
};
|
||||
|
||||
template <typename T> template <typename U> readPrimitive(U* data) {
|
||||
return QIODevice::read(reinterpret_cast<char*>(data), sizeof(U));
|
||||
}
|
||||
|
||||
template <typename T> template <typename U> writePrimitive(const U& data) {
|
||||
static_assert(!std::is_pointer<U>::value, "U must not be a pointer");
|
||||
return QIODevice::write(reinterpret_cast<const char*>(&data), sizeof(U));
|
||||
}
|
||||
|
||||
|
||||
#endif // hifi_PacketList_h
|
||||
|
|
Loading…
Reference in a new issue