GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
octave::stream Class Reference

#include "oct-stream.h"

Collaboration diagram for octave::stream:

Public Member Functions

 stream (base_stream *bs=nullptr)
 
 stream (const stream &)=default
 
 ~stream (void)=default
 
void clearerr (void)
 
void close (void)
 
std::string encoding (void)
 
bool eof (void) const
 
std::string error (bool clear, int &err_num)
 
std::string error (bool clear=false)
 
void error (const char *msg)
 
void error (const std::string &msg)
 
int file_number (void)
 
mach_info::float_format float_format (void) const
 
int flush (void)
 
std::string getl (const octave_value &max_len, bool &err, const std::string &who)
 
std::string getl (octave_idx_type max_len, bool &err, const std::string &who)
 
std::string gets (const octave_value &max_len, bool &err, const std::string &who)
 
std::string gets (octave_idx_type max_len, bool &err, const std::string &who)
 
std::istream * input_stream (void)
 
bool is_open (void) const
 
bool is_valid (void) const
 
int mode (void) const
 
std::string name (void) const
 
bool ok (void) const
 
 operator bool () const
 
streamoperator= (const stream &)=default
 
octave_value_list oscanf (const octave_value &fmt, const std::string &who)
 
octave_value_list oscanf (const std::string &fmt, const std::string &who)
 
std::ostream * output_stream (void)
 
int printf (const octave_value &fmt, const octave_value_list &args, const std::string &who)
 
int printf (const std::string &fmt, const octave_value_list &args, const std::string &who)
 
int puts (const octave_value &s, const std::string &who)
 
int puts (const std::string &s, const std::string &who)
 
octave_value read (const Array< double > &size, octave_idx_type block_size, oct_data_conv::data_type input_type, oct_data_conv::data_type output_type, octave_idx_type skip, mach_info::float_format flt_fmt, octave_idx_type &count)
 
int rewind (void)
 
octave_value scanf (const octave_value &fmt, const Array< double > &size, octave_idx_type &count, const std::string &who)
 
octave_value scanf (const std::string &fmt, const Array< double > &size, octave_idx_type &count, const std::string &who)
 
int seek (const octave_value &offset, const octave_value &origin)
 
int seek (off_t offset, int origin)
 
bool skip_bytes (size_t n_elts)
 
off_t skipl (const octave_value &count, bool &err, const std::string &who)
 
off_t skipl (off_t count, bool &err, const std::string &who)
 
off_t tell (void)
 
octave_value textscan (const std::string &fmt, octave_idx_type ntimes, const octave_value_list &options, const std::string &who, octave_idx_type &count)
 
template<typename T >
octave_idx_type write (const Array< T > &data, octave_idx_type block_size, oct_data_conv::data_type output_type, octave_idx_type skip, mach_info::float_format flt_fmt)
 
octave_idx_type write (const octave_value &data, octave_idx_type block_size, oct_data_conv::data_type output_type, octave_idx_type skip, mach_info::float_format flt_fmt)
 
bool write_bytes (const void *data, size_t n_elts)
 

Static Public Member Functions

static std::string mode_as_string (int mode)
 

Private Member Functions

octave_value finalize_read (std::list< void * > &input_buf_list, octave_idx_type input_buf_elts, octave_idx_type elts_read, octave_idx_type nr, octave_idx_type nc, oct_data_conv::data_type input_type, oct_data_conv::data_type output_type, mach_info::float_format ffmt)
 
void invalid_operation (const std::string &who, const char *rw)
 
bool stream_ok (bool clear=true) const
 

Private Attributes

std::shared_ptr< base_streamm_rep
 

Detailed Description

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

Constructor & Destructor Documentation

◆ stream() [1/2]

octave::stream::stream ( base_stream bs = nullptr)
inline

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

◆ stream() [2/2]

octave::stream::stream ( const stream )
default

◆ ~stream()

octave::stream::~stream ( void  )
default

Member Function Documentation

◆ clearerr()

void octave::stream::clearerr ( void  )
inline

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

Referenced by Ffclear(), and seek().

◆ close()

void octave::stream::close ( void  )

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

References m_rep, and stream_ok().

Referenced by octave::stream_list::clear(), and octave::stream_list::remove().

◆ encoding()

std::string octave::stream::encoding ( void  )
inline

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

Referenced by octave::stream_list::get_info().

◆ eof()

bool octave::stream::eof ( void  ) const

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

References m_rep, retval, and stream_ok().

Referenced by Ffeof(), Fsscanf(), octave::load_save_system::load_vars(), and octave::read_data().

◆ error() [1/4]

std::string octave::stream::error ( bool  clear,
int &  err_num 
)

◆ error() [2/4]

std::string octave::stream::error ( bool  clear = false)
inline

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

References error().

◆ error() [3/4]

void octave::stream::error ( const char *  msg)
inline

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

References error().

Referenced by error().

◆ error() [4/4]

void octave::stream::error ( const std::string &  msg)
inline

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

◆ file_number()

int octave::stream::file_number ( void  )
inline

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

Referenced by Fdup2(), Ffcntl(), and octave::stream_list::insert().

◆ finalize_read()

◆ float_format()

mach_info::float_format octave::stream::float_format ( void  ) const

◆ flush()

int octave::stream::flush ( void  )

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

