mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 21:00:05 +00:00
Add stream support class for QIODevice to boost::iostreams::stream
This commit is contained in:
parent
5ae098daff
commit
7b565d9c76
2 changed files with 35 additions and 1 deletions
|
|
@ -106,7 +106,8 @@ set(SRC_UI source/scwx/qt/ui/flow_layout.cpp
|
|||
source/scwx/qt/ui/level3_products_widget.cpp)
|
||||
set(HDR_UTIL source/scwx/qt/util/font.hpp
|
||||
source/scwx/qt/util/font_buffer.hpp
|
||||
source/scwx/qt/util/json.hpp)
|
||||
source/scwx/qt/util/json.hpp
|
||||
source/scwx/qt/util/streams.hpp)
|
||||
set(SRC_UTIL source/scwx/qt/util/font.cpp
|
||||
source/scwx/qt/util/font_buffer.cpp
|
||||
source/scwx/qt/util/json.cpp)
|
||||
|
|
|
|||
33
scwx-qt/source/scwx/qt/util/streams.hpp
Normal file
33
scwx-qt/source/scwx/qt/util/streams.hpp
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#pragma once
|
||||
|
||||
#include <boost/iostreams/categories.hpp>
|
||||
#include <QIODevice>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace util
|
||||
{
|
||||
|
||||
class IoDeviceSource
|
||||
{
|
||||
public:
|
||||
typedef char char_type;
|
||||
typedef boost::iostreams::source_tag category;
|
||||
|
||||
IoDeviceSource(QIODevice& source) : source_ {source} {}
|
||||
~IoDeviceSource() {}
|
||||
|
||||
std::streamsize read(char* buffer, std::streamsize n)
|
||||
{
|
||||
return source_.read(buffer, n);
|
||||
}
|
||||
|
||||
private:
|
||||
QIODevice& source_;
|
||||
};
|
||||
|
||||
} // namespace util
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
Loading…
Add table
Add a link
Reference in a new issue