| Index: third_party/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.h
|
| diff --git a/third_party/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.h b/third_party/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.h
|
| index 1d85bed85f8a4f9a5c522db1893867369aee340f..5f3b25f3785000346b27cd5228eb49cd22795d9b 100644
|
| --- a/third_party/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.h
|
| +++ b/third_party/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.h
|
| @@ -122,6 +122,10 @@ class LIBPROTOBUF_EXPORT DefaultValueObjectWriter : public ObjectWriter {
|
| // field_scrub_callback pointer is also transferred to this class
|
| void RegisterFieldScrubCallBack(FieldScrubCallBackPtr field_scrub_callback);
|
|
|
| + // If set to true, empty lists are suppressed from output when default values
|
| + // are written.
|
| + void set_suppress_empty_list(bool value) { suppress_empty_list_ = value; }
|
| +
|
| private:
|
| enum NodeKind {
|
| PRIMITIVE = 0,
|
| @@ -136,7 +140,7 @@ class LIBPROTOBUF_EXPORT DefaultValueObjectWriter : public ObjectWriter {
|
| public:
|
| Node(const string& name, const google::protobuf::Type* type, NodeKind kind,
|
| const DataPiece& data, bool is_placeholder, const vector<string>& path,
|
| - FieldScrubCallBack* field_scrub_callback);
|
| + bool suppress_empty_list, FieldScrubCallBack* field_scrub_callback);
|
| virtual ~Node() {
|
| for (int i = 0; i < children_.size(); ++i) {
|
| delete children_[i];
|
| @@ -212,6 +216,9 @@ class LIBPROTOBUF_EXPORT DefaultValueObjectWriter : public ObjectWriter {
|
| // Path of the field of this node
|
| std::vector<string> path_;
|
|
|
| + // Whether to suppress empty list output.
|
| + bool suppress_empty_list_;
|
| +
|
| // Pointer to function for determining whether a field needs to be scrubbed
|
| // or not. This callback is owned by the creator of this node.
|
| FieldScrubCallBack* field_scrub_callback_;
|
| @@ -257,6 +264,9 @@ class LIBPROTOBUF_EXPORT DefaultValueObjectWriter : public ObjectWriter {
|
| // The stack to hold the path of Nodes from current_ to root_;
|
| std::stack<Node*> stack_;
|
|
|
| + // Whether to suppress output of empty lists.
|
| + bool suppress_empty_list_;
|
| +
|
| // Unique Pointer to function for determining whether a field needs to be
|
| // scrubbed or not.
|
| FieldScrubCallBackPtr field_scrub_callback_;
|
|
|