1
|
1 // procstream.h -*- C++ -*- |
|
2 /* |
|
3 |
383
|
4 Copyright (C) 1992, 1993, 1994 John W. Eaton |
1
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
21 |
|
22 */ |
|
23 |
383
|
24 #if !defined (octave_procstream_h) |
|
25 #define octave_procstream_h 1 |
1
|
26 |
|
27 #include <iostream.h> |
|
28 #include <procbuf.h> |
|
29 |
|
30 class |
|
31 procstreambase : virtual public ios |
|
32 { |
|
33 public: |
|
34 procstreambase (void); |
|
35 procstreambase (const char *command, int mode = ios::out); |
|
36 |
|
37 procbuf *rdbuf (void) const { return (procbuf *) _strbuf; } |
|
38 |
|
39 void open (const char *command, int mode = ios::out); |
|
40 int is_open (void) { return rdbuf()->is_open (); } |
|
41 void close (void); |
|
42 }; |
|
43 |
|
44 class |
|
45 iprocstream : public procstreambase, public istream |
|
46 { |
|
47 public: |
|
48 iprocstream (void) : procstreambase () {} |
|
49 iprocstream (const char *command) : procstreambase (command, ios::in) {} |
|
50 |
|
51 void open (const char *command) { procstreambase::open (command, ios::in); } |
|
52 }; |
|
53 |
|
54 class |
|
55 oprocstream : public procstreambase, public ostream |
|
56 { |
|
57 public: |
|
58 oprocstream (void) : procstreambase () {} |
|
59 oprocstream (const char *command) : procstreambase (command, ios::out) {} |
|
60 |
|
61 void open (const char *command) { procstreambase::open (command, ios::out); } |
|
62 }; |
|
63 |
|
64 #endif |
|
65 |
|
66 /* |
|
67 ;;; Local Variables: *** |
|
68 ;;; mode: C++ *** |
|
69 ;;; page-delimiter: "^/\\*" *** |
|
70 ;;; End: *** |
|
71 */ |
|
72 |
|
73 |
|
74 |