aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/text_format.h
diff options
context:
space:
mode:
authorJisi Liu <jisi.liu@gmail.com>2015-02-28 14:51:22 -0800
committerJisi Liu <jisi.liu@gmail.com>2015-02-28 17:06:49 -0800
commit885b612f74f133678bf82808c589331e4c59dad9 (patch)
treee5f3f65b41af477c52810053b8694896c8bcd1f7 /src/google/protobuf/text_format.h
parent1939efed2db35020b7830a4927f10feac47b6757 (diff)
downloadprotobuf-885b612f74f133678bf82808c589331e4c59dad9.tar.gz
protobuf-885b612f74f133678bf82808c589331e4c59dad9.tar.bz2
protobuf-885b612f74f133678bf82808c589331e4c59dad9.zip
Down integrate from Google internal branch for C++ and Java.
- Maps for C++ lite - C++ Arena optimizations. - Java Lite runtime code size optimization. Change-Id: I7537a4357c1cb385d23f9e8aa7ffdfeefe079f13
Diffstat (limited to 'src/google/protobuf/text_format.h')
-rw-r--r--src/google/protobuf/text_format.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/google/protobuf/text_format.h b/src/google/protobuf/text_format.h
index 44d68cab..9e2cb070 100644
--- a/src/google/protobuf/text_format.h
+++ b/src/google/protobuf/text_format.h
@@ -278,8 +278,20 @@ class LIBPROTOBUF_EXPORT TextFormat {
};
// Parses a text-format protocol message from the given input stream to
- // the given message object. This function parses the format written
- // by Print().
+ // the given message object. This function parses the human-readable format
+ // written by Print(). Returns true on success. The message is cleared first,
+ // even if the function fails -- See Merge() to avoid this behavior.
+ //
+ // 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()
+ // (or ShortDebugString()), because these functions output using
+ // google::protobuf::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().
static bool Parse(io::ZeroCopyInputStream* input, Message* output);
// Like Parse(), but reads directly from a string.
static bool ParseFromString(const string& input, Message* output);