#include "oct-stream.h"
Public Member Functions | |
stream (base_stream *bs=nullptr) | |
stream (const stream &)=default | |
~stream (void)=default | |
void | clearerr (void) |
OCTINTERP_API void | close (void) |
std::string | encoding (void) |
OCTINTERP_API bool | eof (void) const |
OCTINTERP_API 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) |
OCTINTERP_API mach_info::float_format | float_format (void) const |
OCTINTERP_API int | flush (void) |
OCTINTERP_API std::string | getl (const octave_value &max_len, bool &err, const std::string &who) |
OCTINTERP_API std::string | getl (octave_idx_type max_len, bool &err, const std::string &who) |
OCTINTERP_API std::string | gets (const octave_value &max_len, bool &err, const std::string &who) |
OCTINTERP_API std::string | gets (octave_idx_type max_len, bool &err, const std::string &who) |
std::istream * | input_stream (void) |
OCTINTERP_API bool | is_open (void) const |
bool | is_valid (void) const |
OCTINTERP_API int | mode (void) const |
OCTINTERP_API std::string | name (void) const |
bool | ok (void) const |
operator bool () const | |
stream & | operator= (const stream &)=default |
OCTINTERP_API octave_value_list | oscanf (const octave_value &fmt, const std::string &who) |
OCTINTERP_API octave_value_list | oscanf (const std::string &fmt, const std::string &who) |
std::ostream * | output_stream (void) |
OCTINTERP_API int | printf (const octave_value &fmt, const octave_value_list &args, 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 octave_value &s, const std::string &who) |
OCTINTERP_API int | puts (const std::string &s, const std::string &who) |
OCTINTERP_API 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) |
OCTINTERP_API int | rewind (void) |
OCTINTERP_API octave_value | scanf (const octave_value &fmt, const Array< double > &size, octave_idx_type &count, 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 int | seek (const octave_value &offset, const octave_value &origin) |
OCTINTERP_API int | seek (off_t offset, int origin) |
OCTINTERP_API bool | skip_bytes (std::size_t n_elts) |
OCTINTERP_API off_t | skipl (const octave_value &count, bool &err, const std::string &who) |
OCTINTERP_API off_t | skipl (off_t count, bool &err, const std::string &who) |
OCTINTERP_API off_t | tell (void) |
OCTINTERP_API 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) |
template<typename T > | |
OCTINTERP_API 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) |
OCTINTERP_API 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) |
OCTINTERP_API bool | write_bytes (const void *data, std::size_t n_elts) |
Static Public Member Functions | |
static OCTINTERP_API std::string | mode_as_string (int mode) |
Private Member Functions | |
OCTINTERP_API 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_stream > | m_rep |
Definition at line 263 of file oct-stream.h.
|
inline |
Definition at line 270 of file oct-stream.h.
|
default |
|
default |
|
inline |
Definition at line 421 of file oct-stream.h.
Referenced by seek().
void octave::stream::close | ( | void | ) |
Definition at line 6365 of file oct-stream.cc.
References m_rep, and stream_ok().
Referenced by octave::stream_list::clear(), and octave::stream_list::remove().
|
inline |
Definition at line 406 of file oct-stream.h.
Referenced by octave::stream_list::get_info().
bool octave::stream::eof | ( | void | ) | const |
Definition at line 7263 of file oct-stream.cc.
References m_rep, and stream_ok().
Referenced by octave::read_data().
Definition at line 7274 of file oct-stream.cc.
References m_rep, and stream_ok().
Referenced by finalize_read(), getl(), gets(), oscanf(), printf(), puts(), read(), scanf(), seek(), skipl(), and write().
|
inline |
Definition at line 374 of file oct-stream.h.
References error().
|
inline |
|
inline |
Definition at line 382 of file oct-stream.h.
|
inline |
Definition at line 390 of file oct-stream.h.
Referenced by octave::stream_list::insert().
|
private |
Definition at line 6488 of file oct-stream.cc.
References oct_data_conv::dt_char, oct_data_conv::dt_double, oct_data_conv::dt_int16, oct_data_conv::dt_int32, oct_data_conv::dt_int64, oct_data_conv::dt_int8, oct_data_conv::dt_logical, oct_data_conv::dt_schar, oct_data_conv::dt_single, oct_data_conv::dt_uchar, oct_data_conv::dt_uint16, oct_data_conv::dt_uint32, oct_data_conv::dt_uint64, oct_data_conv::dt_uint8, oct_data_conv::dt_unknown, error(), FILL_TABLE_ROW, float_format(), octave::mach_info::flt_fmt_ieee_big_endian, octave::mach_info::flt_fmt_ieee_little_endian, octave::mach_info::flt_fmt_unknown, and octave::mach_info::words_big_endian().
Referenced by read().
mach_info::float_format octave::stream::float_format | ( | void | ) | const |
Definition at line 7307 of file oct-stream.cc.
References octave::mach_info::flt_fmt_unknown, m_rep, and stream_ok().
Referenced by finalize_read(), octave::stream_list::get_info(), octave::stream_list::list_open_files(), and write().
int octave::stream::flush | ( | void | ) |
Definition at line 6097 of file oct-stream.cc.
References m_rep, and stream_ok().
std::string octave::stream::getl | ( | const octave_value & | max_len, |
bool & | err, | ||
const std::string & | who | ||
) |
Definition at line 6119 of file oct-stream.cc.
References octave::convert_to_valid_int(), error(), getl(), and octave_value::is_defined().
std::string octave::stream::getl | ( | octave_idx_type | max_len, |
bool & | err, | ||
const std::string & | who | ||
) |
Definition at line 6108 of file oct-stream.cc.
References m_rep, and stream_ok().
Referenced by getl().
std::string octave::stream::gets | ( | const octave_value & | max_len, |
bool & | err, | ||
const std::string & | who | ||
) |
Definition at line 6154 of file oct-stream.cc.
References octave::convert_to_valid_int(), error(), gets(), and octave_value::is_defined().
std::string octave::stream::gets | ( | octave_idx_type | max_len, |
bool & | err, | ||
const std::string & | who | ||
) |
Definition at line 6143 of file oct-stream.cc.
References m_rep, and stream_ok().
Referenced by gets().
|
inline |
Definition at line 411 of file oct-stream.h.
Referenced by read().
|
inlineprivate |
Definition at line 443 of file oct-stream.h.
bool octave::stream::is_open | ( | void | ) | const |
Definition at line 6354 of file oct-stream.cc.
References m_rep, and stream_ok().
|
inline |
Definition at line 392 of file oct-stream.h.
Referenced by octave::stream_list::clear(), octave::stream_list::get_info(), and octave::stream_list::remove().
int octave::stream::mode | ( | void | ) | const |
Definition at line 7296 of file oct-stream.cc.
References m_rep, and stream_ok().
Referenced by octave::stream_list::get_info(), octave::stream_list::list_open_files(), and mode_as_string().
|
static |
Definition at line 7318 of file oct-stream.cc.
References mode(), and octave::math::trunc().
Referenced by octave::stream_list::get_info(), and octave::stream_list::list_open_files().
std::string octave::stream::name | ( | void | ) | const |
Definition at line 7285 of file oct-stream.cc.
References m_rep, and stream_ok().
Referenced by octave::stream_list::clear(), octave::stream_list::get_file_number(), octave::stream_list::get_info(), and octave::stream_list::list_open_files().
|
inline |
Definition at line 394 of file oct-stream.h.
|
inline |
Definition at line 396 of file oct-stream.h.
octave_value_list octave::stream::oscanf | ( | const octave_value & | fmt, |
const std::string & | who | ||
) |
Definition at line 7162 of file oct-stream.cc.
References do_string_escapes(), error(), octave_value::is_sq_string(), octave_value::is_string(), oscanf(), and octave_value::string_value().
octave_value_list octave::stream::oscanf | ( | const std::string & | fmt, |
const std::string & | who | ||
) |
Definition at line 7151 of file oct-stream.cc.
References m_rep, and stream_ok().
Referenced by oscanf().
|
inline |
Definition at line 416 of file oct-stream.h.
Referenced by skip_bytes(), and write_bytes().
int octave::stream::printf | ( | const octave_value & | fmt, |
const octave_value_list & | args, | ||
const std::string & | who | ||
) |
Definition at line 7207 of file oct-stream.cc.
References do_string_escapes(), error(), octave_value::is_sq_string(), octave_value::is_string(), printf(), and octave_value::string_value().
int octave::stream::printf | ( | const std::string & | fmt, |
const octave_value_list & | args, | ||
const std::string & | who | ||
) |
Definition at line 7195 of file oct-stream.cc.
References m_rep, and stream_ok().
Referenced by printf().
int octave::stream::puts | ( | const octave_value & | s, |
const std::string & | who | ||
) |
Definition at line 7244 of file oct-stream.cc.
References error(), octave_value::is_string(), puts(), and octave_value::string_value().
int octave::stream::puts | ( | const std::string & | s, |
const std::string & | who | ||
) |
Definition at line 7231 of file oct-stream.cc.
References m_rep, and stream_ok().
Referenced by puts().
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 | ||
) |
Definition at line 6576 of file oct-stream.cc.
References oct_data_conv::data_type_size(), error(), finalize_read(), octave::get_size(), input_stream(), invalid_operation(), max(), and stream_ok().
Referenced by octave::read_data().
int octave::stream::rewind | ( | void | ) |
Definition at line 6348 of file oct-stream.cc.
octave_value octave::stream::scanf | ( | const octave_value & | fmt, |
const Array< double > & | size, | ||
octave_idx_type & | count, | ||
const std::string & | who | ||
) |
Definition at line 7127 of file oct-stream.cc.
References do_string_escapes(), error(), octave_value::is_sq_string(), octave_value::is_string(), Matrix, scanf(), and octave_value::string_value().
octave_value octave::stream::scanf | ( | const std::string & | fmt, |
const Array< double > & | size, | ||
octave_idx_type & | count, | ||
const std::string & | who | ||
) |
Definition at line 7115 of file oct-stream.cc.
References m_rep, and stream_ok().
Referenced by scanf().
int octave::stream::seek | ( | const octave_value & | offset, |
const octave_value & | origin | ||
) |
Definition at line 6281 of file oct-stream.cc.
References octave::convert_to_valid_int(), error(), octave_value::is_string(), seek(), SEEK_CUR, SEEK_END, SEEK_SET, octave_int< T >::value(), octave_value::xint64_scalar_value(), and octave_value::xstring_value().
Definition at line 6220 of file oct-stream.cc.
References clearerr(), m_rep, SEEK_CUR, SEEK_END, SEEK_SET, and stream_ok().
Referenced by rewind(), seek(), and skip_bytes().
bool octave::stream::skip_bytes | ( | std::size_t | n_elts | ) |
Definition at line 6969 of file oct-stream.cc.
References output_stream(), seek(), SEEK_CUR, SEEK_END, SEEK_SET, and tell().
Referenced by write().
off_t octave::stream::skipl | ( | const octave_value & | count, |
bool & | err, | ||
const std::string & | who | ||
) |
Definition at line 6189 of file oct-stream.cc.
References octave::convert_to_valid_int(), error(), octave_value::is_defined(), octave_value::is_scalar_type(), octave::math::isinf(), octave_value::scalar_value(), and skipl().
off_t octave::stream::skipl | ( | off_t | count, |
bool & | err, | ||
const std::string & | who | ||
) |
Definition at line 6178 of file oct-stream.cc.
References m_rep, and stream_ok().
Referenced by skipl().
off_t octave::stream::tell | ( | void | ) |
Definition at line 6337 of file oct-stream.cc.
References m_rep, and stream_ok().
Referenced by skip_bytes().
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 7185 of file oct-stream.cc.
References m_rep, and stream_ok().
octave_idx_type octave::stream::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 | ||
) |
Definition at line 7013 of file oct-stream.cc.
References octave::convert_data(), Array< T, Alloc >::data(), oct_data_conv::data_type_size(), octave::mach_info::flt_fmt_ieee_big_endian, octave::mach_info::flt_fmt_ieee_little_endian, Array< T, Alloc >::numel(), OCTAVE_LOCAL_BUFFER, skip_bytes(), octave::mach_info::words_big_endian(), and write_bytes().
OCTINTERP_API octave_idx_type octave::stream::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 octave::stream::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 | ||
) |
Definition at line 6773 of file oct-stream.cc.
References error(), float_format(), octave::mach_info::flt_fmt_unknown, invalid_operation(), stream_ok(), and octave_value::write().
Referenced by octave_bool_matrix::write(), octave_bool::write(), octave_complex::write(), octave_complex_matrix::write(), octave_float_scalar::write(), octave_float_complex::write(), octave_float_complex_matrix::write(), octave_float_matrix::write(), octave_uint64_matrix::write(), octave_uint64_scalar::write(), octave_base_magic_int< T >::write(), ov_range< T >::write(), octave_matrix::write(), octave_scalar::write(), octave_char_matrix_str::write(), and octave::write_data().
bool octave::stream::write_bytes | ( | const void * | data, |
std::size_t | n_elts | ||
) |
|
private |