aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/util/internal/protostream_objectwriter.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/util/internal/protostream_objectwriter.h')
-rw-r--r--src/google/protobuf/util/internal/protostream_objectwriter.h33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/google/protobuf/util/internal/protostream_objectwriter.h b/src/google/protobuf/util/internal/protostream_objectwriter.h
index df56a8bd..fe8170d1 100644
--- a/src/google/protobuf/util/internal/protostream_objectwriter.h
+++ b/src/google/protobuf/util/internal/protostream_objectwriter.h
@@ -49,6 +49,8 @@
#include <google/protobuf/stubs/bytestream.h>
#include <google/protobuf/stubs/hash.h>
+#include <google/protobuf/port_def.inc>
+
namespace google {
namespace protobuf {
namespace io {
@@ -76,7 +78,7 @@ class ObjectLocationTracker;
// the ProtoWriter class to write raw proto bytes.
//
// It also supports streaming.
-class LIBPROTOBUF_EXPORT ProtoStreamObjectWriter : public ProtoWriter {
+class PROTOBUF_EXPORT ProtoStreamObjectWriter : public ProtoWriter {
public:
// Options that control ProtoStreamObjectWriter class's behavior.
struct Options {
@@ -91,9 +93,13 @@ class LIBPROTOBUF_EXPORT ProtoStreamObjectWriter : public ProtoWriter {
bool struct_integers_as_strings;
// Not treat unknown fields as an error. If there is an unknown fields,
- // just ignore it and continue to process the rest.
+ // just ignore it and continue to process the rest. Note that this doesn't
+ // apply to unknown enum values.
bool ignore_unknown_fields;
+ // Ignore unknown enum values.
+ 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;
@@ -105,6 +111,7 @@ class LIBPROTOBUF_EXPORT ProtoStreamObjectWriter : public ProtoWriter {
Options()
: struct_integers_as_strings(false),
ignore_unknown_fields(false),
+ ignore_unknown_enum_values(false),
use_lower_camel_for_enums(false),
ignore_null_value_map_entry(false) {}
@@ -140,7 +147,7 @@ class LIBPROTOBUF_EXPORT ProtoStreamObjectWriter : public ProtoWriter {
const DataPiece&);
// Handles writing Anys out using nested object writers and the like.
- class LIBPROTOBUF_EXPORT AnyWriter {
+ class PROTOBUF_EXPORT AnyWriter {
public:
explicit AnyWriter(ProtoStreamObjectWriter* parent);
~AnyWriter();
@@ -165,7 +172,7 @@ class LIBPROTOBUF_EXPORT ProtoStreamObjectWriter : public ProtoWriter {
private:
// Before the "@type" field is encountered, we store all incoming data
// into this Event struct and replay them after we get the "@type" field.
- class LIBPROTOBUF_EXPORT Event {
+ class PROTOBUF_EXPORT Event {
public:
enum Type {
START_OBJECT = 0,
@@ -207,9 +214,9 @@ class LIBPROTOBUF_EXPORT ProtoStreamObjectWriter : public ProtoWriter {
void DeepCopy();
Type type_;
- string name_;
+ std::string name_;
DataPiece value_;
- string value_storage_;
+ std::string value_storage_;
};
// Handles starting up the any once we have a type.
@@ -226,14 +233,14 @@ class LIBPROTOBUF_EXPORT ProtoStreamObjectWriter : public ProtoWriter {
std::unique_ptr<ProtoStreamObjectWriter> ow_;
// The type_url_ that this Any represents.
- string type_url_;
+ std::string type_url_;
// Whether this any is invalid. This allows us to only report an invalid
// Any message a single time rather than every time we get a nested field.
bool invalid_;
// The output data and wrapping ByteSink.
- string data_;
+ std::string data_;
strings::StringByteSink output_;
// The depth within the Any, so we can track when we're done.
@@ -254,7 +261,7 @@ class LIBPROTOBUF_EXPORT ProtoStreamObjectWriter : public ProtoWriter {
// Represents an item in a stack of items used to keep state between
// ObjectWrier events.
- class LIBPROTOBUF_EXPORT Item : public BaseElement {
+ class PROTOBUF_EXPORT Item : public BaseElement {
public:
// Indicates the type of item.
enum ItemType {
@@ -306,7 +313,7 @@ class LIBPROTOBUF_EXPORT ProtoStreamObjectWriter : public ProtoWriter {
// Set of map keys already seen for the type_. Used to validate incoming
// messages so no map key appears more than once.
- std::unique_ptr<std::unordered_set<string> > map_keys_;
+ std::unique_ptr<std::unordered_set<std::string> > map_keys_;
// Conveys whether this Item is a placeholder or not. Placeholder items are
// pushed to stack to account for special types.
@@ -367,7 +374,7 @@ class LIBPROTOBUF_EXPORT ProtoStreamObjectWriter : public ProtoWriter {
static void InitRendererMap();
static void DeleteRendererMap();
- static TypeRenderer* FindTypeRenderer(const string& type_url);
+ static TypeRenderer* FindTypeRenderer(const std::string& type_url);
// Returns true if the map key for type_ is not duplicated key.
// If map key is duplicated key, this function returns false.
@@ -397,7 +404,7 @@ class LIBPROTOBUF_EXPORT ProtoStreamObjectWriter : public ProtoWriter {
private:
// Helper functions to create the map and find functions responsible for
// rendering well known types, keyed by type URL.
- static std::unordered_map<string, TypeRenderer>* renderers_;
+ static std::unordered_map<std::string, TypeRenderer>* renderers_;
// Variables for describing the structure of the input tree:
// master_type_: descriptor for the whole protobuf message.
@@ -417,4 +424,6 @@ class LIBPROTOBUF_EXPORT ProtoStreamObjectWriter : public ProtoWriter {
} // namespace protobuf
} // namespace google
+#include <google/protobuf/port_undef.inc>
+
#endif // GOOGLE_PROTOBUF_UTIL_CONVERTER_PROTOSTREAM_OBJECTWRITER_H__