GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
oct-fstrm.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1996-2023 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 (octave_oct_fstrm_h)
27 #define octave_oct_fstrm_h 1
28 
29 #include "octave-config.h"
30 
31 #include <fstream>
32 #include <string>
33 
34 #include "oct-stream.h"
35 
37 
38 class
39 fstream : public base_stream
40 {
41 public:
42 
43  fstream (const std::string& nm_arg,
44  std::ios::openmode arg_md = std::ios::in | std::ios::out,
46 
47  // No copying!
48 
49  fstream (const fstream&) = delete;
50 
51  fstream& operator = (const fstream&) = delete;
52 
53  static stream
54  create (const std::string& nm_arg,
55  std::ios::openmode arg_md = std::ios::in | std::ios::out,
57 
58  // Position a stream at OFFSET relative to ORIGIN.
59 
60  int seek (off_t offset, int origin);
61 
62  // Return current stream position.
63 
64  off_t tell (void);
65 
66  // Return nonzero if EOF has been reached on this stream.
67 
68  bool eof (void) const;
69 
70  void do_close (void);
71 
72  // The name of the file.
73 
74  std::string name (void) const { return m_name; }
75 
76  std::istream * input_stream (void);
77 
78  std::ostream * output_stream (void);
79 
80 protected:
81 
82  ~fstream (void) = default;
83 
84 private:
85 
86  std::string m_name;
87 
89 };
90 
92 
93 #if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
94 
95 OCTAVE_DEPRECATED (7, "use 'octave::fstream' instead")
96 typedef octave::fstream octave_fstream;
97 
98 #endif
99 
100 #endif
OCTAVE_END_NAMESPACE(octave)
fstream(const fstream &)=delete
std::fstream m_fstream
Definition: oct-fstrm.h:88
~fstream(void)=default
std::string m_name
Definition: oct-fstrm.h:86
std::string name(void) const
Definition: oct-fstrm.h:74
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
std::fstream fstream(const std::string &filename, const std::ios::openmode mode)
Definition: lo-sysdep.cc:410
float_format native_float_format(void)
Definition: mach-info.cc:65
float_format
Definition: mach-info.h:38