omni::structuredlog::JsonConsumer
Defined in omni/structuredlog/JsonSerializer.h
-
class JsonConsumer
An interface for consuming the output JSON from the JsonSerializer.
Subclassed by omni::structuredlog::JsonLengthCounter, omni::structuredlog::JsonPrinter
Public Functions
-
inline virtual ~JsonConsumer()
-
virtual void consume(const char *json, size_t jsonLen) noexcept = 0
The function that will consume strings of JSON.
Remark
This will be called when the JsonSerializer wants to write something to the output. The JsonSerializer will write very small units of text to this function, so the implementation should plan accordingly.
- Parameters
json – [in] The string of JSON. This string’s lifetime ends after the return from this call.
jsonLen – [in] The length of
json
, excluding the null terminator. The null terminator will be included in the length when the final call to this writes out a null terminator. It is possible this may be 0 in some edge cases. It’s possible thatjsonLen
may be used to refer to a substring ofjson
.
-
virtual void terminate() noexcept = 0
Terminate the output, if needed.
Remark
This will be called to ensure the output is null terminated.
-
inline virtual ~JsonConsumer()