Build a StreamWriter implementation.
更多...
#include <writer.h>
Build a StreamWriter implementation.
Usage:
using namespace Json;
builder["commentStyle"] = "None";
builder["indentation"] = " ";
std::unique_ptr<nim_cpp_wrapper_util::Json::StreamWriter> writer(
writer->write(value, &std::cout);
std::cout << std::endl;
Build a StreamWriter implementation.
Definition: writer.h:89
StreamWriter * newStreamWriter() const override
Definition: json_writer.cpp:1175
Represents a JSON value.
Definition: value.h:196
◆ StreamWriterBuilder()
nim_cpp_wrapper_util::Json::StreamWriterBuilder::StreamWriterBuilder |
( |
| ) |
|
◆ ~StreamWriterBuilder()
nim_cpp_wrapper_util::Json::StreamWriterBuilder::~StreamWriterBuilder |
( |
| ) |
|
|
overridedefault |
◆ newStreamWriter()
StreamWriter * nim_cpp_wrapper_util::Json::StreamWriterBuilder::newStreamWriter |
( |
| ) |
const |
|
overridevirtual |
◆ operator[]()
Value & nim_cpp_wrapper_util::Json::StreamWriterBuilder::operator[] |
( |
const String & |
key | ) |
|
A simple way to update a specific setting.
◆ setDefaults()
Called by ctor, but you can use this to reset settings_.
- 前置条件
- 'settings' != NULL (but nim_cpp_wrapper_util::Json::null is fine)
[StreamWriterBuilderDefaults]
[StreamWriterBuilderDefaults]
◆ validate()
- 返回
- true if 'settings' are legal and consistent; otherwise, indicate bad settings via 'invalid'.
◆ settings_
Configuration of this builder. Available settings (case-sensitive):
- "commentStyle": "None" or "All"
- "indentation": "<anything>".
- Setting this to an empty string also omits newline characters.
- "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".
- "precision": int
- Number of precision digits for formatting of real values.
- "precisionType": "significant"(default) or "decimal"
- Type of precision for formatting of real values.
You can examine 'settings_` yourself to see the defaults. You can also write and read them just like any JSON Value.
- 参见
- setDefaults()
该类的文档由以下文件生成:
- D:/GitLab/builds/5sbaxrcd/0/nim-pc/california/nim-cross-platform-sdk/exports/wrapper/nim_wrapper_util/json/writer.h
- D:/GitLab/builds/5sbaxrcd/0/nim-pc/california/nim-cross-platform-sdk/exports/wrapper/nim_wrapper_util/json_writer.cpp