Overte C++ Documentation
OwningBuffer.h
1 //
2 // OwningBuffer.h
3 // shared/src
4 //
5 // Created by Ryan Huffman on 5/31/2018.
6 // Copyright 2018 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_OwningBuffer_h
13 #define hifi_OwningBuffer_h
14 
15 #include <QBuffer>
16 class OwningBuffer : public QBuffer {
17 public:
18  OwningBuffer(const QByteArray& content) : _content(content) {
19  setData(_content);
20  }
21  OwningBuffer(QByteArray&& content) : _content(std::move(content)) {
22  setData(_content);
23  }
24 
25 private:
26  QByteArray _content;
27 };
28 
29 #endif // hifi_OwningBuffer_h