GNU Octave  6.2.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-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 "oct-strstrm.h"
31 
32 // Position a stream at OFFSET relative to ORIGIN.
33 
34 int
36 {
37  // Note: error is inherited from octave::base_stream, not ::error.
38  // This error function does not halt execution so "return ..." must exist.
39  error ("fseek: invalid operation");
40  return -1;
41 }
42 
43 // Return current stream position.
44 
45 off_t
47 {
48  // Note: error is inherited from octave::base_stream, not ::error.
49  // This error function does not halt execution so "return ..." must exist.
50  error ("ftell: invalid operation");
51  return -1;
52 }
53 
55 octave_istrstream::create (const char *data, std::ios::openmode arg_md,
57  const std::string& encoding)
58 {
59  return octave::stream (new octave_istrstream (data, arg_md, flt_fmt,
60  encoding));
61 }
62 
64 octave_istrstream::create (const std::string& data, std::ios::openmode arg_md,
66  const std::string& encoding)
67 {
68  return octave::stream (new octave_istrstream (data, arg_md, flt_fmt,
69  encoding));
70 }
71 
73 octave_ostrstream::create (std::ios::openmode arg_md,
75  const std::string& encoding)
76 {
77  return octave::stream (new octave_ostrstream (arg_md, flt_fmt,
78  encoding));
79 }
std::string error(bool clear, int &err_num)
Definition: oct-stream.cc:6050
std::string encoding(void) const
Definition: oct-stream.h:159
int seek(off_t, int)
Definition: oct-strstrm.cc:35
virtual off_t tell(void)
Definition: oct-strstrm.cc:46
static octave::stream create(const char *data, std::ios::openmode arg_md=std::ios::out, octave::mach_info::float_format ff=octave::mach_info::native_float_format(), const std::string &encoding="utf-8")
Definition: oct-strstrm.cc:55
static octave::stream create(std::ios::openmode arg_md=std::ios::out, octave::mach_info::float_format ff=octave::mach_info::native_float_format(), const std::string &encoding="utf-8")
Definition: oct-strstrm.cc:73