annotate src/procstream.h @ 11586:12df7854fa7c

strip trailing whitespace from source files
author John W. Eaton <jwe@octave.org>
date Thu, 20 Jan 2011 17:24:59 -0500
parents cda4aa780d58
children 72c96de7a403
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
1 /*
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
2
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10182
diff changeset
3 Copyright (C) 1993-2011 John W. Eaton
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
4
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
6
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6316
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6316
diff changeset
10 option) any later version.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
11
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
15 for more details.
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
16
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6316
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6316
diff changeset
19 <http://www.gnu.org/licenses/>.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
20
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
21 */
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
22
383
0b52c68ec81f [project @ 1994-03-09 21:19:44 by jwe]
jwe
parents: 240
diff changeset
23 #if !defined (octave_procstream_h)
0b52c68ec81f [project @ 1994-03-09 21:19:44 by jwe]
jwe
parents: 240
diff changeset
24 #define octave_procstream_h 1
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
25
8950
d865363208d6 include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
26 #include <iosfwd>
4051
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
27 #include <string>
2095
36903d507b0e [project @ 1996-04-28 09:00:07 by jwe]
jwe
parents: 1996
diff changeset
28
36903d507b0e [project @ 1996-04-28 09:00:07 by jwe]
jwe
parents: 1996
diff changeset
29 #include <sys/types.h>
36903d507b0e [project @ 1996-04-28 09:00:07 by jwe]
jwe
parents: 1996
diff changeset
30
36903d507b0e [project @ 1996-04-28 09:00:07 by jwe]
jwe
parents: 1996
diff changeset
31 #include "oct-procbuf.h"
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
32
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
33 class
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5307
diff changeset
34 OCTINTERP_API
3544
71bd2d124119 [project @ 2000-02-02 21:02:31 by jwe]
jwe
parents: 3537
diff changeset
35 procstreambase : virtual public std::ios
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
36 {
1380
79f80c6229be [project @ 1995-09-12 07:03:33 by jwe]
jwe
parents: 1315
diff changeset
37 public:
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
38
11584
cda4aa780d58 Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11523
diff changeset
39 procstreambase (void) : pb () { pb_init (); }
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
40
4051
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
41 procstreambase (const std::string& name, int mode);
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
42
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
43 procstreambase (const char *name, int mode);
1380
79f80c6229be [project @ 1995-09-12 07:03:33 by jwe]
jwe
parents: 1315
diff changeset
44
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
45 ~procstreambase (void) { close (); }
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
46
4051
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
47 void open (const std::string& name, int mode)
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
48 { open (name.c_str (), mode); }
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
49
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
50 void open (const char *name, int mode);
1380
79f80c6229be [project @ 1995-09-12 07:03:33 by jwe]
jwe
parents: 1315
diff changeset
51
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
52 int is_open (void) const { return pb.is_open (); }
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
53
483
41a70d08c1f7 [project @ 1994-06-30 18:30:21 by jwe]
jwe
parents: 453
diff changeset
54 int close (void);
1380
79f80c6229be [project @ 1995-09-12 07:03:33 by jwe]
jwe
parents: 1315
diff changeset
55
6316
a3a2580435c2 [project @ 2007-02-16 07:23:49 by jwe]
jwe
parents: 6109
diff changeset
56 pid_t pid (void) const { return pb.pid (); }
a3a2580435c2 [project @ 2007-02-16 07:23:49 by jwe]
jwe
parents: 6109
diff changeset
57
a3a2580435c2 [project @ 2007-02-16 07:23:49 by jwe]
jwe
parents: 6109
diff changeset
58 int file_number (void) const { return pb.file_number (); }
2095
36903d507b0e [project @ 1996-04-28 09:00:07 by jwe]
jwe
parents: 1996
diff changeset
59
1380
79f80c6229be [project @ 1995-09-12 07:03:33 by jwe]
jwe
parents: 1315
diff changeset
60 private:
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
61
2095
36903d507b0e [project @ 1996-04-28 09:00:07 by jwe]
jwe
parents: 1996
diff changeset
62 octave_procbuf pb;
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
63
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
64 void pb_init (void) { init (&pb); }
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
65
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
66 procstreambase (const procstreambase&);
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
67
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
68 procstreambase& operator = (const procstreambase&);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
69 };
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
70
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
71 class
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5307
diff changeset
72 OCTINTERP_API
3775
13905c3a24af [project @ 2001-02-06 01:56:59 by jwe]
jwe
parents: 3652
diff changeset
73 iprocstream : public std::istream, public procstreambase
13905c3a24af [project @ 2001-02-06 01:56:59 by jwe]
jwe
parents: 3652
diff changeset
74 // iprocstream : public procstreambase, public std::istream
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
75 {
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
76 public:
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
77
3775
13905c3a24af [project @ 2001-02-06 01:56:59 by jwe]
jwe
parents: 3652
diff changeset
78 iprocstream (void) : std::istream (0), procstreambase () { }
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
79
4051
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
80 iprocstream (const std::string& name, int mode = std::ios::in)
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
81 : std::istream (0), procstreambase (name, mode) { }
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
82
3544
71bd2d124119 [project @ 2000-02-02 21:02:31 by jwe]
jwe
parents: 3537
diff changeset
83 iprocstream (const char *name, int mode = std::ios::in)
3775
13905c3a24af [project @ 2001-02-06 01:56:59 by jwe]
jwe
parents: 3652
diff changeset
84 : std::istream (0), procstreambase (name, mode) { }
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
85
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
86 ~iprocstream (void) { }
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
87
4051
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
88 void open (const std::string& name, int mode = std::ios::in)
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
89 { procstreambase::open (name, mode); }
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
90
3544
71bd2d124119 [project @ 2000-02-02 21:02:31 by jwe]
jwe
parents: 3537
diff changeset
91 void open (const char *name, int mode = std::ios::in)
3189
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 2847
diff changeset
92 { procstreambase::open (name, mode); }
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
93
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
94 private:
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
95
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
96 iprocstream (const iprocstream&);
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
97
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
98 iprocstream& operator = (const iprocstream&);
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
99 };
1448
067f11a46742 [project @ 1995-09-20 03:41:58 by jwe]
jwe
parents: 1380
diff changeset
100
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
101 class
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5307
diff changeset
102 OCTINTERP_API
3775
13905c3a24af [project @ 2001-02-06 01:56:59 by jwe]
jwe
parents: 3652
diff changeset
103 oprocstream : public std::ostream, public procstreambase
13905c3a24af [project @ 2001-02-06 01:56:59 by jwe]
jwe
parents: 3652
diff changeset
104 // oprocstream : public procstreambase, public std::ostream
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
105 {
1380
79f80c6229be [project @ 1995-09-12 07:03:33 by jwe]
jwe
parents: 1315
diff changeset
106 public:
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11584
diff changeset
107
3775
13905c3a24af [project @ 2001-02-06 01:56:59 by jwe]
jwe
parents: 3652
diff changeset
108 oprocstream (void) : std::ostream (0), procstreambase () { }
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
109
4051
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
110 oprocstream (const std::string& name, int mode = std::ios::out)
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
111 : std::ostream (0), procstreambase(name, mode) { }
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
112
3544
71bd2d124119 [project @ 2000-02-02 21:02:31 by jwe]
jwe
parents: 3537
diff changeset
113 oprocstream (const char *name, int mode = std::ios::out)
3775
13905c3a24af [project @ 2001-02-06 01:56:59 by jwe]
jwe
parents: 3652
diff changeset
114 : std::ostream (0), procstreambase(name, mode) { }
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
115
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
116 ~oprocstream (void) { }
1380
79f80c6229be [project @ 1995-09-12 07:03:33 by jwe]
jwe
parents: 1315
diff changeset
117
4051
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
118 void open (const std::string& name, int mode = std::ios::out)
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
119 { procstreambase::open (name, mode); }
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
120
3544
71bd2d124119 [project @ 2000-02-02 21:02:31 by jwe]
jwe
parents: 3537
diff changeset
121 void open (const char *name, int mode = std::ios::out)
3652
25e84fcef38a [project @ 2000-03-31 08:50:48 by jwe]
jwe
parents: 3544
diff changeset
122 { procstreambase::open (name, mode); }
1380
79f80c6229be [project @ 1995-09-12 07:03:33 by jwe]
jwe
parents: 1315
diff changeset
123
79f80c6229be [project @ 1995-09-12 07:03:33 by jwe]
jwe
parents: 1315
diff changeset
124 private:
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
125
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
126 oprocstream (const oprocstream&);
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
127
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
128 oprocstream& operator = (const oprocstream&);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
129 };
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
130
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
131 class
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5307
diff changeset
132 OCTINTERP_API
3775
13905c3a24af [project @ 2001-02-06 01:56:59 by jwe]
jwe
parents: 3652
diff changeset
133 procstream : public std::iostream, public procstreambase
13905c3a24af [project @ 2001-02-06 01:56:59 by jwe]
jwe
parents: 3652
diff changeset
134 // procstream : public procstreambase, public std::iostream
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
135 {
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
136 public:
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
137
3775
13905c3a24af [project @ 2001-02-06 01:56:59 by jwe]
jwe
parents: 3652
diff changeset
138 procstream (void) : std::iostream (0), procstreambase () { }
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
139
4051
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
140 procstream (const std::string& name, int mode)
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
141 : std::iostream (0), procstreambase (name, mode) { }
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
142
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
143 procstream (const char *name, int mode)
3775
13905c3a24af [project @ 2001-02-06 01:56:59 by jwe]
jwe
parents: 3652
diff changeset
144 : std::iostream (0), procstreambase (name, mode) { }
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
145
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
146 ~procstream (void) { }
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
147
4051
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
148 void open (const std::string& name, int mode)
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
149 { procstreambase::open (name, mode); }
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
150
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
151 void open (const char *name, int mode)
3652
25e84fcef38a [project @ 2000-03-31 08:50:48 by jwe]
jwe
parents: 3544
diff changeset
152 { procstreambase::open (name, mode); }
1965
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
153
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
154 private:
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
155
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
156 procstream (const procstream&);
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
157
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
158 procstream& operator = (const procstream&);
01e3ed56c415 [project @ 1996-02-17 02:02:50 by jwe]
jwe
parents: 1884
diff changeset
159 };
1448
067f11a46742 [project @ 1995-09-20 03:41:58 by jwe]
jwe
parents: 1380
diff changeset
160
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
161 #endif