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

#include "oct-stream.h"

Inheritance diagram for octave::base_stream:
Collaboration diagram for octave::base_stream:

Public Member Functions

 base_stream (std::ios::openmode arg_md=std::ios::in|std::ios::out, mach_info::float_format ff=mach_info::native_float_format())
 
 base_stream (const base_stream &)=delete
 
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

void clear (void)
 
void clearerr (void)
 
void error (const std::string &msg)
 
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

std::string do_gets (octave_idx_type max_len, bool &err, bool strip_newline, const std::string &who)
 
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)
 
bool do_oscanf (const scanf_format_elt *elt, octave_value &, const std::string &who)
 
int do_printf (printf_format_list &fmt_list, const octave_value_list &args, const std::string &who)
 
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)
 
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)
 
int flush (void)
 
std::string getl (octave_idx_type max_len, bool &err, const std::string &who)
 
std::string gets (octave_idx_type max_len, bool &err, const std::string &who)
 
void invalid_operation (const std::string &who, const char *rw)
 
octave_value_list oscanf (const std::string &fmt, const std::string &who)
 
int printf (const std::string &fmt, const octave_value_list &args, const std::string &who)
 
int puts (const std::string &s, const std::string &who)
 
octave_value scanf (const std::string &fmt, const Array< double > &size, octave_idx_type &count, const std::string &who)
 
off_t skipl (off_t count, bool &err, const std::string &who)
 

Private Attributes

refcount< octave_idx_typecount
 
std::string errmsg
 
bool fail
 
mach_info::float_format flt_fmt
 
int md
 
bool open_state
 

Friends

class stream
 

Detailed Description

Definition at line 61 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 () 
)
inline

Definition at line 69 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 octave::base_stream::clear ( void  )
protected

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

References errmsg, and fail.

Referenced by error(), and octave::stream::stream_ok().

◆ clearerr()

void octave::base_stream::clearerr ( void  )
protected

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

References input_stream(), is, os, and output_stream().

◆ close()

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

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

Referenced by octave::stream::close().

◆ do_close()

◆ do_gets()

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

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

References c, err, error(), file_number(), input_stream(), invalid_operation(), is, retval, and string.

Referenced by do_oscanf(), do_scanf(), getl(), and gets().

◆ do_numeric_printf_conv()

◆ do_oscanf()

◆ do_printf()

◆ do_scanf()

◆ do_textscan()

octave_value octave::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

◆ eof()

◆ error() [1/3]

◆ error() [2/3]

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

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

References errmsg, and fail.

◆ error() [3/3]

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

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

References errmsg, and fail.

◆ file_number()

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

◆ float_format()

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

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

References flt_fmt.

Referenced by octave::stream::float_format().

◆ flush()

int octave::base_stream::flush ( void  )
private

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

References octave::stream::flush(), invalid_operation(), os, output_stream(), and retval.

Referenced by octave::stream::flush().

◆ getl()

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

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

References do_gets(), and err.

Referenced by octave::stream::getl().

◆ gets()

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

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

References do_gets(), and err.

Referenced by octave::stream::gets().

◆ input_stream()

◆ invalid_operation()

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

◆ is_open()

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

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

Referenced by octave::stream::is_open().

◆ mode()

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

◆ name()

◆ ok()

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

Definition at line 143 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()

◆ printf()

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

◆ puts()

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

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

References error(), octave::stream::flush(), invalid_operation(), os, output_stream(), retval, and s.

Referenced by octave::stream::puts().

◆ scanf()

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

◆ seek()

◆ skipl()

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

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

References c, err, error(), file_number(), input_stream(), invalid_operation(), and is.

Referenced by octave::stream::skipl().

◆ tell()

Friends And Related Function Documentation

◆ stream

friend class stream
friend

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

Member Data Documentation

◆ count

refcount<octave_idx_type> octave::base_stream::count
private

◆ errmsg

std::string octave::base_stream::errmsg
private

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

Referenced by clear(), and error().

◆ fail

bool octave::base_stream::fail
private

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

Referenced by clear(), and error().

◆ flt_fmt

mach_info::float_format octave::base_stream::flt_fmt
private

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

Referenced by octave_istrstream::create(), and octave_ostrstream::create().

◆ md

int octave::base_stream::md
private

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

◆ open_state

bool octave::base_stream::open_state
private

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


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