23 #if !defined (octave_oct_stream_h)
24 #define octave_oct_stream_h 1
52 whitespace_conversion = 1,
53 literal_conversion = 2
57 char typ =
'\0',
char mod =
'\0',
58 const std::string& ch_class = std::string ())
60 modifier (
mod), char_class (ch_class) { }
64 type (e.
type), modifier (e.modifier), char_class (e.char_class) { }
129 {
return list.length () > 0 ? list.elem (curr_idx) : 0; }
135 if (curr_idx >= list.length ())
145 void printme (
void)
const;
147 bool ok (
void)
const {
return (nconv >= 0); }
149 operator bool ()
const {
return ok (); }
151 bool all_character_conversions (
void);
153 bool all_numeric_conversions (
void);
171 void add_elt_to_list (
int width,
bool discard,
char type,
char modifier,
173 const std::string& char_class = std::string ());
175 void process_conversion (
const std::string& s,
size_t& i,
size_t n,
176 int& width,
bool& discard,
char& type,
179 int finish_conversion (
const std::string& s,
size_t& i,
size_t n,
180 int& width,
bool discard,
char& type,
195 int p = 0,
const std::string&
f = std::string (),
196 char typ =
'\0',
char mod =
'\0')
197 :
text (
strsave (txt)), args (n), fw (
w), prec (p), flags (
f),
202 flags (e.flags),
type (e.
type), modifier (e.modifier) { }
264 {
return list.
length () > 0 ? list.
elem (curr_idx) : 0; }
270 if (curr_idx >= list.
length ())
283 void printme (
void)
const;
285 bool ok (
void)
const {
return (nconv >= 0); }
287 operator bool ()
const {
return ok (); }
305 void add_elt_to_list (
int args,
const std::string& flags,
int fw,
306 int prec,
char type,
char modifier,
309 void process_conversion (
const std::string& s,
size_t& i,
size_t n,
310 int& args, std::string& flags,
int& fw,
311 int& prec,
char& modifier,
char&
type,
314 void finish_conversion (
const std::string& s,
size_t& i,
int args,
315 const std::string& flags,
int fw,
int prec,
316 char modifier,
char&
type,
339 : count (0), md (arg_md), flt_fmt (ff), fail (false), open_state (true),
350 virtual int seek (off_t offset,
int origin) = 0;
354 virtual off_t
tell (
void) = 0;
358 virtual bool eof (
void)
const = 0;
362 virtual std::string
name (
void)
const = 0;
378 bool is_open (
void)
const {
return open_state; }
395 if (
name () ==
"stdin")
397 else if (
name () ==
"stdout")
399 else if (
name () ==
"stderr")
405 bool ok (
void)
const {
return ! fail; }
413 int mode (
void)
const {
return md; }
419 void error (
const std::string& msg);
420 void error (
const std::string& who,
const std::string& msg);
454 std::string do_gets (
octave_idx_type max_len,
bool& err,
bool strip_newline,
455 const std::string& who );
458 const std::string& who );
460 const std::string& who );
461 off_t
skipl (off_t count,
bool& err,
const std::string& who );
466 const std::string& who );
472 const std::string& who );
475 const std::string& who );
483 const std::string& who );
486 const std::string& who );
488 int puts (
const std::string& s,
const std::string& who );
519 const std::string& who );
521 const std::string& who );
524 const std::string& who );
526 const std::string& who );
528 off_t
skipl (off_t count,
bool& err,
const std::string& who );
530 const std::string& who );
532 int seek (off_t offset,
int origin);
554 bool write_bytes (
const void *data,
size_t n_elts);
571 const std::string& who );
574 const std::string& who );
577 const std::string& who );
580 const std::string& who );
582 int puts (
const std::string& s,
const std::string& who );
585 bool eof (
void)
const;
589 std::string
error (
bool clear =
false)
592 return error (clear, err_num);
613 std::string
name (
void)
const;
615 int mode (
void)
const;
681 static bool instance_ok (
void);
686 lookup (
int fid,
const std::string& who = std::string ());
691 static int remove (
int fid,
const std::string& who = std::string ());
693 const std::string& who = std::string ());
700 static std::string list_open_files (
void);
721 const std::string& who = std::string ())
const;
723 const std::string& who = std::string ())
const;
725 int do_remove (
int fid,
const std::string& who = std::string ());
727 const std::string& who = std::string ());
729 void do_clear (
bool flush =
true);
734 std::string do_list_open_files (
void)
const;