#include "oct-stream.h"
Public Member Functions | |
octave_base_stream (std::ios::openmode arg_md=std::ios::in|std::ios::out, oct_mach_info::float_format ff=oct_mach_info::native_float_format()) | |
virtual | ~octave_base_stream (void) |
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 |
virtual std::ostream * | output_stream (void) |
virtual int | seek (long offset, int origin)=0 |
virtual long | tell (void)=0 |
Protected Member Functions | |
void | clear (void) |
void | clearerr (void) |
void | error (const std::string &who, const std::string &msg) |
void | error (const std::string &msg) |
oct_mach_info::float_format | float_format (void) const |
int | mode (void) const |
Private Member Functions | |
octave_base_stream (const octave_base_stream &) | |
std::string | do_gets (octave_idx_type max_len, bool &err, bool strip_newline, 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) |
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_base_stream & | operator= (const octave_base_stream &) |
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) |
long | skipl (long count, bool &err, const std::string &who) |
Private Attributes | |
octave_refcount< octave_idx_type > | count |
std::string | errmsg |
bool | fail |
oct_mach_info::float_format | flt_fmt |
int | md |
bool | open_state |
Friends | |
class | octave_stream |
Definition at line 326 of file oct-stream.h.
octave_base_stream::octave_base_stream | ( | std::ios::openmode | arg_md = std::ios::in|std::ios::out , |
|
oct_mach_info::float_format | ff = oct_mach_info::native_float_format () | |||
) | [inline] |
Definition at line 334 of file oct-stream.h.
virtual octave_base_stream::~octave_base_stream | ( | void | ) | [inline, virtual] |
Definition at line 341 of file oct-stream.h.
octave_base_stream::octave_base_stream | ( | const octave_base_stream & | ) | [private] |
void octave_base_stream::clear | ( | void | ) | [protected] |
Reimplemented in octave_tstdiostream< BUF_T, STREAM_T, FILE_T >, octave_base_strstream, octave_istrstream, octave_ostrstream, and octave_tstdiostream< c_file_ptr_buf, io_c_file_ptr_stream, FILE * >.
Definition at line 894 of file oct-stream.cc.
Referenced by error(), and octave_stream::stream_ok().
void octave_base_stream::clearerr | ( | void | ) | [protected] |
Definition at line 901 of file oct-stream.cc.
References input_stream(), and output_stream().
Referenced by octave_stream::clearerr().
void octave_base_stream::close | ( | void | ) | [inline] |
Definition at line 380 of file oct-stream.h.
References octave_stream::is_open().
Referenced by octave_stream::close().
virtual void octave_base_stream::do_close | ( | void | ) | [inline, virtual] |
Reimplemented in octave_fstream, octave_tstdiostream< BUF_T, STREAM_T, FILE_T >, and octave_tstdiostream< c_file_ptr_buf, io_c_file_ptr_stream, FILE * >.
Definition at line 378 of file oct-stream.h.
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 917 of file oct-stream.cc.
References error(), file_number(), forced_interactive, input_stream(), interactive, and invalid_operation().
Referenced by do_oscanf(), do_scanf(), getl(), and gets().
bool octave_base_stream::do_oscanf | ( | const scanf_format_elt * | elt, | |
octave_value & | retval, | |||
const std::string & | who | |||
) | [private] |
Definition at line 1948 of file oct-stream.cc.
References BEGIN_C_CONVERSION, BEGIN_CHAR_CLASS_CONVERSION, BEGIN_S_CONVERSION, scanf_format_elt::discard, do_gets(), DO_LITERAL_CONVERSION, DO_PCT_CONVERSION, DO_WHITESPACE_CONVERSION, error(), input_stream(), interactive, scanf_format_elt::literal_conversion, name(), OCTAVE_SCAN, ok(), scanf_format_elt::text, scanf_format_elt::type, and scanf_format_elt::whitespace_conversion.
Referenced by oscanf().
int octave_base_stream::do_printf | ( | printf_format_list & | fmt_list, | |
const octave_value_list & | args, | |||
const std::string & | who | |||
) | [private] |
Definition at line 2449 of file oct-stream.cc.
References printf_format_elt::args, DO_DOUBLE_CONV, do_printf_conv(), printf_value_cache::double_value(), error(), error_state, printf_value_cache::exhausted(), printf_format_list::first(), printf_format_elt::fw, printf_value_cache::int_value(), invalid_operation(), lo_ieee_is_NA, lo_ieee_isnan, printf_format_list::next(), printf_format_list::num_conversions(), output_stream(), printf_format_elt::prec, printf_value_cache::string_value(), printf_format_elt::text, printf_format_elt::type, and xisinf().
Referenced by printf().
octave_value octave_base_stream::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 | |||
) | [private] |
Definition at line 1525 of file oct-stream.cc.
References scanf_format_list::all_character_conversions(), BEGIN_C_CONVERSION, BEGIN_CHAR_CLASS_CONVERSION, BEGIN_S_CONVERSION, octave_value::convert_to_str(), scanf_format_elt::discard, do_gets(), DO_LITERAL_CONVERSION, DO_PCT_CONVERSION, do_scanf_conv(), DO_WHITESPACE_CONVERSION, error(), file_number(), FINISH_CHARACTER_CONVERSION, scanf_format_list::first(), forced_interactive, Array< T >::fortran_vec(), input_stream(), interactive, scanf_format_list::length(), scanf_format_elt::literal_conversion, scanf_format_elt::modifier, name(), scanf_format_list::next(), scanf_format_list::num_conversions(), ok(), panic_impossible, Matrix::resize(), scanf_format_elt::text, scanf_format_elt::type, and scanf_format_elt::whitespace_conversion.
Referenced by scanf().
virtual bool octave_base_stream::eof | ( | void | ) | const [pure virtual] |
void octave_base_stream::error | ( | const std::string & | who, | |
const std::string & | msg | |||
) | [protected] |
Definition at line 887 of file oct-stream.cc.
Definition at line 2668 of file oct-stream.cc.
References clear(), errmsg, and fail.
Referenced by do_gets(), do_oscanf(), do_printf(), do_scanf(), octave_stream::error(), invalid_operation(), octave_base_iostream::invalid_operation(), octave_fstream::octave_fstream(), oscanf(), printf(), puts(), scanf(), octave_base_strstream::seek(), octave_fstream::seek(), skipl(), octave_base_strstream::tell(), and octave_fstream::tell().
void octave_base_stream::error | ( | const std::string & | msg | ) | [protected] |
Definition at line 880 of file oct-stream.cc.
virtual int octave_base_stream::file_number | ( | void | ) | const [inline, virtual] |
Reimplemented in octave_tstdiostream< BUF_T, STREAM_T, FILE_T >, and octave_tstdiostream< c_file_ptr_buf, io_c_file_ptr_stream, FILE * >.
Definition at line 389 of file oct-stream.h.
References octave_stream::name().
Referenced by do_gets(), do_scanf(), octave_stream::file_number(), and skipl().
oct_mach_info::float_format octave_base_stream::float_format | ( | void | ) | const [inline, protected] |
Definition at line 413 of file oct-stream.h.
Referenced by octave_stream::float_format().
int octave_base_stream::flush | ( | void | ) | [private] |
Definition at line 2176 of file oct-stream.cc.
References invalid_operation(), and output_stream().
Referenced by octave_stream::flush().
std::string octave_base_stream::getl | ( | octave_idx_type | max_len, | |
bool & | err, | |||
const std::string & | who | |||
) | [private] |
Definition at line 1020 of file oct-stream.cc.
References do_gets().
Referenced by octave_stream::getl().
std::string octave_base_stream::gets | ( | octave_idx_type | max_len, | |
bool & | err, | |||
const std::string & | who | |||
) | [private] |
Definition at line 1026 of file oct-stream.cc.
References do_gets().
Referenced by octave_stream::gets().
virtual std::istream* octave_base_stream::input_stream | ( | void | ) | [inline, virtual] |
Reimplemented in octave_fstream, octave_istream, octave_ostream, octave_tstdiostream< BUF_T, STREAM_T, FILE_T >, octave_istrstream, octave_ostrstream, and octave_tstdiostream< c_file_ptr_buf, io_c_file_ptr_stream, FILE * >.
Definition at line 366 of file oct-stream.h.
Referenced by clearerr(), do_gets(), do_oscanf(), do_scanf(), octave_stream::input_stream(), oscanf(), scanf(), and skipl().
void octave_base_stream::invalid_operation | ( | const std::string & | who, | |
const char * | rw | |||
) | [private] |
Definition at line 2681 of file oct-stream.cc.
References error().
Referenced by do_gets(), do_printf(), flush(), octave_stream::invalid_operation(), oscanf(), puts(), scanf(), and skipl().
bool octave_base_stream::is_open | ( | void | ) | const [inline] |
Definition at line 376 of file oct-stream.h.
Referenced by octave_stream::is_open().
int octave_base_stream::mode | ( | void | ) | const [inline, protected] |
Definition at line 411 of file oct-stream.h.
Referenced by octave_fstream::input_stream(), octave_stream::mode(), and octave_fstream::output_stream().
virtual std::string octave_base_stream::name | ( | void | ) | const [pure virtual] |
bool octave_base_stream::ok | ( | void | ) | const [inline] |
Definition at line 403 of file oct-stream.h.
Referenced by do_oscanf(), do_scanf(), octave_stream::ok(), and oscanf().
octave_base_stream& octave_base_stream::operator= | ( | const octave_base_stream & | ) | [private] |
octave_value_list octave_base_stream::oscanf | ( | const std::string & | fmt, | |
const std::string & | who | |||
) | [private] |
Definition at line 2097 of file oct-stream.cc.
References do_oscanf(), error(), scanf_format_list::first(), input_stream(), invalid_operation(), octave_value::is_defined(), scanf_format_list::length(), scanf_format_list::next(), scanf_format_list::num_conversions(), ok(), and octave_value_list::resize().
Referenced by octave_stream::oscanf().
virtual std::ostream* octave_base_stream::output_stream | ( | void | ) | [inline, virtual] |
Reimplemented in octave_fstream, octave_istream, octave_ostream, octave_tstdiostream< BUF_T, STREAM_T, FILE_T >, octave_istrstream, octave_ostrstream, and octave_tstdiostream< c_file_ptr_buf, io_c_file_ptr_stream, FILE * >.
Definition at line 372 of file oct-stream.h.
Referenced by clearerr(), do_printf(), flush(), octave_stream::output_stream(), and puts().
int octave_base_stream::printf | ( | const std::string & | fmt, | |
const octave_value_list & | args, | |||
const std::string & | who | |||
) | [private] |
Definition at line 2611 of file oct-stream.cc.
References do_printf(), error(), and printf_format_list::num_conversions().
Referenced by octave_stream::printf().
int octave_base_stream::puts | ( | const std::string & | s, | |
const std::string & | who | |||
) | [private] |
Definition at line 2628 of file oct-stream.cc.
References error(), invalid_operation(), and output_stream().
Referenced by octave_stream::puts().
octave_value octave_base_stream::scanf | ( | const std::string & | fmt, | |
const Array< double > & | size, | |||
octave_idx_type & | count, | |||
const std::string & | who | |||
) | [private] |
Definition at line 1912 of file oct-stream.cc.
References do_scanf(), error(), error_state, get_size(), input_stream(), invalid_operation(), and scanf_format_list::num_conversions().
Referenced by octave_stream::scanf().
long octave_base_stream::skipl | ( | long | count, | |
bool & | err, | |||
const std::string & | who | |||
) | [private] |
Definition at line 1032 of file oct-stream.cc.
References count, error(), file_number(), forced_interactive, input_stream(), interactive, and invalid_operation().
Referenced by octave_stream::skipl().
virtual long octave_base_stream::tell | ( | void | ) | [pure virtual] |
friend class octave_stream [friend] |
Definition at line 330 of file oct-stream.h.
Referenced by octave_ostrstream::create(), octave_istrstream::create(), octave_oprocstream::create(), octave_iprocstream::create(), octave_ostream::create(), octave_istream::create(), and octave_fstream::create().
Definition at line 431 of file oct-stream.h.
Referenced by octave_stream::octave_stream(), octave_stream::operator=(), skipl(), and octave_stream::~octave_stream().
std::string octave_base_stream::errmsg [private] |
Definition at line 447 of file oct-stream.h.
bool octave_base_stream::fail [private] |
Definition at line 441 of file oct-stream.h.
Definition at line 438 of file oct-stream.h.
int octave_base_stream::md [private] |
Reimplemented in octave_tstdiostream< BUF_T, STREAM_T, FILE_T >, and octave_tstdiostream< c_file_ptr_buf, io_c_file_ptr_stream, FILE * >.
Definition at line 435 of file oct-stream.h.
bool octave_base_stream::open_state [private] |
Definition at line 444 of file oct-stream.h.