JsonStreamer#

Fully qualified name: omni::structuredlog::JsonStreamer

Defined in omni/structuredlog/JsonSerializer.h

template<typename OutputIt>
class JsonStreamer : public omni::structuredlog::JsonConsumer#

An implementation of JsonConsumer that just prints to an iterator.

Public Functions

JsonStreamer() = default#

Default constructor.

inline JsonStreamer(OutputIt output)#

Create a streamer from an output iterator.

Parameters:

output[in] The output iterator to write to.

inline void reset(OutputIt output) noexcept#

Reinitialize the printer with a new iterator.

Parameters:

output[in] The output iterator to write to.

inline virtual void consume(
const char *json,
size_t jsonLen,
) noexcept override#

Write a string into the buffer.

Parameters:
  • json[in] The data to write into the buffer.

  • jsonLen[in] The length of json, excluding any null terminator.

inline virtual void terminate() noexcept override#

Terminate the output, if needed.

Remark

This will be called to ensure the output is null terminated.

inline size_t charsWritten() noexcept#

Get the number of characters written.

Returns:

The number of characters written.

inline OutputIt getIterator() noexcept#

Get the iterator.

Note

The returned iterator may be invalidated if this class is used further.

Returns:

The iterator.