aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/text_format.h
diff options
context:
space:
mode:
authorFeng Xiao <xfxyjwf@gmail.com>2018-08-08 17:00:41 -0700
committerFeng Xiao <xfxyjwf@gmail.com>2018-08-08 17:00:41 -0700
commit6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3 (patch)
treee575738adf52d24b883cca5e8928a5ded31caba1 /src/google/protobuf/text_format.h
parente7746f487cb9cca685ffb1b3d7dccc5554b618a4 (diff)
downloadprotobuf-6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3.tar.gz
protobuf-6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3.tar.bz2
protobuf-6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3.zip
Down-integrate from google3.
Diffstat (limited to 'src/google/protobuf/text_format.h')
-rw-r--r--src/google/protobuf/text_format.h29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/google/protobuf/text_format.h b/src/google/protobuf/text_format.h
index d6f3e16b..cb9f90a7 100644
--- a/src/google/protobuf/text_format.h
+++ b/src/google/protobuf/text_format.h
@@ -47,6 +47,13 @@
#include <google/protobuf/descriptor.h>
#include <google/protobuf/message.h>
#include <google/protobuf/message_lite.h>
+#include <google/protobuf/port.h>
+
+#include <google/protobuf/port_def.inc>
+
+#ifdef SWIG
+#error "You cannot SWIG proto headers"
+#endif
namespace google {
namespace protobuf {
@@ -149,8 +156,8 @@ class LIBPROTOBUF_EXPORT TextFormat {
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FastFieldValuePrinter);
};
- class LIBPROTOBUF_EXPORT PROTOBUF_RUNTIME_DEPRECATED("Please use FastFieldValuePrinter")
- FieldValuePrinter {
+ class LIBPROTOBUF_EXPORT GOOGLE_PROTOBUF_DEPRECATED_MSG(
+ "Please use FastFieldValuePrinter") FieldValuePrinter {
public:
FieldValuePrinter();
virtual ~FieldValuePrinter();
@@ -423,13 +430,13 @@ class LIBPROTOBUF_EXPORT TextFormat {
// Example input: "user {\n id: 123 extra { gender: MALE language: 'en' }\n}"
//
// One use for this function is parsing handwritten strings in test code.
- // Another use is to parse the output from google::protobuf::Message::DebugString()
+ // Another use is to parse the output from proto2::Message::DebugString()
// (or ShortDebugString()), because these functions output using
- // google::protobuf::TextFormat::Print().
+ // proto2::TextFormat::Print().
//
// If you would like to read a protocol buffer serialized in the
// (non-human-readable) binary wire format, see
- // google::protobuf::MessageLite::ParseFromString().
+ // proto2::MessageLite::ParseFromString().
static bool Parse(io::ZeroCopyInputStream* input, Message* output);
// Like Parse(), but reads directly from a string.
static bool ParseFromString(const string& input, Message* output);
@@ -553,6 +560,13 @@ class LIBPROTOBUF_EXPORT TextFormat {
const FieldDescriptor* field,
Message* output);
+ // When an unknown extension is met, parsing will fail if this option is set
+ // to false (the default). If true, unknown extensions will be ignored and
+ // a warning message will be generated.
+ void AllowUnknownExtension(bool allow) {
+ allow_unknown_extension_ = allow;
+ }
+
void AllowFieldNumber(bool allow) {
allow_field_number_ = allow;
@@ -575,6 +589,7 @@ class LIBPROTOBUF_EXPORT TextFormat {
bool allow_partial_;
bool allow_case_insensitive_field_;
bool allow_unknown_field_;
+ bool allow_unknown_extension_;
bool allow_unknown_enum_;
bool allow_field_number_;
bool allow_relaxed_whitespace_;
@@ -609,6 +624,8 @@ inline TextFormat::ParseInfoTree* TextFormat::CreateNested(
}
} // namespace protobuf
-
} // namespace google
+
+#include <google/protobuf/port_undef.inc>
+
#endif // GOOGLE_PROTOBUF_TEXT_FORMAT_H__