GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
octave::base_stream Class Referenceabstract

#include "oct-stream.h"

Collaboration diagram for octave::base_stream:

Public Member Functions

 base_stream (const base_stream &)=delete
 
 base_stream (std::ios::openmode arg_md=std::ios::in|std::ios::out, mach_info::float_format ff=mach_info::native_float_format(), const std::string &encoding="utf-8")
 
virtual ~base_stream (void)=default
 
void close (void)
 
virtual void do_close (void)
 
virtual bool eof (void) const =0
 
std::string error (bool clear, int &err_num)
 
virtual int file_number (void) const
 
virtual std::istream * input_stream (void)
 
bool is_open (void) const
 
virtual std::string name (void) const =0
 
bool ok (void) const
 
base_streamoperator= (const base_stream &)=delete
 
virtual std::ostream * output_stream (void)
 
virtual int seek (off_t offset, int origin)=0
 
virtual off_t tell (void)=0
 

Protected Member Functions

OCTINTERP_API void clear (void)
 
OCTINTERP_API void clearerr (void)
 
std::string encoding (void) const
 
OCTINTERP_API void error (const std::string &msg)
 
OCTINTERP_API void error (const std::string &who, const std::string &msg)
 
mach_info::float_format float_format (void) const
 
int mode (void) const
 

Private Member Functions

OCTINTERP_API std::string do_gets (octave_idx_type max_len, bool &err, bool strip_newline, const std::string &who)
 
OCTINTERP_API int do_numeric_printf_conv (std::ostream &os, const printf_format_elt *elt, int nsa, int sa_1, int sa_2, const octave_value &val, const std::string &who)
 
OCTINTERP_API bool do_oscanf (const scanf_format_elt *elt, octave_value &, const std::string &who)
 
OCTINTERP_API int do_printf (printf_format_list &fmt_list, const octave_value_list &args, const std::string &who)
 
OCTINTERP_API octave_value do_scanf (scanf_format_list &fmt_list, octave_idx_type nr, octave_idx_type nc, bool one_elt_size_spec, octave_idx_type &count, const std::string &who)
 
OCTINTERP_API octave_value do_textscan (const std::string &fmt, octave_idx_type ntimes, const octave_value_list &options, const std::string &who, octave_idx_type &count)
 
OCTINTERP_API void field_width_error (const std::string &who) const
 
OCTINTERP_API int flush (void)
 
OCTINTERP_API std::string getl (octave_idx_type max_len, bool &err, const std::string &who)
 
OCTINTERP_API std::string gets (octave_idx_type max_len, bool &err, const std::string &who)
 
OCTINTERP_API void invalid_operation (const std::string &who, const char *rw)
 
OCTINTERP_API octave_value_list oscanf (const std::string &fmt, const std::string &who)
 
OCTINTERP_API int printf (const std::string &fmt, const octave_value_list &args, const std::string &who)
 
OCTINTERP_API int puts (const std::string &s, const std::string &who)
 
OCTINTERP_API octave_value scanf (const std::string &fmt, const Array< double > &size, octave_idx_type &count, const std::string &who)
 
OCTINTERP_API off_t skipl (off_t count, bool &err, const std::string &who)
 

Private Attributes

std::string m_encoding
 
std::string m_errmsg
 
bool m_fail
 
mach_info::float_format m_flt_fmt
 
int m_mode
 
bool m_open_state
 

Friends

class stream
 

Detailed Description

Definition at line 64 of file oct-stream.h.

Constructor & Destructor Documentation

◆ base_stream() [1/2]

octave::base_stream::base_stream ( std::ios::openmode  arg_md = std::ios::in | std::ios::out,
mach_info::float_format  ff = mach_info::native_float_format (),
const std::string &  encoding = "utf-8" 
)
inline

Definition at line 72 of file oct-stream.h.

◆ base_stream() [2/2]

octave::base_stream::base_stream ( const base_stream )
delete

◆ ~base_stream()

virtual octave::base_stream::~base_stream ( void  )
virtualdefault

Member Function Documentation

◆ clear()

void base_stream::clear ( void  )
protected

Definition at line 4035 of file oct-stream.cc.

References m_errmsg, and m_fail.

Referenced by error().

◆ clearerr()

void base_stream::clearerr ( void  )
protected

Definition at line 4042 of file oct-stream.cc.

References input_stream(), and output_stream().

◆ close()

void octave::base_stream::close ( void  )
inline

Definition at line 124 of file oct-stream.h.

◆ do_close()

virtual void octave::base_stream::do_close ( void  )
inlinevirtual

Definition at line 122 of file oct-stream.h.

◆ do_gets()

std::string base_stream::do_gets ( octave_idx_type  max_len,
bool err,
bool  strip_newline,
const std::string &  who 
)
private

◆ do_numeric_printf_conv()

◆ do_oscanf()

◆ do_printf()

◆ do_scanf()

◆ do_textscan()

octave_value base_stream::do_textscan ( const std::string &  fmt,
octave_idx_type  ntimes,
const octave_value_list options,
const std::string &  who,
octave_idx_type count 
)
private

◆ encoding()

std::string octave::base_stream::encoding ( void  ) const
inlineprotected

