@@ -27,30 +27,30 @@ namespace Json {
27
27
class Value ;
28
28
29
29
/* *
30
-
31
- Usage:
32
- \code
33
- using namespace Json;
34
- void writeToStdout(StreamWriter::Factory const& factory, Value const& value) {
35
- std::unique_ptr<StreamWriter> const writer(
36
- factory.newStreamWriter());
37
- writer->write(value, &std::cout);
38
- std::cout << std::endl; // add lf and flush
39
- }
40
- \endcode
30
+ *
31
+ * Usage:
32
+ * \code
33
+ * using namespace Json;
34
+ * void writeToStdout(StreamWriter::Factory const& factory, Value const& value) {
35
+ * std::unique_ptr<StreamWriter> const writer(
36
+ * factory.newStreamWriter());
37
+ * writer->write(value, &std::cout);
38
+ * std::cout << std::endl; // add lf and flush
39
+ * }
40
+ * \endcode
41
41
*/
42
42
class JSON_API StreamWriter {
43
43
protected:
44
44
OStream* sout_; // not owned; will not delete
45
45
public:
46
46
StreamWriter ();
47
47
virtual ~StreamWriter ();
48
- /* * Write Value into document as configured in sub-class.
49
- Do not take ownership of sout, but maintain a reference during function.
50
- \pre sout != NULL
51
- \return zero on success (For now, we always return zero, so check the
52
- stream instead.) \throw std::exception possibly, depending on configuration
53
- */
48
+ /* * Write Value into document as configured in sub-class.
49
+ * Do not take ownership of sout, but maintain a reference during function.
50
+ * \pre sout != NULL
51
+ * \return zero on success (For now, we always return zero, so check the
52
+ * stream instead.) \throw std::exception possibly, depending on configuration
53
+ */
54
54
virtual int write (Value const & root, OStream* sout) = 0;
55
55
56
56
/* * \brief A simple abstract factory.
@@ -73,49 +73,49 @@ String JSON_API writeString(StreamWriter::Factory const& factory,
73
73
74
74
/* * \brief Build a StreamWriter implementation.
75
75
76
- Usage:
77
- \code
78
- using namespace Json;
79
- Value value = ...;
80
- StreamWriterBuilder builder;
81
- builder["commentStyle"] = "None";
82
- builder["indentation"] = " "; // or whatever you like
83
- std::unique_ptr<Json::StreamWriter> writer(
84
- builder.newStreamWriter());
85
- writer->write(value, &std::cout);
86
- std::cout << std::endl; // add lf and flush
87
- \endcode
76
+ * Usage:
77
+ * \code
78
+ * using namespace Json;
79
+ * Value value = ...;
80
+ * StreamWriterBuilder builder;
81
+ * builder["commentStyle"] = "None";
82
+ * builder["indentation"] = " "; // or whatever you like
83
+ * std::unique_ptr<Json::StreamWriter> writer(
84
+ * builder.newStreamWriter());
85
+ * writer->write(value, &std::cout);
86
+ * std::cout << std::endl; // add lf and flush
87
+ * \endcode
88
88
*/
89
89
class JSON_API StreamWriterBuilder : public StreamWriter::Factory {
90
90
public:
91
91
// Note: We use a Json::Value so that we can add data-members to this class
92
92
// without a major version bump.
93
93
/* * Configuration of this builder.
94
- Available settings (case-sensitive):
95
- - "commentStyle": "None" or "All"
96
- - "indentation": "<anything>".
97
- - Setting this to an empty string also omits newline characters.
98
- - "enableYAMLCompatibility": false or true
99
- - slightly change the whitespace around colons
100
- - "dropNullPlaceholders": false or true
101
- - Drop the "null" string from the writer's output for nullValues.
102
- Strictly speaking, this is not valid JSON. But when the output is being
103
- fed to a browser's JavaScript, it makes for smaller output and the
104
- browser can handle the output just fine.
105
- - "useSpecialFloats": false or true
106
- - If true, outputs non-finite floating point values in the following way:
107
- NaN values as "NaN", positive infinity as "Infinity", and negative
108
- infinity as "-Infinity".
109
- - "precision": int
110
- - Number of precision digits for formatting of real values.
111
- - "precisionType": "significant"(default) or "decimal"
112
- - Type of precision for formatting of real values.
113
-
114
- You can examine 'settings_` yourself
115
- to see the defaults. You can also write and read them just like any
116
- JSON Value.
117
- \sa setDefaults()
118
- */
94
+ * Available settings (case-sensitive):
95
+ * - "commentStyle": "None" or "All"
96
+ * - "indentation": "<anything>".
97
+ * - Setting this to an empty string also omits newline characters.
98
+ * - "enableYAMLCompatibility": false or true
99
+ * - slightly change the whitespace around colons
100
+ * - "dropNullPlaceholders": false or true
101
+ * - Drop the "null" string from the writer's output for nullValues.
102
+ * Strictly speaking, this is not valid JSON. But when the output is being
103
+ * fed to a browser's JavaScript, it makes for smaller output and the
104
+ * browser can handle the output just fine.
105
+ * - "useSpecialFloats": false or true
106
+ * - If true, outputs non-finite floating point values in the following way:
107
+ * NaN values as "NaN", positive infinity as "Infinity", and negative
108
+ * infinity as "-Infinity".
109
+ * - "precision": int
110
+ * - Number of precision digits for formatting of real values.
111
+ * - "precisionType": "significant"(default) or "decimal"
112
+ * - Type of precision for formatting of real values.
113
+
114
+ * You can examine 'settings_` yourself
115
+ * to see the defaults. You can also write and read them just like any
116
+ * JSON Value.
117
+ * \sa setDefaults()
118
+ */
119
119
Json::Value settings_;
120
120
121
121
StreamWriterBuilder ();
0 commit comments