Definition at line 37 of file formatting_port.cpp.
formatting_port_rep | ( | const port & | p2 | ) | [inline] |
Definition at line 177 of file formatting_port.cpp.
00177 : 00178 p (p2), prefix (""), need_indent (true), indenter (" ") {} };
port accept | ( | ) | [virtual, inherited] |
Reimplemented in socket_port_rep.
Definition at line 88 of file port.cpp.
References ERROR, port_rep::expression(), mmx::lf, and mmx::mmerr.
00088 { 00089 mmerr << "port= " << expression () << lf; 00090 ERROR ("socket server port expected"); 00091 }
bool busy | ( | ) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 54 of file formatting_port.cpp.
00054 { 00055 return mmx::busy (p); }
nat can_read | ( | ) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 58 of file formatting_port.cpp.
00058 { 00059 return mmx::can_read (p); }
nat can_write | ( | ) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 56 of file formatting_port.cpp.
00056 { 00057 return mmx::can_write (p); }
Reimplemented from port_rep.
Definition at line 75 of file formatting_port.cpp.
References ERROR.
00075 { 00076 if (name == "wrapped") return p; 00077 ERROR ("port not found"); }
bool error_flag | ( | ) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 50 of file formatting_port.cpp.
00050 { 00051 return mmx::error_flag (p); }
string error_message | ( | ) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 52 of file formatting_port.cpp.
00052 { 00053 return mmx::error_message (p); }
syntactic expression | ( | ) | const [inline, virtual] |
Implements port_rep.
Definition at line 44 of file formatting_port.cpp.
References mmx::flatten(), and mmx::syn().
void flush | ( | ) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 71 of file formatting_port.cpp.
Referenced by formatting_port_rep::format().
00071 { 00072 mmx::flush (p); }
void format | ( | const print_format & | fm | ) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 79 of file formatting_port.cpp.
References mmx::black_background, mmx::black_foreground, mmx::blank, mmx::blink, mmx::blue_background, mmx::blue_foreground, mmx::bold, mmx::cr, mmx::cyan_background, mmx::cyan_foreground, formatting_port_rep::flush(), mmx::flush_now, mmx::green_background, mmx::green_foreground, mmx::hrule, mmx::indent, mmx::inside(), mmx::lf, mmx::magenta_background, mmx::magenta_foreground, mmx::max(), mmx::N(), mmx::red_background, mmx::red_foreground, mmx::reset_attributes, mmx::reset_indent, mmx::stroke, mmx::supports_color(), mmx::underline, mmx::unindent, mmx::white_background, mmx::white_foreground, formatting_port_rep::write(), mmx::yellow_background, and mmx::yellow_foreground.
00079 { 00080 switch (fm) { 00081 case blank: 00082 indenter= " "; 00083 break; 00084 case stroke: 00085 indenter= "| "; 00086 break; 00087 case indent: 00088 prefix << indenter; 00089 break; 00090 case unindent: 00091 inside (prefix) -> resize (max (N(prefix), N(indenter)) - N(indenter)); 00092 break; 00093 case reset_indent: 00094 inside (prefix) -> resize (0); 00095 break; 00096 case cr: 00097 write ("\r", 1); 00098 break; 00099 case lf: 00100 write ("\n", 1); 00101 break; 00102 case hrule: 00103 write ("--------------------------------------------------------------------------------", 80); 00104 break; 00105 case flush_now: 00106 flush (); 00107 break; 00108 00109 case black_foreground: 00110 if (supports_color ()) write ("\x1b[30m", 5); 00111 break; 00112 case red_foreground: 00113 if (supports_color ()) write ("\x1b[31m", 5); 00114 break; 00115 case green_foreground: 00116 if (supports_color ()) write ("\x1b[32m", 5); 00117 break; 00118 case yellow_foreground: 00119 if (supports_color ()) write ("\x1b[33m", 5); 00120 break; 00121 case blue_foreground: 00122 if (supports_color ()) write ("\x1b[34m", 5); 00123 break; 00124 case magenta_foreground: 00125 if (supports_color ()) write ("\x1b[35m", 5); 00126 break; 00127 case cyan_foreground: 00128 if (supports_color ()) write ("\x1b[36m", 5); 00129 break; 00130 case white_foreground: 00131 if (supports_color ()) write ("\x1b[37m", 5); 00132 break; 00133 00134 case black_background: 00135 if (supports_color ()) write ("\x1b[40m", 5); 00136 break; 00137 case red_background: 00138 if (supports_color ()) write ("\x1b[41m", 5); 00139 break; 00140 case green_background: 00141 if (supports_color ()) write ("\x1b[42m", 5); 00142 break; 00143 case yellow_background: 00144 if (supports_color ()) write ("\x1b[43m", 5); 00145 break; 00146 case blue_background: 00147 if (supports_color ()) write ("\x1b[44m", 5); 00148 break; 00149 case magenta_background: 00150 if (supports_color ()) write ("\x1b[45m", 5); 00151 break; 00152 case cyan_background: 00153 if (supports_color ()) write ("\x1b[46m", 5); 00154 break; 00155 case white_background: 00156 if (supports_color ()) write ("\x1b[47m", 5); 00157 break; 00158 00159 case bold: 00160 if (supports_color ()) write ("\x1b[1m", 4); 00161 break; 00162 case underline: 00163 if (supports_color ()) write ("\x1b[4m", 4); 00164 break; 00165 case blink: 00166 if (supports_color ()) write ("\x1b[5m", 4); 00167 break; 00168 00169 case reset_attributes: 00170 if (supports_color ()) write ("\x1b[0m", 4); 00171 flush (); 00172 break; 00173 } 00174 }
bool is_input_port | ( | ) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 48 of file formatting_port.cpp.
00048 { 00049 return mmx::is_input_port (p); }
bool is_output_port | ( | ) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 46 of file formatting_port.cpp.
00046 { 00047 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 73 of file formatting_port.cpp.
00073 { 00074 return mmx::wait (p, msecs); }
void write | ( | const char * | s, | |
nat | n | |||
) | [inline, virtual] |
Reimplemented from port_rep.
Definition at line 60 of file formatting_port.cpp.
References start.
Referenced by formatting_port_rep::format().
00060 { 00061 for (nat i=0; i<n; ) { 00062 nat start= i; 00063 while (i<n && s[i] != '\n') i++; 00064 if (i>start && need_indent) mmx::write (p, prefix); 00065 need_indent= (i<n); 00066 if (need_indent) i++; 00067 mmx::write (p, s+start, i-start); 00068 } }