/home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/external/stlplus/include/stlplus/multiio.hpp Source File

Ratpac-two: /home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/external/stlplus/include/stlplus/multiio.hpp Source File
Ratpac-two
multiio.hpp
1 #ifndef MULTIIO_HPP
2 #define MULTIIO_HPP
3 /*------------------------------------------------------------------------------
4 
5  Author: Andy Rushton
6  Copyright: (c) Andy Rushton, 2004
7  License: BSD License, see ../docs/license.html
8 
9  Classes for redirecting I/O to/from multiple devices
10 
11  ------------------------------------------------------------------------------*/
12 #include "os_fixes.hpp"
13 #include "textio.hpp"
14 
16 // Output
17 
18 class omtext : public otext {
19  public:
20  omtext(void);
21  omtext(const otext&);
22  omtext(const otext&, const otext&);
23  void open(const otext&);
24  void open(const otext&, const otext&);
25  unsigned add(const otext&);
26  void remove(unsigned);
27 
28  unsigned device_count(void) const;
29  otext& device_get(unsigned);
30  const otext& device_get(unsigned) const;
31 };
32 
34 // Input
35 
36 class imtext : public itext {
37  public:
38  imtext(void);
39  imtext(const itext&);
40  imtext(const itext&, const itext&);
41  void open(const itext&);
42  void open(const itext&, const itext&);
43  unsigned add(const itext&);
44  void remove(unsigned);
45 
46  unsigned device_count(void) const;
47  itext& device_get(unsigned);
48  const itext& device_get(unsigned) const;
49 };
50 
52 // Internals
53 
54 class ombuff : public obuff {
55  friend class omtext;
56 
57  public:
58  ombuff(void);
59  unsigned add(const otext&);
60  void remove(unsigned);
61 
62  virtual unsigned put(unsigned char);
63 
64  unsigned count(void) const;
65  otext& device(unsigned);
66  const otext& device(unsigned) const;
67 
68  private:
69  std::vector<otext> m_devices;
70 
71  // make this class uncopyable
72  ombuff(const ombuff&);
73  ombuff& operator=(const ombuff&);
74 };
75 
76 class imbuff : public ibuff {
77  friend class imtext;
78 
79  public:
80  imbuff(void);
81  unsigned add(const itext&);
82  void remove(unsigned);
83 
84  virtual int peek(void);
85  virtual int get(void);
86 
87  unsigned count(void) const;
88  itext& device(unsigned);
89  const itext& device(unsigned) const;
90 
91  private:
92  std::vector<itext> m_devices;
93 
94  // make this class uncopyable
95  imbuff(const imbuff&);
96  imbuff& operator=(const imbuff&);
97 };
98 
100 
101 #endif
Definition: textio.hpp:502
Definition: multiio.hpp:76
Definition: multiio.hpp:36
Definition: textio.hpp:242
Definition: textio.hpp:399
Definition: multiio.hpp:54
Definition: multiio.hpp:18
Definition: textio.hpp:37