annotate libinterp/corefcn/oct-strstrm.h @ 33625:d213a148b3f1 default tip @

ensure exp. terminal widget has focus at startup * main-window.cc (main_window): call focus_command_window only if event loop is idle by using a single shot timer * main-window.h: make focus_command_window a public slot
author Torsten Lilge <ttl-octave@mailbox.org>
date Sun, 26 May 2024 02:29:44 +0200
parents 4b601ca024d5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
32632
2e484f9f1f18 maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 31855
diff changeset
3 // Copyright (C) 1996-2024 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
25
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
26 #if ! defined (octave_oct_strstrm_h)
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17744
diff changeset
27 #define octave_oct_strstrm_h 1
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
28
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21017
diff changeset
29 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21017
diff changeset
30
2445
6577af9f7504 [project @ 1996-10-30 19:01:57 by jwe]
jwe
parents: 2317
diff changeset
31 #include <string>
5765
7ba9ad1fec11 [project @ 2006-04-17 05:05:15 by jwe]
jwe
parents: 5307
diff changeset
32 #include <sstream>
4051
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3775
diff changeset
33
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
34 #include "oct-stream.h"
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
35
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
36 OCTAVE_BEGIN_NAMESPACE(octave)
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
37
32628
ae4e19c0a2b1 maint: Place class name and class keyword on one line.
Rik <rik@octave.org>
parents: 31855
diff changeset
38 class base_strstream : public base_stream
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
39 {
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
40 public:
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
41
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
42 base_strstream (std::ios::openmode m = std::ios::out,
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
43 mach_info::float_format ff
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
44 = mach_info::native_float_format (),
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
45 const std::string& encoding = "utf-8")
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
46 : base_stream (m, ff, encoding) { }
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
47
31837
febd82d1a8de use new macros to consistently delete copy and move member functions
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
48 OCTAVE_DISABLE_COPY_MOVE (base_strstream)
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
49
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
50 protected:
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
51
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
52 ~base_strstream () = default;
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
53
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
54 public:
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
55
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
56 // Position a stream at OFFSET relative to ORIGIN.
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
57
16011
8122286c69a9 initial large file support for 32-bit systems
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
58 int seek (off_t, int);
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
59
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
60 // Return current stream position.
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
61
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
62 virtual off_t tell ();
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
63
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
64 // The name of the file.
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
65
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
66 std::string name () const { return ""; }
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
67
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
68 virtual std::streambuf * rdbuf () = 0;
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
69
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
70 virtual bool bad () const = 0;
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
71
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
72 virtual void clear () = 0;
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
73 };
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
74
32628
ae4e19c0a2b1 maint: Place class name and class keyword on one line.
Rik <rik@octave.org>
parents: 31855
diff changeset
75 class istrstream : public base_strstream
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
76 {
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
77 public:
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
78
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
79 istrstream (const char *data,
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
80 std::ios::openmode arg_md = std::ios::out,
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
81 mach_info::float_format ff = mach_info::native_float_format (),
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
82 const std::string& encoding = "utf-8")
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
83 : base_strstream (arg_md, ff, encoding), m_istream (data) { }
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
84
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
85 istrstream (const std::string& data,
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
86 std::ios::openmode arg_md = std::ios::out,
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
87 mach_info::float_format ff = mach_info::native_float_format (),
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
88 const std::string& encoding = "utf-8")
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
89 : base_strstream (arg_md, ff, encoding), m_istream (data) { }
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
90
31855
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31837
diff changeset
91 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (istrstream)
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
92
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
93 protected:
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
94
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
95 ~istrstream () = default;
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
96
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
97 public:
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
98
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
99
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
100 static stream
3538
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3523
diff changeset
101 create (const char *data, std::ios::openmode arg_md = std::ios::out,
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
102 mach_info::float_format ff = mach_info::native_float_format (),
26703
29ea2369971d Add basic backend for encodings in file streams (bug #55452).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26376
diff changeset
103 const std::string& encoding = "utf-8");
3340
585a8809fd9b [project @ 1999-11-05 07:02:30 by jwe]
jwe
parents: 2847
diff changeset
104
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
105 static stream
3538
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3523
diff changeset
106 create (const std::string& data, std::ios::openmode arg_md = std::ios::out,
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
107 mach_info::float_format ff = mach_info::native_float_format (),
26703
29ea2369971d Add basic backend for encodings in file streams (bug #55452).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26376
diff changeset
108 const std::string& encoding = "utf-8");
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
109
18812
9ac2357f19bc doc: Replace "non-zero" with "nonzero" to match existing usage.
Rik <rik@octave.org>
parents: 17822
diff changeset
110 // Return nonzero if EOF has been reached on this stream.
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
111
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
112 bool eof () const { return m_istream.eof (); }
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
113
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
114 std::istream * input_stream () { return &m_istream; }
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
115
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
116 std::ostream * output_stream () { return nullptr; }
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
117
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
118 off_t tell () { return m_istream.tellg (); }
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
119
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
120 std::streambuf * rdbuf ()
27172
b0abae0bd94b style fixes
John W. Eaton <jwe@octave.org>
parents: 26703
diff changeset
121 {
b0abae0bd94b style fixes
John W. Eaton <jwe@octave.org>
parents: 26703
diff changeset
122 return m_istream ? m_istream.rdbuf () : nullptr;
b0abae0bd94b style fixes
John W. Eaton <jwe@octave.org>
parents: 26703
diff changeset
123 }
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
124
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
125 bool bad () const { return m_istream.bad (); }
27172
b0abae0bd94b style fixes
John W. Eaton <jwe@octave.org>
parents: 26703
diff changeset
126
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
127 void clear () { m_istream.clear (); }
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
128
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
129 private:
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
130
27172
b0abae0bd94b style fixes
John W. Eaton <jwe@octave.org>
parents: 26703
diff changeset
131 std::istringstream m_istream;
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
132 };
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
133
32628
ae4e19c0a2b1 maint: Place class name and class keyword on one line.
Rik <rik@octave.org>
parents: 31855
diff changeset
134 class ostrstream : public base_strstream
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
135 {
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
136 public:
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
137
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
138 ostrstream (std::ios::openmode arg_md = std::ios::out,
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
139 mach_info::float_format ff = mach_info::native_float_format (),
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
140 const std::string& encoding = "utf-8")
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
141 : base_strstream (arg_md, ff, encoding), m_ostream () { }
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
142
31837
febd82d1a8de use new macros to consistently delete copy and move member functions
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
143 OCTAVE_DISABLE_COPY_MOVE (ostrstream)
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
144
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
145 protected:
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
146
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
147 ~ostrstream () = default;
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
148
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
149 public:
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
150
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
151 static stream
3538
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3523
diff changeset
152 create (std::ios::openmode arg_md = std::ios::out,
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
153 mach_info::float_format ff = mach_info::native_float_format (),
26703
29ea2369971d Add basic backend for encodings in file streams (bug #55452).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26376
diff changeset
154 const std::string& encoding = "utf-8");
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
155
18812
9ac2357f19bc doc: Replace "non-zero" with "nonzero" to match existing usage.
Rik <rik@octave.org>
parents: 17822
diff changeset
156 // Return nonzero if EOF has been reached on this stream.
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
157
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
158 bool eof () const { return m_ostream.eof (); }
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
159
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
160 std::istream * input_stream () { return nullptr; }
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
161
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
162 std::ostream * output_stream () { return &m_ostream; }
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
163
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
164 std::string str () { return m_ostream.str (); }
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
165
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
166 std::streambuf * rdbuf ()
27172
b0abae0bd94b style fixes
John W. Eaton <jwe@octave.org>
parents: 26703
diff changeset
167 {
b0abae0bd94b style fixes
John W. Eaton <jwe@octave.org>
parents: 26703
diff changeset
168 return m_ostream ? m_ostream.rdbuf () : nullptr;
b0abae0bd94b style fixes
John W. Eaton <jwe@octave.org>
parents: 26703
diff changeset
169 }
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
170
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
171 bool bad () const { return m_ostream.bad (); }
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
172
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
173 void clear () { m_ostream.clear (); }
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
174
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
175 private:
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
176
27172
b0abae0bd94b style fixes
John W. Eaton <jwe@octave.org>
parents: 26703
diff changeset
177 std::ostringstream m_ostream;
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
178 };
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
179
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
180 OCTAVE_END_NAMESPACE(octave)
29991
3988112c7116 move i/o stream classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
181
2081
e9ec222a53e1 [project @ 1996-04-25 03:17:36 by jwe]
jwe
parents:
diff changeset
182 #endif