Definition at line 159 of file oct-stream.h.

Referenced by do_gets(), do_numeric_printf_conv(), do_printf(), and do_textscan().

◆ eof()

virtual bool octave::base_stream::eof ( void  ) const
pure virtual

◆ error() [1/3]

std::string base_stream::error ( bool  clear,
int err_num 
)

◆ error() [2/3]

void base_stream::error ( const std::string &  msg)
protected

Definition at line 4021 of file oct-stream.cc.

References m_errmsg, and m_fail.

◆ error() [3/3]

void base_stream::error ( const std::string &  who,
const std::string &  msg 
)
protected

Definition at line 4028 of file oct-stream.cc.

References m_errmsg, and m_fail.

◆ field_width_error()

void base_stream::field_width_error ( const std::string &  who) const
private

Definition at line 5891 of file oct-stream.cc.

References error().

Referenced by do_printf().

◆ file_number()

virtual int octave::base_stream::file_number ( void  ) const
inlinevirtual

Definition at line 133 of file oct-stream.h.

References name.

Referenced by do_gets(), do_scanf(), do_textscan(), and skipl().

◆ float_format()

mach_info::float_format octave::base_stream::float_format ( void  ) const
inlineprotected

Definition at line 157 of file oct-stream.h.

◆ flush()

int base_stream::flush ( void  )
private

Definition at line 5421 of file oct-stream.cc.

References invalid_operation(), and output_stream().

◆ getl()

std::string base_stream::getl ( octave_idx_type  max_len,
bool err,
const std::string &  who 
)
private

Definition at line 4162 of file oct-stream.cc.

References do_gets().

◆ gets()

std::string base_stream::gets ( octave_idx_type  max_len,
bool err,
const std::string &  who 
)
private

Definition at line 4169 of file oct-stream.cc.

References do_gets().

◆ input_stream()

virtual std::istream * octave::base_stream::input_stream ( void  )
inlinevirtual

Definition at line 110 of file oct-stream.h.

Referenced by clearerr(), do_gets(), do_oscanf(), do_scanf(), do_textscan(), oscanf(), scanf(), and skipl().

◆ invalid_operation()

void base_stream::invalid_operation ( const std::string &  who,
const char *  rw 
)
private

Definition at line 6090 of file oct-stream.cc.

References error().

Referenced by do_gets(), do_printf(), do_textscan(), flush(), oscanf(), puts(), scanf(), and skipl().

◆ is_open()

bool octave::base_stream::is_open ( void  ) const
inline

Definition at line 120 of file oct-stream.h.

◆ mode()

int octave::base_stream::mode ( void  ) const
inlineprotected

Definition at line 155 of file oct-stream.h.

◆ name()

virtual std::string octave::base_stream::name ( void  ) const
pure virtual

Referenced by do_oscanf(), and do_scanf().

◆ ok()

bool octave::base_stream::ok ( void  ) const
inline

Definition at line 147 of file oct-stream.h.

Referenced by do_oscanf(), do_scanf(), and oscanf().

◆ operator=()

base_stream & octave::base_stream::operator= ( const base_stream )
delete

◆ oscanf()

◆ output_stream()

virtual std::ostream * octave::base_stream::output_stream ( void  )
inlinevirtual

Definition at line 116 of file oct-stream.h.

Referenced by clearerr(), do_printf(), flush(), and puts().

◆ printf()

int base_stream::printf ( const std::string &  fmt,
const octave_value_list args,
const std::string &  who 
)
private

◆ puts()

int base_stream::puts ( const std::string &  s,
const std::string &  who 
)
private

Definition at line 6038 of file oct-stream.cc.

References error(), invalid_operation(), and output_stream().

◆ scanf()

octave_value base_stream::scanf ( const std::string &  fmt,
const Array< double > &  size,
octave_idx_type count,
const std::string &  who 
)
private

◆ seek()

virtual int octave::base_stream::seek ( off_t  offset,
int  origin 
)
pure virtual

◆ skipl()

off_t base_stream::skipl ( off_t  count,
bool err,
const std::string &  who 
)
private

◆ tell()

virtual off_t octave::base_stream::tell ( void  )
pure virtual

Friends And Related Function Documentation

◆ stream

friend class stream
friend

Definition at line 68 of file oct-stream.h.

Member Data Documentation

◆ m_encoding

std::string octave::base_stream::m_encoding
private

Definition at line 184 of file oct-stream.h.

◆ m_errmsg

std::string octave::base_stream::m_errmsg
private

Definition at line 193 of file oct-stream.h.

Referenced by clear(), and error().

◆ m_fail

bool octave::base_stream::m_fail
private

Definition at line 187 of file oct-stream.h.

Referenced by clear(), and error().

◆ m_flt_fmt

mach_info::float_format octave::base_stream::m_flt_fmt
private

Definition at line 181 of file oct-stream.h.

◆ m_mode

int octave::base_stream::m_mode
private

Definition at line 178 of file oct-stream.h.

◆ m_open_state

bool octave::base_stream::m_open_state
private

Definition at line 190 of file oct-stream.h.


The documentation for this class was generated from the following files: