1
|
1 // procstream.h -*- C++ -*- |
|
2 /* |
|
3 |
1009
|
4 Copyright (C) 1992, 1993, 1994, 1995 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 |
1315
|
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1
|
21 |
|
22 */ |
|
23 |
383
|
24 #if !defined (octave_procstream_h) |
|
25 #define octave_procstream_h 1 |
1
|
26 |
1297
|
27 #if defined (__GNUG__) |
|
28 #pragma interface |
|
29 #endif |
|
30 |
1
|
31 #include <iostream.h> |
|
32 #include <procbuf.h> |
|
33 |
|
34 class |
|
35 procstreambase : virtual public ios |
|
36 { |
|
37 public: |
|
38 procstreambase (void); |
|
39 procstreambase (const char *command, int mode = ios::out); |
|
40 |
|
41 procbuf *rdbuf (void) const { return (procbuf *) _strbuf; } |
|
42 |
|
43 void open (const char *command, int mode = ios::out); |
|
44 int is_open (void) { return rdbuf()->is_open (); } |
483
|
45 int close (void); |
1
|
46 }; |
|
47 |
|
48 class |
|
49 iprocstream : public procstreambase, public istream |
|
50 { |
|
51 public: |
|
52 iprocstream (void) : procstreambase () {} |
|
53 iprocstream (const char *command) : procstreambase (command, ios::in) {} |
|
54 |
|
55 void open (const char *command) { procstreambase::open (command, ios::in); } |
|
56 }; |
|
57 |
|
58 class |
|
59 oprocstream : public procstreambase, public ostream |
|
60 { |
|
61 public: |
|
62 oprocstream (void) : procstreambase () {} |
|
63 oprocstream (const char *command) : procstreambase (command, ios::out) {} |
|
64 |
|
65 void open (const char *command) { procstreambase::open (command, ios::out); } |
|
66 }; |
|
67 |
|
68 #endif |
|
69 |
|
70 /* |
|
71 ;;; Local Variables: *** |
|
72 ;;; mode: C++ *** |
|
73 ;;; page-delimiter: "^/\\*" *** |
|
74 ;;; End: *** |
|
75 */ |
|
76 |
|
77 |
|
78 |