GNU Octave 7.1.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-2022 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
36OCTAVE_NAMESPACE_BEGIN
37
38// Position a stream at OFFSET relative to ORIGIN.
39
40int
42{
44 return -1;
45}
46
47// Return current stream position.
48
49off_t
51{
53 return -1;
54}
55
56// Return nonzero if EOF has been reached on this stream.
57
58bool
60{
62 return false;
63}
64
65void
67{
68 // Note: use ::error to get error from error.h which halts operation.
69 ::error ("%s: invalid operation", stream_type ());
70}
71
72// Return nonzero if EOF has been reached on this stream.
73
74bool
75istream::eof (void) const
76{
77 return m_istream && m_istream->eof ();
78}
79
81istream::create (std::istream *arg, const std::string& n)
82{
83 return octave::stream (new istream (arg, n));
84}
85
86// Return nonzero if EOF has been reached on this stream.
87
88bool
89ostream::eof (void) const
90{
91 return m_ostream && m_ostream->eof ();
92}
93
95ostream::create (std::ostream *arg, const std::string& n)
96{
97 return octave::stream (new ostream (arg, n));
98}
99
100OCTAVE_NAMESPACE_END
off_t tell(void)
Definition: oct-iostrm.cc:50
virtual const char * stream_type(void) const =0
bool eof(void) const
Definition: oct-iostrm.cc:59
void invalid_operation(void) const
Definition: oct-iostrm.cc:66
int seek(off_t offset, int origin)
Definition: oct-iostrm.cc:41
bool eof(void) const
Definition: oct-iostrm.cc:75
std::istream * m_istream
Definition: oct-iostrm.h:113
static stream create(std::istream *arg=nullptr, const std::string &n="")
Definition: oct-iostrm.cc:81
static stream create(std::ostream *arg, const std::string &n="")
Definition: oct-iostrm.cc:95
bool eof(void) const
Definition: oct-iostrm.cc:89
std::ostream * m_ostream
Definition: oct-iostrm.h:151
void error(const char *fmt,...)
Definition: error.cc:980