LeechCraft  0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
channeldevice.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #pragma once
10 
11 #include <atomic>
12 #include <list>
13 #include <mutex>
14 #include <QIODevice>
15 #include "sllconfig.h"
16 
17 namespace LC::Util
18 {
19  class UTIL_SLL_API ChannelDevice : public QIODevice
20  {
21  mutable std::mutex Mutex_;
22  std::list<QByteArray> Chunks_;
23 
24  std::atomic_bool Finished_ = false;
25  public:
26  using QIODevice::QIODevice;
27 
28  bool isSequential () const override;
29  bool atEnd () const override;
30 
31  void FinishWrite ();
32  protected:
33  qint64 readData (char*, qint64) override;
34  qint64 writeData (const char*, qint64) override;
35  };
36 }
#define UTIL_SLL_API
Definition: sllconfig.h:16