From 5a4b218b010252f1a77c7016a63595bb8415a78b Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 3 Jul 2018 10:47:28 +0200 Subject: Document what copies and what doesn't --- common/bufferutils.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/bufferutils.h b/common/bufferutils.h index f0460b7..5439442 100644 --- a/common/bufferutils.h +++ b/common/bufferutils.h @@ -6,23 +6,28 @@ namespace Sink { namespace BufferUtils { + +//Does not copy the data template static QByteArray extractBuffer(const T *data) { return QByteArray::fromRawData(reinterpret_cast(data->Data()), data->size()); } +//Returns a deep copy of the data template static QByteArray extractBufferCopy(const T *data) { return QByteArray(reinterpret_cast(data->Data()), data->size()); } +//Does not copy the data static QByteArray extractBuffer(const flatbuffers::FlatBufferBuilder &fbb) { return QByteArray::fromRawData(reinterpret_cast(fbb.GetBufferPointer()), fbb.GetSize()); } +//Returns a deep copy of the data static QList fromVector(const flatbuffers::Vector> &vector) { QList list; -- cgit v1.2.3