Next: , Previous: , Up: The output stream hierarchy   [Contents][Index]


3.5.2 The abstract styled_ostream class

The type for a styled output stream is ‘styled_ostream_t’. It is a subclass of ‘ostream_t’ that adds the following methods:

Function: void styled_ostream_begin_use_class (styled_ostream_t stream, const char *classname)

Starts a run of text belonging to classname. The classname is the name of a CSS class. It can be chosen arbitrarily and customized through the CSS file.

Function: void styled_ostream_end_use_class (styled_ostream_t stream, const char *classname)

Ends a run of text belonging to classname. The styled_ostream_begin_use_class / styled_ostream_end_use_class calls must match properly.

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 styled_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 styled_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. On terminal output, 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.

Function: void styled_ostream_flush_to_current_style (styled_ostream_t stream)

This function acts like ostream_flush (stream, FLUSH_THIS_STREAM), except that it leaves the destination with the current text style enabled, instead of with the default text style.

After calling this function, you can output strings without newlines(!) to the underlying stream, and they will be rendered like strings passed to ostream_write_mem, ostream_write_str, or ostream_printf.


Next: Concrete ostream subclasses without styling, Previous: The abstract ostream class, Up: The output stream hierarchy   [Contents][Index]