comparison src/oct-stdstrm.h @ 3523:b80bbb43a1a9

[project @ 2000-02-02 10:25:52 by jwe]
author jwe
date Wed, 02 Feb 2000 10:26:25 +0000
parents 585a8809fd9b
children 71bd2d124119
comparison
equal deleted inserted replaced
3522:bd422cf62f0c 3523:b80bbb43a1a9
30 class 30 class
31 octave_base_stdiostream : public octave_base_stream 31 octave_base_stdiostream : public octave_base_stream
32 { 32 {
33 public: 33 public:
34 34
35 octave_base_stdiostream (const string& n, FILE *f, 35 octave_base_stdiostream (const std::string& n, FILE *f,
36 ios::openmode arg_md = ios::in|ios::out, 36 ios::openmode arg_md = ios::in|ios::out,
37 oct_mach_info::float_format flt_fmt = 37 oct_mach_info::float_format flt_fmt =
38 oct_mach_info::native) 38 oct_mach_info::native)
39 : octave_base_stream (arg_md, flt_fmt), nm (n), fp (f) { } 39 : octave_base_stream (arg_md, flt_fmt), nm (n), fp (f) { }
40 40
46 46
47 long tell (void) const; 47 long tell (void) const;
48 48
49 // The name of the file. 49 // The name of the file.
50 50
51 string name (void) const { return nm; } 51 std::string name (void) const { return nm; }
52 52
53 virtual stdiobuf *rdbuf (void) const = 0; 53 virtual stdiobuf *rdbuf (void) const = 0;
54 54
55 virtual bool bad (void) const = 0; 55 virtual bool bad (void) const = 0;
56 56
57 virtual void clear (void) = 0; 57 virtual void clear (void) = 0;
58 58
59 protected: 59 protected:
60 60
61 string nm; 61 std::string nm;
62 62
63 FILE *fp; 63 FILE *fp;
64 64
65 ~octave_base_stdiostream (void); 65 ~octave_base_stdiostream (void);
66 66
74 class 74 class
75 octave_istdiostream : public octave_base_stdiostream 75 octave_istdiostream : public octave_base_stdiostream
76 { 76 {
77 public: 77 public:
78 78
79 octave_istdiostream (const string& n, FILE *f = 0, 79 octave_istdiostream (const std::string& n, FILE *f = 0,
80 ios::openmode arg_md = ios::in, 80 ios::openmode arg_md = ios::in,
81 oct_mach_info::float_format flt_fmt = 81 oct_mach_info::float_format flt_fmt =
82 oct_mach_info::native); 82 oct_mach_info::native);
83 83
84 static octave_stream 84 static octave_stream
85 create (const string& n, FILE *f = 0, ios::openmode arg_md = ios::in, 85 create (const std::string& n, FILE *f = 0, ios::openmode arg_md = ios::in,
86 oct_mach_info::float_format flt_fmt = oct_mach_info::native); 86 oct_mach_info::float_format flt_fmt = oct_mach_info::native);
87 87
88 // Return non-zero if EOF has been reached on this stream. 88 // Return non-zero if EOF has been reached on this stream.
89 89
90 bool eof (void) const { return is ? is->eof () : true; } 90 bool eof (void) const { return is ? is->eof () : true; }
91 91
92 istream *input_stream (void) { return is; } 92 std::istream *input_stream (void) { return is; }
93 93
94 ostream *output_stream (void) { return 0; } 94 std::ostream *output_stream (void) { return 0; }
95 95
96 // XXX FIXME XXX -- should not have to cast away const here. 96 // XXX FIXME XXX -- should not have to cast away const here.
97 stdiobuf *rdbuf (void) const 97 stdiobuf *rdbuf (void) const
98 { return is ? (const_cast<istdiostream *> (is))->rdbuf () : 0; } 98 { return is ? (const_cast<std::istdiostream *> (is))->rdbuf () : 0; }
99 99
100 bool bad (void) const { return is ? is->bad () : true; } 100 bool bad (void) const { return is ? is->bad () : true; }
101 101
102 void clear (void) 102 void clear (void)
103 { 103 {
105 is->clear (); 105 is->clear ();
106 } 106 }
107 107
108 protected: 108 protected:
109 109
110 istdiostream *is; 110 std::istdiostream *is;
111 111
112 ~octave_istdiostream (void); 112 ~octave_istdiostream (void);
113 113
114 private: 114 private:
115 115
123 class 123 class
124 octave_ostdiostream : public octave_base_stdiostream 124 octave_ostdiostream : public octave_base_stdiostream
125 { 125 {
126 public: 126 public:
127 127
128 octave_ostdiostream (const string& n, FILE *f = 0, 128 octave_ostdiostream (const std::string& n, FILE *f = 0,
129 ios::openmode arg_md = ios::out, 129 ios::openmode arg_md = ios::out,
130 oct_mach_info::float_format flt_fmt = 130 oct_mach_info::float_format flt_fmt =
131 oct_mach_info::native); 131 oct_mach_info::native);
132 132
133 static octave_stream 133 static octave_stream
134 create (const string& n, FILE *f = 0, ios::openmode arg_md = ios::out, 134 create (const std::string& n, FILE *f = 0, ios::openmode arg_md = ios::out,
135 oct_mach_info::float_format flt_fmt = oct_mach_info::native); 135 oct_mach_info::float_format flt_fmt = oct_mach_info::native);
136 136
137 // Return non-zero if EOF has been reached on this stream. 137 // Return non-zero if EOF has been reached on this stream.
138 138
139 bool eof (void) const { return os ? os->eof () : true; } 139 bool eof (void) const { return os ? os->eof () : true; }
140 140
141 istream *input_stream (void) { return 0; } 141 std::istream *input_stream (void) { return 0; }
142 142
143 ostream *output_stream (void) { return os; } 143 std::ostream *output_stream (void) { return os; }
144 144
145 // XXX FIXME XXX -- should not have to cast away const here. 145 // XXX FIXME XXX -- should not have to cast away const here.
146 stdiobuf *rdbuf (void) const 146 stdiobuf *rdbuf (void) const
147 { return os ? (const_cast<ostdiostream *> (os))->rdbuf () : 0; } 147 { return os ? (const_cast<std::ostdiostream *> (os))->rdbuf () : 0; }
148 148
149 bool bad (void) const { return os ? os->bad () : true; } 149 bool bad (void) const { return os ? os->bad () : true; }
150 150
151 void clear (void) 151 void clear (void)
152 { 152 {
154 os->clear (); 154 os->clear ();
155 } 155 }
156 156
157 protected: 157 protected:
158 158
159 ostdiostream *os; 159 std::ostdiostream *os;
160 160
161 ~octave_ostdiostream (void); 161 ~octave_ostdiostream (void);
162 162
163 private: 163 private:
164 164