xrpld
Loading...
Searching...
No Matches
json::Compact Class Reference

Decorator for streaming out compact json. More...

#include <json_writer.h>

Collaboration diagram for json::Compact:

Public Member Functions

 Compact (json::Value &&jv)
 Wrap a json::Value for compact streaming.

Private Attributes

json::Value jv_

Friends

std::ostreamoperator<< (std::ostream &o, Compact const &cJv)

Detailed Description

Decorator for streaming out compact json.

Use

json::Value jv;
out << json::Compact{jv}

to write a single-line, compact version of jv to the stream, rather than the styled format that comes from undecorated streaming.

Definition at line 289 of file json_writer.h.

Constructor & Destructor Documentation

◆ Compact()

json::Compact::Compact ( json::Value && jv)

Wrap a json::Value for compact streaming.

Parameters
jvThe json::Value to stream
Note
For now, we do not support wrapping lvalues to avoid potentially costly copies. If we find a need, we can consider adding support for compact lvalue streaming in the future.

Definition at line 302 of file json_writer.h.

◆ operator<<

std::ostream & operator<< ( std::ostream & o,
Compact const & cJv )
friend

Definition at line 306 of file json_writer.h.

Member Data Documentation

◆ jv_

json::Value json::Compact::jv_
private

Definition at line 291 of file json_writer.h.