Mercurial > octave-nkf
annotate libinterp/corefcn/procstream.h @ 20607:db3286201347 stable
doc: Add explanation of ':' optional input to numel().
* data.cc (Fnumel): Add explanation of ':' optional input.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 07 Oct 2015 14:52:01 -0700 |
parents | 1663b82bd009 |
children |
rev | line source |
---|---|
1 | 1 /* |
2 | |
19731
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
3 Copyright (C) 1993-2015 John W. Eaton |
1 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
1 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
1 | 20 |
21 */ | |
22 | |
383 | 23 #if !defined (octave_procstream_h) |
24 #define octave_procstream_h 1 | |
1 | 25 |
20123
1663b82bd009
Stop "implicit instantiation of undefined template" error (bug #44818).
Mike Miller <mtmiller@octave.org>
parents:
19731
diff
changeset
|
26 #include <istream> |
1663b82bd009
Stop "implicit instantiation of undefined template" error (bug #44818).
Mike Miller <mtmiller@octave.org>
parents:
19731
diff
changeset
|
27 #include <ostream> |
4051 | 28 #include <string> |
2095 | 29 |
30 #include <sys/types.h> | |
31 | |
32 #include "oct-procbuf.h" | |
1 | 33 |
34 class | |
6109 | 35 OCTINTERP_API |
3544 | 36 procstreambase : virtual public std::ios |
1 | 37 { |
1380 | 38 public: |
1965 | 39 |
11584
cda4aa780d58
Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
11523
diff
changeset
|
40 procstreambase (void) : pb () { pb_init (); } |
1965 | 41 |
4051 | 42 procstreambase (const std::string& name, int mode); |
43 | |
1965 | 44 procstreambase (const char *name, int mode); |
1380 | 45 |
1965 | 46 ~procstreambase (void) { close (); } |
1 | 47 |
4051 | 48 void open (const std::string& name, int mode) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
49 { open (name.c_str (), mode); } |
4051 | 50 |
1965 | 51 void open (const char *name, int mode); |
1380 | 52 |
1965 | 53 int is_open (void) const { return pb.is_open (); } |
1 | 54 |
483 | 55 int close (void); |
1380 | 56 |
6316 | 57 pid_t pid (void) const { return pb.pid (); } |
58 | |
59 int file_number (void) const { return pb.file_number (); } | |
2095 | 60 |
1380 | 61 private: |
1965 | 62 |
2095 | 63 octave_procbuf pb; |
1965 | 64 |
65 void pb_init (void) { init (&pb); } | |
66 | |
67 procstreambase (const procstreambase&); | |
68 | |
69 procstreambase& operator = (const procstreambase&); | |
1 | 70 }; |
71 | |
1965 | 72 class |
6109 | 73 OCTINTERP_API |
3775 | 74 iprocstream : public std::istream, public procstreambase |
75 // iprocstream : public procstreambase, public std::istream | |
1965 | 76 { |
77 public: | |
78 | |
3775 | 79 iprocstream (void) : std::istream (0), procstreambase () { } |
1965 | 80 |
4051 | 81 iprocstream (const std::string& name, int mode = std::ios::in) |
82 : std::istream (0), procstreambase (name, mode) { } | |
83 | |
3544 | 84 iprocstream (const char *name, int mode = std::ios::in) |
3775 | 85 : std::istream (0), procstreambase (name, mode) { } |
1965 | 86 |
87 ~iprocstream (void) { } | |
88 | |
4051 | 89 void open (const std::string& name, int mode = std::ios::in) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
90 { procstreambase::open (name, mode); } |
4051 | 91 |
3544 | 92 void open (const char *name, int mode = std::ios::in) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
93 { procstreambase::open (name, mode); } |
1965 | 94 |
95 private: | |
96 | |
97 iprocstream (const iprocstream&); | |
98 | |
99 iprocstream& operator = (const iprocstream&); | |
100 }; | |
1448 | 101 |
1 | 102 class |
6109 | 103 OCTINTERP_API |
3775 | 104 oprocstream : public std::ostream, public procstreambase |
105 // oprocstream : public procstreambase, public std::ostream | |
1 | 106 { |
1380 | 107 public: |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11584
diff
changeset
|
108 |
3775 | 109 oprocstream (void) : std::ostream (0), procstreambase () { } |
1 | 110 |
4051 | 111 oprocstream (const std::string& name, int mode = std::ios::out) |
14861
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
112 : std::ostream (0), procstreambase (name, mode) { } |
4051 | 113 |
3544 | 114 oprocstream (const char *name, int mode = std::ios::out) |
14861
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
115 : std::ostream (0), procstreambase (name, mode) { } |
1 | 116 |
1965 | 117 ~oprocstream (void) { } |
1380 | 118 |
4051 | 119 void open (const std::string& name, int mode = std::ios::out) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
120 { procstreambase::open (name, mode); } |
4051 | 121 |
3544 | 122 void open (const char *name, int mode = std::ios::out) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
123 { procstreambase::open (name, mode); } |
1380 | 124 |
125 private: | |
1965 | 126 |
127 oprocstream (const oprocstream&); | |
128 | |
129 oprocstream& operator = (const oprocstream&); | |
1 | 130 }; |
131 | |
1965 | 132 class |
6109 | 133 OCTINTERP_API |
3775 | 134 procstream : public std::iostream, public procstreambase |
135 // procstream : public procstreambase, public std::iostream | |
1965 | 136 { |
137 public: | |
138 | |
3775 | 139 procstream (void) : std::iostream (0), procstreambase () { } |
1965 | 140 |
4051 | 141 procstream (const std::string& name, int mode) |
142 : std::iostream (0), procstreambase (name, mode) { } | |
143 | |
1965 | 144 procstream (const char *name, int mode) |
3775 | 145 : std::iostream (0), procstreambase (name, mode) { } |
1965 | 146 |
147 ~procstream (void) { } | |
148 | |
4051 | 149 void open (const std::string& name, int mode) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
150 { procstreambase::open (name, mode); } |
4051 | 151 |
1965 | 152 void open (const char *name, int mode) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
153 { procstreambase::open (name, mode); } |
1965 | 154 |
155 private: | |
156 | |
157 procstream (const procstream&); | |
158 | |
159 procstream& operator = (const procstream&); | |
160 }; | |
1448 | 161 |
1 | 162 #endif |