BitShares-Core  5.0.0
BitShares blockchain implementation and command-line interface software
buffered_iostream.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <fc/io/iostream.hpp>
3 
4 namespace fc
5 {
6  namespace detail
7  {
8  class buffered_istream_impl;
9  class buffered_ostream_impl;
10  }
11 
16  class buffered_istream : public virtual istream
17  {
18  public:
21 
22  buffered_istream& operator=( buffered_istream&& i );
23 
24  virtual ~buffered_istream();
25 
34  virtual std::size_t readsome( char* buf, std::size_t len );
35  virtual size_t readsome( const std::shared_ptr<char>& buf, size_t len, size_t offset );
36 
41  virtual char peek() const;
42 
43  private:
44  std::unique_ptr<detail::buffered_istream_impl> my;
45  };
46  typedef std::shared_ptr<buffered_istream> buffered_istream_ptr;
47 
48 
52  class buffered_ostream : public virtual ostream
53  {
54  public:
55  buffered_ostream( ostream_ptr o, size_t bufsize = 4096 );
58 
59  buffered_ostream& operator=( buffered_ostream&& m );
64  virtual size_t writesome( const char* buf, size_t len );
65  virtual size_t writesome( const std::shared_ptr<const char>& buf, size_t len, size_t offset );
66 
67  virtual void close();
68  virtual void flush();
69  private:
70  std::unique_ptr<detail::buffered_ostream_impl> my;
71  };
72  typedef std::shared_ptr<buffered_ostream> buffered_ostream_ptr;
73 }
std::shared_ptr< buffered_istream > buffered_istream_ptr
Definition: api.hpp:15
std::shared_ptr< buffered_ostream > buffered_ostream_ptr
Reads data from an unbuffered stream and enables peek functionality.
std::shared_ptr< istream > istream_ptr
Definition: iostream.hpp:35
std::shared_ptr< ostream > ostream_ptr
Definition: iostream.hpp:59