Skip to content

Commit abcd3f7

Browse files
dota17baylesj
authored andcommitted
Modify code comments in write.h (open-source-parsers#987)
* modify code comments in write.h * update
1 parent d622250 commit abcd3f7

File tree

1 file changed

+54
-54
lines changed

1 file changed

+54
-54
lines changed

include/json/writer.h

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,30 @@ namespace Json {
2727
class Value;
2828

2929
/**
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
4141
*/
4242
class JSON_API StreamWriter {
4343
protected:
4444
OStream* sout_; // not owned; will not delete
4545
public:
4646
StreamWriter();
4747
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+
*/
5454
virtual int write(Value const& root, OStream* sout) = 0;
5555

5656
/** \brief A simple abstract factory.
@@ -73,49 +73,49 @@ String JSON_API writeString(StreamWriter::Factory const& factory,
7373

7474
/** \brief Build a StreamWriter implementation.
7575
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
8888
*/
8989
class JSON_API StreamWriterBuilder : public StreamWriter::Factory {
9090
public:
9191
// Note: We use a Json::Value so that we can add data-members to this class
9292
// without a major version bump.
9393
/** 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+
*/
119119
Json::Value settings_;
120120

121121
StreamWriterBuilder();

0 commit comments

Comments
 (0)