From 724ba29bd39bd8f4e6629082c5d710f103b1bf33 Mon Sep 17 00:00:00 2001 From: Christopher Dunn Date: Sun, 6 Mar 2016 11:47:35 -0600 Subject: [PATCH] JSONCPP_OSTREAM --- include/json/writer.h | 10 +++++----- src/lib_json/json_writer.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/json/writer.h b/include/json/writer.h index 49b1512..443b752 100644 --- a/include/json/writer.h +++ b/include/json/writer.h @@ -39,7 +39,7 @@ Usage: */ class JSON_API StreamWriter { protected: - std::ostream* sout_; // not owned; will not delete + JSONCPP_OSTREAM* sout_; // not owned; will not delete public: StreamWriter(); virtual ~StreamWriter(); @@ -49,7 +49,7 @@ public: \return zero on success (For now, we always return zero, so check the stream instead.) \throw std::exception possibly, depending on configuration */ - virtual int write(Value const& root, std::ostream* sout) = 0; + virtual int write(Value const& root, JSONCPP_OSTREAM* sout) = 0; /** \brief A simple abstract factory. */ @@ -281,7 +281,7 @@ public: * \note There is no point in deriving from Writer, since write() should not * return a value. */ - void write(std::ostream& out, const Value& root); + void write(JSONCPP_OSTREAM& out, const Value& root); private: void writeValue(const Value& value); @@ -300,7 +300,7 @@ private: typedef std::vector ChildValues; ChildValues childValues_; - std::ostream* document_; + JSONCPP_OSTREAM* document_; std::string indentString_; unsigned int rightMargin_; std::string indentation_; @@ -320,7 +320,7 @@ std::string JSON_API valueToQuotedString(const char* value); /// \brief Output using the StyledStreamWriter. /// \see Json::operator>>() -JSON_API std::ostream& operator<<(std::ostream&, const Value& root); +JSON_API JSONCPP_OSTREAM& operator<<(JSONCPP_OSTREAM&, const Value& root); } // namespace Json diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index 045dc44..5eed717 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -608,7 +608,7 @@ StyledStreamWriter::StyledStreamWriter(std::string indentation) : document_(NULL), rightMargin_(74), indentation_(indentation), addChildValues_() {} -void StyledStreamWriter::write(std::ostream& out, const Value& root) { +void StyledStreamWriter::write(JSONCPP_OSTREAM& out, const Value& root) { document_ = &out; addChildValues_ = false; indentString_ = ""; @@ -839,7 +839,7 @@ struct BuiltStyledStreamWriter : public StreamWriter std::string const& endingLineFeedSymbol, bool useSpecialFloats, unsigned int precision); - int write(Value const& root, std::ostream* sout) override; + int write(Value const& root, JSONCPP_OSTREAM* sout) override; private: void writeValue(Value const& value); void writeArrayValue(Value const& value); @@ -888,7 +888,7 @@ BuiltStyledStreamWriter::BuiltStyledStreamWriter( , precision_(precision) { } -int BuiltStyledStreamWriter::write(Value const& root, std::ostream* sout) +int BuiltStyledStreamWriter::write(Value const& root, JSONCPP_OSTREAM* sout) { sout_ = sout; addChildValues_ = false; @@ -1206,7 +1206,7 @@ std::string writeString(StreamWriter::Factory const& builder, Value const& root) return sout.str(); } -std::ostream& operator<<(std::ostream& sout, Value const& root) { +JSONCPP_OSTREAM& operator<<(JSONCPP_OSTREAM& sout, Value const& root) { StreamWriterBuilder builder; StreamWriterPtr const writer(builder.newStreamWriter()); writer->write(root, &sout);