basix_doc 0.1
|
Definition at line 23 of file formatting_port.cpp.
formatting_port_rep | ( | const port & | p2 | ) | [inline] |
Definition at line 92 of file formatting_port.cpp.
: p (p2), prefix (""), need_indent (true), indenter (" ") {}
port accept | ( | ) | [virtual, inherited] |
Reimplemented in socket_port_rep.
Definition at line 87 of file port.cpp.
References ERROR, port_rep::expression(), mmx::lf, and mmx::mmerr.
{ mmerr << "port= " << expression () << lf; ERROR ("socket server port expected"); }
bool busy | ( | ) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 40 of file formatting_port.cpp.
{ return mmx::busy (p); }
nat can_read | ( | ) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 44 of file formatting_port.cpp.
{ return mmx::can_read (p); }
nat can_write | ( | ) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 42 of file formatting_port.cpp.
{ return mmx::can_write (p); }
Reimplemented from port_rep.
Definition at line 61 of file formatting_port.cpp.
References ERROR.
{ if (name == "wrapped") return p; ERROR ("port not found"); }
bool error_flag | ( | ) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 36 of file formatting_port.cpp.
{ return mmx::error_flag (p); }
string error_message | ( | ) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 38 of file formatting_port.cpp.
{ return mmx::error_message (p); }
syntactic expression | ( | ) | const [inline, virtual] |
Implements port_rep.
Definition at line 30 of file formatting_port.cpp.
References mmx::flatten(), and mmx::syn().
void flush | ( | ) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 57 of file formatting_port.cpp.
Referenced by formatting_port_rep::format().
{ mmx::flush (p); }
void format | ( | const print_format & | fm | ) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 65 of file formatting_port.cpp.
References mmx::blank, formatting_port_rep::flush(), mmx::flush_now, mmx::hrule, mmx::indent, mmx::inside(), mmx::lf, mmx::max(), mmx::N(), mmx::stroke, mmx::unindent, and formatting_port_rep::write().
{ switch (fm) { case blank: indenter= " "; break; case stroke: indenter= "| "; break; case indent: prefix << indenter; break; case unindent: inside (prefix) -> resize (max (N(prefix), N(indenter)) - N(indenter)); break; case lf: write ("\n", 1); break; case hrule: write ("--------------------------------------------------------------------------------", 80); break; case flush_now: flush (); break; } }
bool is_input_port | ( | ) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 34 of file formatting_port.cpp.
{ return mmx::is_input_port (p); }
bool is_output_port | ( | ) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 32 of file formatting_port.cpp.
{ return mmx::is_output_port (p); }
void read | ( | char * | s, |
nat | n | ||
) | [inline, virtual] |
bool wait | ( | int | msecs | ) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 59 of file formatting_port.cpp.
{ return mmx::wait (p, msecs); }
void write | ( | const char * | s, |
nat | n | ||
) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 46 of file formatting_port.cpp.
Referenced by formatting_port_rep::format().
{ for (nat i=0; i<n; ) { nat start= i; while (i<n && s[i] != '\n') i++; if (i>start && need_indent) mmx::write (p, prefix); need_indent= (i<n); if (need_indent) i++; mmx::write (p, s+start, i-start); } }