Skip to content

Commit 724ba29

Browse files
committed
JSONCPP_OSTREAM
1 parent de5b792 commit 724ba29

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

include/json/writer.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Value;
3939
*/
4040
class JSON_API StreamWriter {
4141
protected:
42-
std::ostream* sout_; // not owned; will not delete
42+
JSONCPP_OSTREAM* sout_; // not owned; will not delete
4343
public:
4444
StreamWriter();
4545
virtual ~StreamWriter();
@@ -49,7 +49,7 @@ class JSON_API StreamWriter {
4949
\return zero on success (For now, we always return zero, so check the stream instead.)
5050
\throw std::exception possibly, depending on configuration
5151
*/
52-
virtual int write(Value const& root, std::ostream* sout) = 0;
52+
virtual int write(Value const& root, JSONCPP_OSTREAM* sout) = 0;
5353

5454
/** \brief A simple abstract factory.
5555
*/
@@ -281,7 +281,7 @@ class JSON_API StyledStreamWriter {
281281
* \note There is no point in deriving from Writer, since write() should not
282282
* return a value.
283283
*/
284-
void write(std::ostream& out, const Value& root);
284+
void write(JSONCPP_OSTREAM& out, const Value& root);
285285

286286
private:
287287
void writeValue(const Value& value);
@@ -300,7 +300,7 @@ class JSON_API StyledStreamWriter {
300300
typedef std::vector<std::string> ChildValues;
301301

302302
ChildValues childValues_;
303-
std::ostream* document_;
303+
JSONCPP_OSTREAM* document_;
304304
std::string indentString_;
305305
unsigned int rightMargin_;
306306
std::string indentation_;
@@ -320,7 +320,7 @@ std::string JSON_API valueToQuotedString(const char* value);
320320

321321
/// \brief Output using the StyledStreamWriter.
322322
/// \see Json::operator>>()
323-
JSON_API std::ostream& operator<<(std::ostream&, const Value& root);
323+
JSON_API JSONCPP_OSTREAM& operator<<(JSONCPP_OSTREAM&, const Value& root);
324324

325325
} // namespace Json
326326

src/lib_json/json_writer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ StyledStreamWriter::StyledStreamWriter(std::string indentation)
608608
: document_(NULL), rightMargin_(74), indentation_(indentation),
609609
addChildValues_() {}
610610

611-
void StyledStreamWriter::write(std::ostream& out, const Value& root) {
611+
void StyledStreamWriter::write(JSONCPP_OSTREAM& out, const Value& root) {
612612
document_ = &out;
613613
addChildValues_ = false;
614614
indentString_ = "";
@@ -839,7 +839,7 @@ struct BuiltStyledStreamWriter : public StreamWriter
839839
std::string const& endingLineFeedSymbol,
840840
bool useSpecialFloats,
841841
unsigned int precision);
842-
int write(Value const& root, std::ostream* sout) override;
842+
int write(Value const& root, JSONCPP_OSTREAM* sout) override;
843843
private:
844844
void writeValue(Value const& value);
845845
void writeArrayValue(Value const& value);
@@ -888,7 +888,7 @@ BuiltStyledStreamWriter::BuiltStyledStreamWriter(
888888
, precision_(precision)
889889
{
890890
}
891-
int BuiltStyledStreamWriter::write(Value const& root, std::ostream* sout)
891+
int BuiltStyledStreamWriter::write(Value const& root, JSONCPP_OSTREAM* sout)
892892
{
893893
sout_ = sout;
894894
addChildValues_ = false;
@@ -1206,7 +1206,7 @@ std::string writeString(StreamWriter::Factory const& builder, Value const& root)
12061206
return sout.str();
12071207
}
12081208

1209-
std::ostream& operator<<(std::ostream& sout, Value const& root) {
1209+
JSONCPP_OSTREAM& operator<<(JSONCPP_OSTREAM& sout, Value const& root) {
12101210
StreamWriterBuilder builder;
12111211
StreamWriterPtr const writer(builder.newStreamWriter());
12121212
writer->write(root, &sout);

0 commit comments

Comments
 (0)