File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ class JSON_API Writer {
29
29
public:
30
30
virtual ~Writer ();
31
31
32
- virtual std::string write (const Value& root) = 0;
32
+ virtual const std::string& write (const Value& root) = 0;
33
33
};
34
34
35
35
/* * \brief Outputs a Value in <a HREF="http://www.json.org">JSON</a> format
@@ -57,7 +57,7 @@ class JSON_API FastWriter : public Writer {
57
57
void omitEndingLineFeed ();
58
58
59
59
public: // overridden from Writer
60
- virtual std::string write (const Value& root);
60
+ virtual const std::string& write (const Value& root);
61
61
62
62
private:
63
63
void writeValue (const Value& value);
@@ -101,7 +101,7 @@ class JSON_API StyledWriter : public Writer {
101
101
* \param root Value to serialize.
102
102
* \return String containing the JSON document that represents the root value.
103
103
*/
104
- virtual std::string write (const Value& root);
104
+ virtual const std::string& write (const Value& root);
105
105
106
106
private:
107
107
void writeValue (const Value& value);
Original file line number Diff line number Diff line change @@ -187,8 +187,8 @@ void FastWriter::dropNullPlaceholders() { dropNullPlaceholders_ = true; }
187
187
188
188
void FastWriter::omitEndingLineFeed () { omitEndingLineFeed_ = true ; }
189
189
190
- std::string FastWriter::write (const Value& root) {
191
- document_ = " " ;
190
+ const std::string& FastWriter::write (const Value& root) {
191
+ document_. clear () ;
192
192
writeValue (root);
193
193
if (!omitEndingLineFeed_)
194
194
document_ += " \n " ;
@@ -249,8 +249,8 @@ void FastWriter::writeValue(const Value& value) {
249
249
StyledWriter::StyledWriter ()
250
250
: rightMargin_(74 ), indentSize_(3 ), addChildValues_() {}
251
251
252
- std::string StyledWriter::write (const Value& root) {
253
- document_ = " " ;
252
+ const std::string& StyledWriter::write (const Value& root) {
253
+ document_. clear () ;
254
254
addChildValues_ = false ;
255
255
indentString_ = " " ;
256
256
writeCommentBeforeValue (root);
You can’t perform that action at this time.
0 commit comments