Skip to content

Commit 7796f20

Browse files
committed
Merge pull request open-source-parsers#165 from cdunn2001/master
Remove some experimental classes that are not needed for 1.4.0. This also helps 0.8.0 binary compatibility with 0.6.0-rc2.
2 parents 04a607d + 20d0967 commit 7796f20

File tree

5 files changed

+953
-79
lines changed

5 files changed

+953
-79
lines changed

include/json/value.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ class JSON_API Value {
133133
typedef Json::LargestUInt LargestUInt;
134134
typedef Json::ArrayIndex ArrayIndex;
135135

136-
static const Value& null;
136+
static const Value& null; ///! We regret this reference to a global instance; prefer the simpler Value().
137+
static const Value& nullRef; ///! just a kludge for binary-compatibility; same as null
137138
/// Minimum signed integer value that can be stored in a Json::Value.
138139
static const LargestInt minLargestInt;
139140
/// Maximum signed integer value that can be stored in a Json::Value.

include/json/writer.h

Lines changed: 9 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,15 @@ class JSON_API StreamWriterBuilder : public StreamWriter::Factory {
9090
// without a major version bump.
9191
/** Configuration of this builder.
9292
Available settings (case-sensitive):
93-
- "commentStyle": "None", "Some", or "All"
93+
- "commentStyle": "None" or "All"
9494
- "indentation": "<anything>"
95+
- "enableYAMLCompatibility": False or True
96+
- slightly change the whitespace around colons
97+
- "dropNullPlaceholders": False or True
98+
- Drop the "null" string from the writer's output for nullValues.
99+
Strictly speaking, this is not valid JSON. But when the output is being
100+
fed to a browser's Javascript, it makes for smaller output and the
101+
browser can handle the output just fine.
95102
96103
You can examine 'settings_` yourself
97104
to see the defaults. You can also write and read them just like any
@@ -120,54 +127,6 @@ class JSON_API StreamWriterBuilder : public StreamWriter::Factory {
120127
static void setDefaults(Json::Value* settings);
121128
};
122129

123-
/** \brief Build a StreamWriter implementation.
124-
* Comments are not written, and most whitespace is omitted.
125-
* In addition, there are some special settings to allow compatibility
126-
* with the old FastWriter.
127-
* Usage:
128-
* \code
129-
* OldCompressingStreamWriterBuilder b;
130-
* b.dropNullPlaceHolders_ = true; // etc.
131-
* StreamWriter* w = b.newStreamWriter();
132-
* w->write(value, &std::cout);
133-
* delete w;
134-
* \endcode
135-
*
136-
* \deprecated Use StreamWriterBuilder
137-
*/
138-
class JSON_API OldCompressingStreamWriterBuilder : public StreamWriter::Factory
139-
{
140-
public:
141-
// Note: We cannot add data-members to this class without a major version bump.
142-
// So these might as well be completely exposed.
143-
144-
/** \brief Drop the "null" string from the writer's output for nullValues.
145-
* Strictly speaking, this is not valid JSON. But when the output is being
146-
* fed to a browser's Javascript, it makes for smaller output and the
147-
* browser can handle the output just fine.
148-
*/
149-
bool dropNullPlaceholders_;
150-
/** \brief Do not add \n at end of document.
151-
* Normally, we add an extra newline, just because.
152-
*/
153-
bool omitEndingLineFeed_;
154-
/** \brief Add a space after ':'.
155-
* If indentation is non-empty, we surround colon with whitespace,
156-
* e.g. " : "
157-
* This will add back the trailing space when there is no indentation.
158-
* This seems dubious when the entire document is on a single line,
159-
* but we leave this here to repduce the behavior of the old `FastWriter`.
160-
*/
161-
bool enableYAMLCompatibility_;
162-
163-
OldCompressingStreamWriterBuilder()
164-
: dropNullPlaceholders_(false)
165-
, omitEndingLineFeed_(false)
166-
, enableYAMLCompatibility_(false)
167-
{}
168-
virtual StreamWriter* newStreamWriter() const;
169-
};
170-
171130
/** \brief Abstract class for writers.
172131
* \deprecated Use StreamWriter.
173132
*/
@@ -185,7 +144,7 @@ class JSON_API Writer {
185144
*consumption,
186145
* but may be usefull to support feature such as RPC where bandwith is limited.
187146
* \sa Reader, Value
188-
* \deprecated Use OldCompressingStreamWriterBuilder.
147+
* \deprecated Use StreamWriterBuilder.
189148
*/
190149
class JSON_API FastWriter : public Writer {
191150
public:

0 commit comments

Comments
 (0)