GNU Octave  6.2.0
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-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if defined (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include <istream>
31 #include <ostream>
32 
33 #include "error.h"
34 #include "oct-iostrm.h"
35 
36 // Position a stream at OFFSET relative to ORIGIN.
37 
38 int
40 {
42  return -1;
43 }
44 
45 // Return current stream position.
46 
47 off_t
49 {
51  return -1;
52 }
53 
54 // Return nonzero if EOF has been reached on this stream.
55 
56 bool
58 {
60  return false;
61 }
62 
63 void
65 {
66  // Note: use ::error to get error from error.h which halts operation.
67  ::error ("%s: invalid operation", stream_type ());
68 }
69 
70 // Return nonzero if EOF has been reached on this stream.
71 
72 bool
73 octave_istream::eof (void) const
74 {
75  return m_istream && m_istream->eof ();
76 }
77 
79 octave_istream::create (std::istream *arg, const std::string& n)
80 {
81  return octave::stream (new octave_istream (arg, n));
82 }
83 
84 // Return nonzero if EOF has been reached on this stream.
85 
86 bool
87 octave_ostream::eof (void) const
88 {
89  return m_ostream && m_ostream->eof ();
90 }
91 
93 octave_ostream::create (std::ostream *arg, const std::string& n)
94 {
95  return octave::stream (new octave_ostream (arg, n));
96 }
std::string error(bool clear, int &err_num)
Definition: oct-stream.cc:6050
off_t tell(void)
Definition: oct-iostrm.cc:48
void invalid_operation(void) const
Definition: oct-iostrm.cc:64
virtual const char * stream_type(void) const =0
int seek(off_t offset, int origin)
Definition: oct-iostrm.cc:39
bool eof(void) const
Definition: oct-iostrm.cc:57
std::istream * m_istream
Definition: oct-iostrm.h:113
static octave::stream create(std::istream *arg=nullptr, const std::string &n="")
Definition: oct-iostrm.cc:79
bool eof(void) const
Definition: oct-iostrm.cc:73
std::ostream * m_ostream
Definition: oct-iostrm.h:152
static octave::stream create(std::ostream *arg, const std::string &n="")
Definition: oct-iostrm.cc:93
bool eof(void) const
Definition: oct-iostrm.cc:87
octave_idx_type n
Definition: mx-inlines.cc:753