GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
oct-strstrm.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 "oct-strstrm.h"
31
32OCTAVE_NAMESPACE_BEGIN
33
34// Position a stream at OFFSET relative to ORIGIN.
35
36int
38{
39 // Note: error is inherited from base_stream, not ::error.
40 // This error function does not halt execution so "return ..." must exist.
41 error ("fseek: invalid operation");
42 return -1;
43}
44
45// Return current stream position.
46
47off_t
49{
50 // Note: error is inherited from base_stream, not ::error.
51 // This error function does not halt execution so "return ..." must exist.
52 error ("ftell: invalid operation");
53 return -1;
54}
55
56stream
57istrstream::create (const char *data, std::ios::openmode arg_md,
59 const std::string& encoding)
60{
61 return stream (new istrstream (data, arg_md, flt_fmt, encoding));
62}
63
64stream
65istrstream::create (const std::string& data, std::ios::openmode arg_md,
67 const std::string& encoding)
68{
69 return stream (new istrstream (data, arg_md, flt_fmt, encoding));
70}
71
72stream
73ostrstream::create (std::ios::openmode arg_md,
75 const std::string& encoding)
76{
77 return stream (new ostrstream (arg_md, flt_fmt, encoding));
78}
79
80OCTAVE_NAMESPACE_END
int seek(off_t, int)
Definition: oct-strstrm.cc:37
virtual off_t tell(void)
Definition: oct-strstrm.cc:48
static stream create(const char *data, std::ios::openmode arg_md=std::ios::out, mach_info::float_format ff=mach_info::native_float_format(), const std::string &encoding="utf-8")
Definition: oct-strstrm.cc:57
static stream create(std::ios::openmode arg_md=std::ios::out, mach_info::float_format ff=mach_info::native_float_format(), const std::string &encoding="utf-8")
Definition: oct-strstrm.cc:73
void error(const char *fmt,...)
Definition: error.cc:980