Async  1.5.0
AsyncPtyStreamBuf.h
Go to the documentation of this file.
1 
32 #ifndef ASYNC_PTY_STREAM_BUF_INCLUDED
33 #define ASYNC_PTY_STREAM_BUF_INCLUDED
34 
35 
36 /****************************************************************************
37  *
38  * System Includes
39  *
40  ****************************************************************************/
41 
42 #include <streambuf>
43 #include <vector>
44 
45 
46 /****************************************************************************
47  *
48  * Project Includes
49  *
50  ****************************************************************************/
51 
52 
53 
54 /****************************************************************************
55  *
56  * Local Includes
57  *
58  ****************************************************************************/
59 
60 
61 
62 /****************************************************************************
63  *
64  * Forward declarations
65  *
66  ****************************************************************************/
67 
68 
69 
70 /****************************************************************************
71  *
72  * Namespace
73  *
74  ****************************************************************************/
75 
76 namespace Async
77 {
78 
79 
80 /****************************************************************************
81  *
82  * Forward declarations of classes inside of the declared namespace
83  *
84  ****************************************************************************/
85 
86 class Pty;
87 
88 
89 /****************************************************************************
90  *
91  * Defines & typedefs
92  *
93  ****************************************************************************/
94 
95 
96 
97 /****************************************************************************
98  *
99  * Exported Global Variables
100  *
101  ****************************************************************************/
102 
103 
104 
105 /****************************************************************************
106  *
107  * Class definitions
108  *
109  ****************************************************************************/
110 
124 class PtyStreamBuf : public std::streambuf
125 {
126  public:
132  explicit PtyStreamBuf(Pty *pty, std::size_t buf_size=256);
133 
137  ~PtyStreamBuf(void);
138 
143  Pty *pty(void) const { return m_pty; }
144 
145  protected:
146 
147  private:
148  Pty * m_pty;
149  std::vector<char> m_buf;
150 
151  PtyStreamBuf(const PtyStreamBuf&);
152  PtyStreamBuf& operator=(const PtyStreamBuf&);
153 
154  virtual int_type overflow(int_type ch);
155  virtual int sync(void);
156  bool writeToPty(void);
157 
158 }; /* class PtyStreamBuf */
159 
160 
161 } /* namespace */
162 
163 #endif /* ASYNC_PTY_STREAM_BUF_INCLUDED */
164 
165 
166 
167 /*
168  * This file has not been truncated
169  */
PtyStreamBuf(Pty *pty, std::size_t buf_size=256)
Default constructor.
~PtyStreamBuf(void)
Destructor.
Pty * pty(void) const
Return the PTY this stream is attached to.
Namespace for the asynchronous programming classes.
A wrapper class for using a PTY.
Definition: AsyncPty.h:124
A stream buffer class to stream characters to a PTY.