References m_rep, retval, and stream_ok().

Referenced by Ffflush().

◆ getl() [1/2]

std::string octave::stream::getl ( const octave_value max_len,
bool &  err,
const std::string &  who 
)

◆ getl() [2/2]

std::string octave::stream::getl ( octave_idx_type  max_len,
bool &  err,
const std::string &  who 
)

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

References m_rep, retval, and stream_ok().

Referenced by Ffgetl(), and getl().

◆ gets() [1/2]

std::string octave::stream::gets ( const octave_value max_len,
bool &  err,
const std::string &  who 
)

◆ gets() [2/2]

std::string octave::stream::gets ( octave_idx_type  max_len,
bool &  err,
const std::string &  who 
)

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

References m_rep, retval, and stream_ok().

Referenced by Ffgets(), and gets().

◆ input_stream()

std::istream* octave::stream::input_stream ( void  )
inline

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

Referenced by Fdlmread(), and read().

◆ invalid_operation()

void octave::stream::invalid_operation ( const std::string &  who,
const char *  rw 
)
inlineprivate

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

Referenced by read(), and write().

◆ is_open()

bool octave::stream::is_open ( void  ) const

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

References m_rep, retval, and stream_ok().

◆ is_valid()

bool octave::stream::is_valid ( void  ) const
inline

◆ mode()

int octave::stream::mode ( void  ) const

◆ mode_as_string()

std::string octave::stream::mode_as_string ( int  mode)
static

◆ name()

std::string octave::stream::name ( void  ) const

◆ ok()

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

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

◆ operator bool()

octave::stream::operator bool ( ) const
inline

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

◆ operator=()

stream& octave::stream::operator= ( const stream )
default

◆ oscanf() [1/2]

octave_value_list octave::stream::oscanf ( const octave_value fmt,
const std::string &  who 
)

◆ oscanf() [2/2]

octave_value_list octave::stream::oscanf ( const std::string &  fmt,
const std::string &  who 
)

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

References m_rep, retval, and stream_ok().

Referenced by Fsscanf(), oscanf(), and scanf_internal().

◆ output_stream()

std::ostream* octave::stream::output_stream ( void  )
inline

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

Referenced by Ffdisp(), skip_bytes(), and write_bytes().

◆ printf() [1/2]

int octave::stream::printf ( const octave_value fmt,
const octave_value_list args,
const std::string &  who 
)

◆ printf() [2/2]

int octave::stream::printf ( const std::string &  fmt,
const octave_value_list args,
const std::string &  who 
)

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

References m_rep, retval, and stream_ok().

Referenced by Fsprintf(), printf(), and printf_internal().

◆ puts() [1/2]

int octave::stream::puts ( const octave_value s,
const std::string &  who 
)

◆ puts() [2/2]

int octave::stream::puts ( const std::string &  s,
const std::string &  who 
)

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

References m_rep, retval, and stream_ok().

Referenced by puts(), and puts_internal().

◆ read()

octave_value octave::stream::read ( const Array< double > &  size,
octave_idx_type  block_size,
oct_data_conv::data_type  input_type,
oct_data_conv::data_type  output_type,
octave_idx_type  skip,
mach_info::float_format  flt_fmt,
octave_idx_type count 
)

◆ rewind()

int octave::stream::rewind ( void  )

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

References seek(), and SEEK_SET.

Referenced by Ffrewind().

◆ scanf() [1/2]

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

◆ scanf() [2/2]

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

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

References m_rep, retval, and stream_ok().

Referenced by Fsscanf(), scanf(), and scanf_internal().

◆ seek() [1/2]

◆ seek() [2/2]

int octave::stream::seek ( off_t  offset,
int  origin 
)

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

References clearerr(), m_rep, SEEK_CUR, SEEK_END, SEEK_SET, and stream_ok().

Referenced by Ffseek(), rewind(), seek(), and skip_bytes().

◆ skip_bytes()

bool octave::stream::skip_bytes ( size_t  n_elts)

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

References output_stream(), seek(), SEEK_CUR, SEEK_END, SEEK_SET, and tell().

Referenced by write().

◆ skipl() [1/2]

off_t octave::stream::skipl ( const octave_value count,
bool &  err,
const std::string &  who 
)

◆ skipl() [2/2]

off_t octave::stream::skipl ( off_t  count,
bool &  err,
const std::string &  who 
)

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

References m_rep, retval, and stream_ok().

Referenced by Ffskipl(), and skipl().

◆ stream_ok()

bool octave::stream::stream_ok ( bool  clear = true) const
inlineprivate

◆ tell()

off_t octave::stream::tell ( void  )

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

References m_rep, retval, and stream_ok().

Referenced by Fftell(), Fsscanf(), and skip_bytes().

◆ textscan()

octave_value octave::stream::textscan ( const std::string &  fmt,
octave_idx_type  ntimes,
const octave_value_list options,
const std::string &  who,
octave_idx_type count 
)

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

References m_rep, and stream_ok().

Referenced by textscan_internal().

◆ write() [1/2]

◆ write() [2/2]

◆ write_bytes()

bool octave::stream::write_bytes ( const void *  data,
size_t  n_elts 
)

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

References output_stream().

Referenced by write().

Member Data Documentation

◆ m_rep

std::shared_ptr<base_stream> octave::stream::m_rep
private

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