diff options
Diffstat (limited to 'src/google/protobuf/util/internal/proto_writer.h')
-rw-r--r-- | src/google/protobuf/util/internal/proto_writer.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/google/protobuf/util/internal/proto_writer.h b/src/google/protobuf/util/internal/proto_writer.h index 11761096..1a8df982 100644 --- a/src/google/protobuf/util/internal/proto_writer.h +++ b/src/google/protobuf/util/internal/proto_writer.h @@ -48,6 +48,8 @@ #include <google/protobuf/stubs/hash.h> #include <google/protobuf/stubs/status.h> +#include <google/protobuf/port_def.inc> + namespace google { namespace protobuf { namespace io { @@ -76,7 +78,7 @@ class ObjectLocationTracker; // special types by inheriting from it or by wrapping it. // // It also supports streaming. -class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter { +class PROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter { public: // Constructor. Does not take ownership of any parameter passed in. ProtoWriter(TypeResolver* type_resolver, const google::protobuf::Type& type, @@ -152,12 +154,17 @@ class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter { ignore_unknown_fields_ = ignore_unknown_fields; } + void set_ignore_unknown_enum_values(bool ignore_unknown_enum_values) { + ignore_unknown_enum_values_ = ignore_unknown_enum_values; + } + void set_use_lower_camel_for_enums(bool use_lower_camel_for_enums) { use_lower_camel_for_enums_ = use_lower_camel_for_enums; } protected: - class LIBPROTOBUF_EXPORT ProtoElement : public BaseElement, public LocationTrackerInterface { + class PROTOBUF_EXPORT ProtoElement : public BaseElement, + public LocationTrackerInterface { public: // Constructor for the root element. No parent nor field. ProtoElement(const TypeInfo* typeinfo, const google::protobuf::Type& type, @@ -187,7 +194,7 @@ class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter { void RegisterField(const google::protobuf::Field* field); // To report location on error messages. - string ToString() const override; + std::string ToString() const override; ProtoElement* parent() const override { return static_cast<ProtoElement*>(BaseElement::parent()); @@ -321,9 +328,12 @@ class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter { // Indicates whether we finished writing root message completely. bool done_; - // If true, don't report unknown field names and enum values to the listener. + // If true, don't report unknown field names to the listener. bool ignore_unknown_fields_; + // If true, don't report unknown enum values to the listener. + bool ignore_unknown_enum_values_; + // If true, check if enum name in camel case or without underscore matches the // field name. bool use_lower_camel_for_enums_; @@ -342,7 +352,7 @@ class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter { // adapter_ : internal adapter between CodedOutputStream and buffer_. // stream_ : wrapper for writing tags and other encodings in wire format. strings::ByteSink* output_; - string buffer_; + std::string buffer_; io::StringOutputStream adapter_; std::unique_ptr<io::CodedOutputStream> stream_; @@ -362,4 +372,6 @@ class LIBPROTOBUF_EXPORT ProtoWriter : public StructuredObjectWriter { } // namespace protobuf } // namespace google +#include <google/protobuf/port_undef.inc> + #endif // GOOGLE_PROTOBUF_UTIL_CONVERTER_PROTO_WRITER_H__ |