Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Json::StreamWriterBuilder Class Reference

Build a StreamWriter implementation. More...

#include <json.h>

Inheritance diagram for Json::StreamWriterBuilder:
Inheritance graph
[legend]

Public Member Functions

StreamWriternewStreamWriter () const override
 
StreamWriternewStreamWriter () const override
 
Valueoperator[] (std::string key)
 
Valueoperator[] (std::string key)
 
 StreamWriterBuilder ()
 
 StreamWriterBuilder ()
 
bool validate (Json::Value *invalid) const
 
bool validate (Json::Value *invalid) const
 
 ~StreamWriterBuilder () override
 
 ~StreamWriterBuilder () override
 
- Public Member Functions inherited from Json::StreamWriter::Factory
virtual ~Factory ()
 
virtual ~Factory ()
 

Static Public Member Functions

static void setDefaults (Json::Value *settings)
 
static void setDefaults (Json::Value *settings)
 

Public Attributes

Json::Value settings_
 

Detailed Description

Build a StreamWriter implementation.

Usage:

using namespace Json;
Value value = ...;
builder["commentStyle"] = "None";
builder["indentation"] = " "; // or whatever you like
std::unique_ptr<Json::StreamWriter> writer(
builder.newStreamWriter());
writer->write(value, &std::cout);
std::cout << std::endl; // add lf and flush

Definition at line 1753 of file third_party/bloaty/third_party/protobuf/conformance/third_party/jsoncpp/json.h.

Constructor & Destructor Documentation

◆ StreamWriterBuilder() [1/2]

Json::StreamWriterBuilder::StreamWriterBuilder ( )

◆ ~StreamWriterBuilder() [1/2]

Json::StreamWriterBuilder::~StreamWriterBuilder ( )
override

◆ StreamWriterBuilder() [2/2]

Json::StreamWriterBuilder::StreamWriterBuilder ( )

◆ ~StreamWriterBuilder() [2/2]

Json::StreamWriterBuilder::~StreamWriterBuilder ( )
override

Member Function Documentation

◆ newStreamWriter() [1/2]

StreamWriter * Json::StreamWriterBuilder::newStreamWriter ( ) const
overridevirtual
Exceptions
std::exceptionif something goes wrong (e.g. invalid settings)

Implements Json::StreamWriter::Factory.

Definition at line 5093 of file bloaty/third_party/protobuf/conformance/third_party/jsoncpp/jsoncpp.cpp.

◆ newStreamWriter() [2/2]

StreamWriter* Json::StreamWriterBuilder::newStreamWriter ( ) const
overridevirtual
Exceptions
std::exceptionif something goes wrong (e.g. invalid settings)

Implements Json::StreamWriter::Factory.

◆ operator[]() [1/2]

Value& Json::StreamWriterBuilder::operator[] ( std::string  key)

A simple way to update a specific setting.

◆ operator[]() [2/2]

Value & Json::StreamWriterBuilder::operator[] ( std::string  key)

A simple way to update a specific setting.

Definition at line 5152 of file bloaty/third_party/protobuf/conformance/third_party/jsoncpp/jsoncpp.cpp.

◆ setDefaults() [1/2]

void Json::StreamWriterBuilder::setDefaults ( Json::Value settings)
static

Called by ctor, but you can use this to reset settings_.

Precondition
'settings' != NULL (but Json::null is fine)
Remarks
Defaults:

[StreamWriterBuilderDefaults]

[StreamWriterBuilderDefaults]

[StreamWriterBuilderDefaults]

[StreamWriterBuilderDefaults]

Definition at line 5157 of file bloaty/third_party/protobuf/conformance/third_party/jsoncpp/jsoncpp.cpp.

◆ setDefaults() [2/2]

static void Json::StreamWriterBuilder::setDefaults ( Json::Value settings)
static

Called by ctor, but you can use this to reset settings_.

Precondition
'settings' != NULL (but Json::null is fine)
Remarks
Defaults:

◆ validate() [1/2]

bool Json::StreamWriterBuilder::validate ( Json::Value invalid) const
Returns
true if 'settings' are legal and consistent; otherwise, indicate bad settings via 'invalid'.

◆ validate() [2/2]

bool Json::StreamWriterBuilder::validate ( Json::Value invalid) const
Returns
true if 'settings' are legal and consistent; otherwise, indicate bad settings via 'invalid'.

Definition at line 5135 of file bloaty/third_party/protobuf/conformance/third_party/jsoncpp/jsoncpp.cpp.

Member Data Documentation

◆ settings_

Json::Value Json::StreamWriterBuilder::settings_

Configuration of this builder. Available settings (case-sensitive):

  • "commentStyle": "None" or "All"
  • "indentation": "<anything>"
  • "enableYAMLCompatibility": false or true
    • slightly change the whitespace around colons
  • "dropNullPlaceholders": false or true
    • Drop the "null" string from the writer's output for nullValues. Strictly speaking, this is not valid JSON. But when the output is being fed to a browser's Javascript, it makes for smaller output and the browser can handle the output just fine.
  • "useSpecialFloats": false or true
    • If true, outputs non-finite floating point values in the following way: NaN values as "NaN", positive infinity as "Infinity", and negative infinity as "-Infinity".

You can examine 'settings_` yourself to see the defaults. You can also write and read them just like any JSON Value.

See also
setDefaults()

Definition at line 1778 of file third_party/bloaty/third_party/protobuf/conformance/third_party/jsoncpp/json.h.


The documentation for this class was generated from the following files:
Json::StreamWriterBuilder
Build a StreamWriter implementation.
Definition: third_party/bloaty/third_party/protobuf/conformance/third_party/jsoncpp/json.h:1753
profile_analyzer.builder
builder
Definition: profile_analyzer.py:159
Json
JSON (JavaScript Object Notation).
Definition: third_party/bloaty/third_party/protobuf/conformance/third_party/jsoncpp/json.h:227
writer
void writer(void *n)
Definition: libuv/docs/code/locks/main.c:22
value
const char * value
Definition: hpack_parser_table.cc:165
Json::Value
Represents a JSON value.
Definition: third_party/bloaty/third_party/protobuf/conformance/third_party/jsoncpp/json.h:547


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:40