File tree Expand file tree Collapse file tree 3 files changed +2
-25
lines changed Expand file tree Collapse file tree 3 files changed +2
-25
lines changed Original file line number Diff line number Diff line change @@ -158,13 +158,6 @@ class JSON_API FastWriter : public Writer {
158
158
159
159
void enableYAMLCompatibility ();
160
160
161
- /* * \brief Drop the "null" string from the writer's output for nullValues.
162
- * Strictly speaking, this is not valid JSON. But when the output is being
163
- * fed to a browser's Javascript, it makes for smaller output and the
164
- * browser can handle the output just fine.
165
- */
166
- void dropNullPlaceholders ();
167
-
168
161
public: // overridden from Writer
169
162
virtual std::string write (const Value& root);
170
163
@@ -173,7 +166,6 @@ class JSON_API FastWriter : public Writer {
173
166
174
167
std::string document_;
175
168
bool yamlCompatiblityEnabled_;
176
- bool dropNullPlaceholders_;
177
169
};
178
170
179
171
/* * \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a
Original file line number Diff line number Diff line change @@ -279,12 +279,10 @@ Writer::~Writer() {}
279
279
// //////////////////////////////////////////////////////////////////
280
280
281
281
FastWriter::FastWriter ()
282
- : yamlCompatiblityEnabled_(false ), dropNullPlaceholders_( false ) {}
282
+ : yamlCompatiblityEnabled_(false ) {}
283
283
284
284
void FastWriter::enableYAMLCompatibility () { yamlCompatiblityEnabled_ = true ; }
285
285
286
- void FastWriter::dropNullPlaceholders () { dropNullPlaceholders_ = true ; }
287
-
288
286
std::string FastWriter::write (const Value& root) {
289
287
document_ = " " ;
290
288
writeValue (root);
@@ -295,8 +293,7 @@ std::string FastWriter::write(const Value& root) {
295
293
void FastWriter::writeValue (const Value& value) {
296
294
switch (value.type ()) {
297
295
case nullValue:
298
- if (!dropNullPlaceholders_)
299
- document_ += " null" ;
296
+ document_ += " null" ;
300
297
break ;
301
298
case intValue:
302
299
document_ += valueToString (value.asLargestInt ());
Original file line number Diff line number Diff line change @@ -1618,17 +1618,6 @@ JSONTEST_FIXTURE(ValueTest, zeroesInKeys) {
1618
1618
}
1619
1619
}
1620
1620
1621
- struct WriterTest : JsonTest::TestCase {};
1622
-
1623
- JSONTEST_FIXTURE (WriterTest, dropNullPlaceholders) {
1624
- Json::FastWriter writer;
1625
- Json::Value nullValue;
1626
- JSONTEST_ASSERT (writer.write (nullValue) == " null\n " );
1627
-
1628
- writer.dropNullPlaceholders ();
1629
- JSONTEST_ASSERT (writer.write (nullValue) == " \n " );
1630
- }
1631
-
1632
1621
struct StreamWriterTest : JsonTest::TestCase {};
1633
1622
1634
1623
JSONTEST_FIXTURE (StreamWriterTest, dropNullPlaceholders) {
@@ -2286,7 +2275,6 @@ int main(int argc, const char* argv[]) {
2286
2275
JSONTEST_REGISTER_FIXTURE (runner, ValueTest, zeroes);
2287
2276
JSONTEST_REGISTER_FIXTURE (runner, ValueTest, zeroesInKeys);
2288
2277
2289
- JSONTEST_REGISTER_FIXTURE (runner, WriterTest, dropNullPlaceholders);
2290
2278
JSONTEST_REGISTER_FIXTURE (runner, StreamWriterTest, dropNullPlaceholders);
2291
2279
JSONTEST_REGISTER_FIXTURE (runner, StreamWriterTest, writeZeroes);
2292
2280
You can’t perform that action at this time.
0 commit comments