Usage:
using namespace Json; Value value = ...; StreamWriterBuilder builder; builder.settings_["commentStyle"] = "None"; builder.settings_["indentation"] = " "; // or whatever you like std::unique_ptr<JB_Json::StreamWriter> writer( builder.newStreamWriter()); writer->write(value, &std::cout); std::cout << std::endl; // add lf and flush
Public Member Functions | ||||
StreamWriterBuilder () | ||||
virtual | ~StreamWriterBuilder () | |||
virtual StreamWriter * | newStreamWriter () const | |||
| ||||
bool | validate (JB_Json::Value *invalid) const | |||
| ||||
Static Public Member Functions | ||||
static void | setDefaults (JB_Json::Value *settings) | |||
Called by ctor, but you can use this to reset settings_. | ||||
Public Attributes | ||||
JB_Json::Value | settings_ | |||
Configuration of this builder. |
~StreamWriterBuilder | ( | ) | [virtual] |
StreamWriter * newStreamWriter | ( | ) | const [virtual] |
std::exception | if something goes wrong (e.g. |
invalid settings)
Implements StreamWriter::Factory.
bool validate | ( | JB_Json::Value * | invalid | ) | const |
void setDefaults | ( | JB_Json::Value * | settings | ) | [static] |
Called by ctor, but you can use this to reset settings_.
[StreamWriterBuilderDefaults]
[StreamWriterBuilderDefaults]
Configuration of this builder.
Available settings (case-sensitive):
You can examine 'settings_` yourself to see the defaults. You can also write and read them just like any JSON Value.