Skip to content

Latest commit

 

History

History
222 lines (131 loc) · 4.54 KB

Renderer.md

File metadata and controls

222 lines (131 loc) · 4.54 KB

Renderer

class Renderer

Required header: <Eclog/Renderer.h>

The Renderer class represents an Eclog text renderer.

Member functions

Name Description
(constructor) Constructor.
beginRootObject Begins rendering the root object.
endRootObject Ends rendering the root object.
renderRootObject Renders the root object directly with an object description.
renderEmptyLines Renders one or more empty lines.
renderComment Renders a comment.
beginInline Begins an inline-block.
endInline Ends an inline-block.
close Closes the renderer.
operator RendererHandle Returns a handle to this renderer.

(constructor)

explicit Renderer(OutputStream& stream,
    const RendererConfig& rendererConfig = RendererConfig());

Constructs a Renderer.

Parameters

OutputStream& stream The output stream to write to.

RendererConfig& rendererConfig The renderer configuration.


beginRootObject

void beginRootObject();
void beginRootObject(ErrorCode& ec);

Begins rendering the root object.

The key-value pairs of the root object must be rendered with a new object renderer (an ObjectRenderer instance) constructed from this renderer.

Call to this method must be paired with a call to endRootObject.

Parameters

ErrorCode& ec Set to indicate what error occurred, if any.

Errors

An InvalidOperation fault occurs if the root object is being rendered or has been rendered.


endRootObject

void endRootObject();
void endRootObject(ErrorCode& ec);

Ends rendering the root object.

The object renderer of the root object, if there is one, is invalidated after this call.

Parameters

ErrorCode& ec Set to indicate what error occurred, if any.

Errors

An InvalidOperation fault occurs if the root object is not currently being rendered.

An InvalidOperation fault occurs if there is currently a deeply nested object or array that is being rendered.


renderRootObject

void renderRootObject(const ObjectDesc& root);
void renderRootObject(const ObjectDesc& root, ErrorCode& ec);

Renders the root object directly with an object description.

Parameters

const ObjectDesc& root The description of the root object.

ErrorCode& ec Set to indicate what error occurred, if any.

Errors

An InvalidOperation fault occurs if the root object is being rendered or has been rendered.


renderEmptyLines

void renderEmptyLines(int count);
void renderEmptyLines(int count, ErrorCode& ec);

Renders one or more empty lines.

Parameters

int count Number of empty lines.

ErrorCode& ec Set to indicate what error occurred, if any.

Errors

An InvalidOperation fault occurs if the root object is currently being rendered.


renderComment

void renderComment(cstring comment);
void renderComment(cstring comment, ErrorCode& ec);

Renders a comment.

Parameters

cstring comment The comment.

ErrorCode& ec Set to indicate what error occurred, if any.

Errors

An InvalidOperation fault occurs if the root object is currently being rendered.


beginInline

int beginInline();

Begins an inline-block.

Return value

int The nesting level of the inline block.

Errors

An InvalidOperation fault occurs if the root object is currently being rendered.


endInline

int endInline();

Ends an inline-block.

Return value

int The nesting level of the inline block.

Errors

An InvalidOperation fault occurs if the root object is currently being rendered.


close

void close();
void close(ErrorCode& ec);

Closes the renderer.

This renderer is invalidated after this operation.

Parameters

ErrorCode& ec Set to indicate what error occurred, if any.

Errors

An InvalidOperation fault occurs if the root object is currently being rendered.


operator RendererHandle

operator RendererHandle();

Returns a handle to this renderer.

Return value

RendererHandle Handle to this renderer.