Skip to content

Latest commit

 

History

History
249 lines (145 loc) · 5.59 KB

ObjectRenderer.md

File metadata and controls

249 lines (145 loc) · 5.59 KB

ObjectRenderer

class ObjectRenderer

Required header: <Eclog/ObjectRenderer.h>

The ObjectRenderer class represents an object renderer.

Member functions

Name Description
(constructor) Constructor.
beginObject Begins rendering an object.
endObject Ends rendering the current object.
beginArray Begins rendering an array.
endArray Ends rendering the current array.
renderMember Renders a key-value pair.
renderEmptyLines Renders one or more empty lines.
renderComment Renders a comment.
beginInline Begins an inline-block.
endInline Ends an inline-block.
operator RendererHandle Returns a handle to this renderer.

(constructor)

explicit ObjectRenderer(RendererHandle parent);
explicit ObjectRenderer(ObjectRenderer& parent);

Constructs an ObjectRenderer.

Parameters

RendererHandle parent Handle to the parent renderer.

ObjectRenderer& parent Reference to the parent renderer.


beginObject

void beginObject(const KeyDesc& key);
void beginObject(const KeyDesc& key, ErrorCode& ec);

Begins rendering an object.

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

Each call to this method must be paired with a call to endObject.

Parameters

const KeyDesc& key The description of the key of the nested object.

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

Errors

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


endObject

void endObject();
void endObject(ErrorCode& ec);

Ends rendering the current object.

The object renderer of the current 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 there is currently no nested object that is being rendered.

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


beginArray

void beginArray(const KeyDesc& key);
void beginArray(const KeyDesc& key, ErrorCode& ec);

Begins rendering an array.

The values of the array must be rendered with a new array renderer (an ArrayRenderer instance) constructed from this renderer.

Each call to this method must be paired with a call to endArray.

Parameters

const KeyDesc& key The description of the key of the nested array.

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

Errors

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


endArray

Ends rendering the current array.

The array renderer of the current array, 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 there is currently no nested array that is being rendered.

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


renderMember

void renderMember(const KeyDesc& key, const ValueDesc& value);
void renderMember(const KeyDesc& key, const ValueDesc& value, ErrorCode& ec);

Renders a key-value pair.

Parameters

const KeyDesc& key The description of the key.

const ValueDesc& value The description of the value.

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

Errors

An InvalidOperation fault occurs if there is currently a nested object or array being 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 there is currently a nested object or array 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 there is currently a nested object or array 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 there is currently a nested object or array 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 there is currently a nested object or array being rendered.


operator RendererHandle

operator RendererHandle();

Returns a handle to this renderer.

Return value

RendererHandle Handle to this renderer.