Skip to content

Commit 20d0967

Browse files
committed
drop experimental OldCompressingStreamWriterBuilder
1 parent 5a74470 commit 20d0967

File tree

2 files changed

+1
-70
lines changed

2 files changed

+1
-70
lines changed

include/json/writer.h

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -127,54 +127,6 @@ class JSON_API StreamWriterBuilder : public StreamWriter::Factory {
127127
static void setDefaults(Json::Value* settings);
128128
};
129129

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

src/lib_json/json_writer.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,27 +1035,6 @@ void StreamWriterBuilder::setDefaults(Json::Value* settings)
10351035
//! [StreamWriterBuilderDefaults]
10361036
}
10371037

1038-
StreamWriter* OldCompressingStreamWriterBuilder::newStreamWriter() const
1039-
{
1040-
std::string colonSymbol = " : ";
1041-
if (enableYAMLCompatibility_) {
1042-
colonSymbol = ": ";
1043-
} else {
1044-
colonSymbol = ":";
1045-
}
1046-
std::string nullSymbol = "null";
1047-
if (dropNullPlaceholders_) {
1048-
nullSymbol = "";
1049-
}
1050-
std::string endingLineFeedSymbol = "\n";
1051-
if (omitEndingLineFeed_) {
1052-
endingLineFeedSymbol = "";
1053-
}
1054-
return new BuiltStyledStreamWriter(
1055-
"", CommentStyle::None,
1056-
colonSymbol, nullSymbol, endingLineFeedSymbol);
1057-
}
1058-
10591038
std::string writeString(StreamWriter::Factory const& builder, Value const& root) {
10601039
std::ostringstream sout;
10611040
StreamWriterPtr const writer(builder.newStreamWriter());

0 commit comments

Comments
 (0)