Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
streamredirect.h
1 #pragma once
2 
3 #include <iostream>
4 #include <streambuf>
5 #include <string>
6 
7 
8 class HUD;
9 
10 class StreamRedirect : public std::basic_streambuf<char> {
11 public:
12  StreamRedirect(std::ostream &stream, HUD *hud, bool copy = false);
13  ~StreamRedirect();
14 
15 protected:
16  virtual int_type overflow(int_type v) override;
17  virtual std::streamsize xsputn(const char *p, std::streamsize n) override;
18 
19 private:
20  std::ostream &m_stream;
21  std::ostream *m_old_wrap;
22  std::streambuf *m_old_buf;
23  std::string m_string;
24  bool m_copy;
25  HUD* m_hud;
26 };
Definition: streamredirect.h:10
Definition: hud.h:34