GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
oct-iostrm.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2018 John W. Eaton
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
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if defined (HAVE_CONFIG_H)
24 # include "config.h"
25 #endif
26 
27 #include <iostream>
28 
29 #include "error.h"
30 #include "oct-iostrm.h"
31 
32 // Position a stream at OFFSET relative to ORIGIN.
33 
34 int
36 {
38  return -1;
39 }
40 
41 // Return current stream position.
42 
43 off_t
45 {
47  return -1;
48 }
49 
50 // Return nonzero if EOF has been reached on this stream.
51 
52 bool
54 {
56  return false;
57 }
58 
59 void
61 {
62  // Note: use ::error to get error from error.h which halts operation.
63  ::error ("%s: invalid operation", stream_type ());
64 }
65 
66 // Return nonzero if EOF has been reached on this stream.
67 
68 bool
69 octave_istream::eof (void) const
70 {
71  return is && is->eof ();
72 }
73 
75 octave_istream::create (std::istream *arg, const std::string& n)
76 {
77  return octave::stream (new octave_istream (arg, n));
78 }
79 
80 // Return nonzero if EOF has been reached on this stream.
81 
82 bool
83 octave_ostream::eof (void) const
84 {
85  return os && os->eof ();
86 }
87 
89 octave_ostream::create (std::ostream *arg, const std::string& n)
90 {
91  return octave::stream (new octave_ostream (arg, n));
92 }
int seek(off_t offset, int origin)
Definition: oct-iostrm.cc:35
std::istream * is
Definition: oct-iostrm.h:110
bool eof(void) const
Definition: oct-iostrm.cc:83
bool eof(void) const
Definition: oct-iostrm.cc:69
octave_value arg
Definition: pr-output.cc:3244
std::string error(bool clear, int &err_num)
Definition: oct-stream.cc:5939
void invalid_operation(void) const
Definition: oct-iostrm.cc:60
static octave::stream create(std::istream *arg=nullptr, const std::string &n="")
Definition: oct-iostrm.cc:75
static octave::stream create(std::ostream *arg, const std::string &n="")
Definition: oct-iostrm.cc:89
bool eof(void) const
Definition: oct-iostrm.cc:53
virtual const char * stream_type(void) const =0
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:888
off_t tell(void)
Definition: oct-iostrm.cc:44
std::ostream * os
Definition: oct-iostrm.h:149