Next: The html_ostream
class, Previous: The fd_ostream
class, Up: Concrete ostream subclasses without styling [Contents][Index]
term_ostream
classThe term_ostream
class supports output to a file descriptor that
is connected to a terminal emulator or console. Its type is
‘term_ostream_t’. It is a subclass of ‘ostream_t’.
It can be instantiated through this function:
Creates an output stream referring to the file descriptor fd
.
filename
is used only for error messages.
tty_control
specifies the amount of control to take over the
underlying tty.
The resulting stream will be line-buffered.
Note: The resulting stream must be closed before fd
can be
closed.
The class adds the following methods:
Converts an RGB value
(red
, green
, blue
in [0..255]) to
a color, valid for this stream only.
Gets/sets the text color.
Gets/sets the background color.
Gets/sets the font weight.
Gets/sets the font posture.
Gets/sets the text underline decoration.
Returns the referred URL of the currently set hyperlink, or NULL
if no hyperlink attribute is currently set.
Note: The returned string is only valid up to the next invocation of
term_ostream_set_hyperlink
.
Returns the id of the currently set hyperlink, or NULL
if no
hyperlink attribute is currently set.
Note: The returned string is only valid up to the next invocation of
term_ostream_set_hyperlink
.
Sets or removes a hyperlink attribute.
To set a hyperlink attribute, pass a non-NULL
ref.
ref is an URL; it should be at most 2083 bytes long. Non-ASCII
characters should be URI-escaped (using the %nn syntax). id is
an optional identifier. Multiple hyperlinks with the same id
will be highlighted together. If specified, id should be at most
250 bytes long.
To remove a hyperlink attribute, pass NULL
for ref and id.
Hyperlinks don’t nest. That is, a hyperlink attribute is enabled only
up to the next invocation of styled_ostream_set_hyperlink
.
This function acts like ostream_flush (stream, FLUSH_THIS_STREAM)
,
except that it leaves the terminal with the current text attributes enabled,
instead of with the default text attributes.
After calling this function, you can output strings without newlines(!) to the
underlying file descriptor, and they will be rendered like strings passed to
ostream_write_mem
, ostream_write_str
, or ostream_printf
.
Next: The html_ostream
class, Previous: The fd_ostream
class, Up: Concrete ostream subclasses without styling [Contents][Index]