JSONCPP_OSTREAM

This commit is contained in:
Christopher Dunn 2016-03-06 11:47:35 -06:00
parent de5b792168
commit 724ba29bd3
2 changed files with 9 additions and 9 deletions

View File

@ -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<std::string> 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

View File

@ -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);