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 @@ -153,13 +153,6 @@ class JSON_API FastWriter : public Writer {
153
153
154
154
void enableYAMLCompatibility ();
155
155
156
- /* * \brief Drop the "null" string from the writer's output for nullValues.
157
- * Strictly speaking, this is not valid JSON. But when the output is being
158
- * fed to a browser's Javascript, it makes for smaller output and the
159
- * browser can handle the output just fine.
160
- */
161
- void dropNullPlaceholders ();
162
-
163
156
public: // overridden from Writer
164
157
virtual std::string write (const Value& root);
165
158
@@ -168,7 +161,6 @@ class JSON_API FastWriter : public Writer {
168
161
169
162
std::string document_;
170
163
bool yamlCompatiblityEnabled_;
171
- bool dropNullPlaceholders_;
172
164
};
173
165
174
166
/* * \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 @@ -192,12 +192,10 @@ Writer::~Writer() {}
192
192
// //////////////////////////////////////////////////////////////////
193
193
194
194
FastWriter::FastWriter ()
195
- : yamlCompatiblityEnabled_(false ), dropNullPlaceholders_( false ) {}
195
+ : yamlCompatiblityEnabled_(false ) {}
196
196
197
197
void FastWriter::enableYAMLCompatibility () { yamlCompatiblityEnabled_ = true ; }
198
198
199
- void FastWriter::dropNullPlaceholders () { dropNullPlaceholders_ = true ; }
200
-
201
199
std::string FastWriter::write (const Value& root) {
202
200
document_ = " " ;
203
201
writeValue (root);
@@ -208,8 +206,7 @@ std::string FastWriter::write(const Value& root) {
208
206
void FastWriter::writeValue (const Value& value) {
209
207
switch (value.type ()) {
210
208
case nullValue:
211
- if (!dropNullPlaceholders_)
212
- document_ += " null" ;
209
+ document_ += " null" ;
213
210
break ;
214
211
case intValue:
215
212
document_ += valueToString (value.asLargestInt ());
Original file line number Diff line number Diff line change @@ -1497,17 +1497,6 @@ JSONTEST_FIXTURE(ValueTest, typeChecksThrowExceptions) {
1497
1497
#endif
1498
1498
}
1499
1499
1500
- struct WriterTest : JsonTest::TestCase {};
1501
-
1502
- JSONTEST_FIXTURE (WriterTest, dropNullPlaceholders) {
1503
- Json::FastWriter writer;
1504
- Json::Value nullValue;
1505
- JSONTEST_ASSERT (writer.write (nullValue) == " null\n " );
1506
-
1507
- writer.dropNullPlaceholders ();
1508
- JSONTEST_ASSERT (writer.write (nullValue) == " \n " );
1509
- }
1510
-
1511
1500
struct StreamWriterTest : JsonTest::TestCase {};
1512
1501
1513
1502
JSONTEST_FIXTURE (StreamWriterTest, dropNullPlaceholders) {
@@ -1841,7 +1830,6 @@ int main(int argc, const char* argv[]) {
1841
1830
JSONTEST_REGISTER_FIXTURE (runner, ValueTest, compareType);
1842
1831
JSONTEST_REGISTER_FIXTURE (runner, ValueTest, typeChecksThrowExceptions);
1843
1832
1844
- JSONTEST_REGISTER_FIXTURE (runner, WriterTest, dropNullPlaceholders);
1845
1833
JSONTEST_REGISTER_FIXTURE (runner, StreamWriterTest, dropNullPlaceholders);
1846
1834
1847
1835
JSONTEST_REGISTER_FIXTURE (runner, ReaderTest, parseWithNoErrors);
You can’t perform that action at this time.
0 commit comments