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 {
153153
154154 void enableYAMLCompatibility ();
155155
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-
163156public: // overridden from Writer
164157 virtual std::string write (const Value& root);
165158
@@ -168,7 +161,6 @@ class JSON_API FastWriter : public Writer {
168161
169162 std::string document_;
170163 bool yamlCompatiblityEnabled_;
171- bool dropNullPlaceholders_;
172164};
173165
174166/* * \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() {}
192192// //////////////////////////////////////////////////////////////////
193193
194194FastWriter::FastWriter ()
195- : yamlCompatiblityEnabled_(false ), dropNullPlaceholders_( false ) {}
195+ : yamlCompatiblityEnabled_(false ) {}
196196
197197void FastWriter::enableYAMLCompatibility () { yamlCompatiblityEnabled_ = true ; }
198198
199- void FastWriter::dropNullPlaceholders () { dropNullPlaceholders_ = true ; }
200-
201199std::string FastWriter::write (const Value& root) {
202200 document_ = " " ;
203201 writeValue (root);
@@ -208,8 +206,7 @@ std::string FastWriter::write(const Value& root) {
208206void FastWriter::writeValue (const Value& value) {
209207 switch (value.type ()) {
210208 case nullValue:
211- if (!dropNullPlaceholders_)
212- document_ += " null" ;
209+ document_ += " null" ;
213210 break ;
214211 case intValue:
215212 document_ += valueToString (value.asLargestInt ());
Original file line number Diff line number Diff line change @@ -1497,17 +1497,6 @@ JSONTEST_FIXTURE(ValueTest, typeChecksThrowExceptions) {
14971497#endif
14981498}
14991499
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-
15111500struct StreamWriterTest : JsonTest::TestCase {};
15121501
15131502JSONTEST_FIXTURE (StreamWriterTest, dropNullPlaceholders) {
@@ -1719,7 +1708,6 @@ int main(int argc, const char* argv[]) {
17191708 JSONTEST_REGISTER_FIXTURE (runner, CharReaderTest, parseWithDetailError);
17201709 JSONTEST_REGISTER_FIXTURE (runner, CharReaderTest, parseWithStackLimit);
17211710
1722- JSONTEST_REGISTER_FIXTURE (runner, WriterTest, dropNullPlaceholders);
17231711 JSONTEST_REGISTER_FIXTURE (runner, StreamWriterTest, dropNullPlaceholders);
17241712
17251713 return runner.runCommandLine (argc, argv);
You can’t perform that action at this time.
0 commit comments