Skip to content

Update writer.h #669

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion include/json/writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@ class JSONCPP_DEPRECATED("Use StreamWriter instead") JSON_API Writer {
* \sa Reader, Value
* \deprecated Use StreamWriterBuilder.
*/
#pragma warning(push)
#pragma warning(disable:4996) // Deriving from deprecated class
class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API FastWriter : public Writer {

public:
FastWriter();
~FastWriter() JSONCPP_OVERRIDE {}
Expand All @@ -184,6 +185,7 @@ class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API FastWriter
bool dropNullPlaceholders_;
bool omitEndingLineFeed_;
};
#pragma warning(pop)

/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a
*human friendly way.
Expand All @@ -209,6 +211,8 @@ class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API FastWriter
* \sa Reader, Value, Value::setComment()
* \deprecated Use StreamWriterBuilder.
*/
#pragma warning(push)
#pragma warning(disable:4996) // Deriving from deprecated class
class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API StyledWriter : public Writer {
public:
StyledWriter();
Expand Down Expand Up @@ -244,6 +248,7 @@ class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API StyledWrite
unsigned int indentSize_;
bool addChildValues_;
};
#pragma warning(pop)

/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a
human friendly way,
Expand All @@ -270,6 +275,8 @@ class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API StyledWrite
* \sa Reader, Value, Value::setComment()
* \deprecated Use StreamWriterBuilder.
*/
#pragma warning(push)
#pragma warning(disable:4996) // Deriving from deprecated class
Copy link
Contributor

@lanzkron lanzkron Sep 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't actually think that disabling the deprecation warnings on this class is necessary. They were added to StyledWriter and FastWriter since both those classes derived from Writer which is deprecated (and thus considered by VS to be using Writer). StyledStreamWriter is itself deprecated (same as Writer) and doesn't use a deprecated class.

I know I referred to the stackoverflow comment but I didn't examine the class it referred to. Now I think it's in error. (Although I don't think it's harmful either, I can't really tell since I'm not at my dev machine).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I'll remove the push/pop for StyledStreamWriter. Thanks for following up.

class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API StyledStreamWriter {
public:
/**
Expand Down Expand Up @@ -311,6 +318,7 @@ class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API StyledStrea
bool addChildValues_ : 1;
bool indented_ : 1;
};
#pragma warning(pop)

#if defined(JSON_HAS_INT64)
JSONCPP_STRING JSON_API valueToString(Int value);
Expand Down