Overte C++ Documentation
AtpReply.h
1 //
2 // AtpReply.h
3 // libraries/networking/src
4 //
5 // Created by Zander Otavka on 8/4/16.
6 // Copyright 2016 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_AtpReply_h
13 #define hifi_AtpReply_h
14 
15 #include <QtNetwork/QNetworkReply>
16 #include <QUrl>
17 
18 #include "AssetResourceRequest.h"
19 
20 class AtpReply : public QNetworkReply {
21  Q_OBJECT
22 public:
23  AtpReply(const QUrl& url, QObject* parent = Q_NULLPTR);
24  ~AtpReply();
25  qint64 bytesAvailable() const override;
26  void abort() override { }
27  bool isSequential() const override { return true; }
28 
29 protected:
30  qint64 readData(char* data, qint64 maxSize) override;
31 
32 private:
33  void handleRequestFinish();
34 
35  ResourceRequest* _resourceRequest { nullptr };
36  QByteArray _content;
37  qint64 _readOffset { 0 };
38 };
39 
40 #endif // hifi_AtpReply_h