diff options
author | temporal <temporal@630680e5-0e50-0410-840e-4b1c322b438d> | 2008-08-06 01:12:21 +0000 |
---|---|---|
committer | temporal <temporal@630680e5-0e50-0410-840e-4b1c322b438d> | 2008-08-06 01:12:21 +0000 |
commit | a0f27fcd96c5bf2509ca88cca54f00b78f7b8bc5 (patch) | |
tree | 6d44ab5739d6fc9b956e17eb13a6d34f71094109 /src/google/protobuf/text_format.h | |
parent | 8ccb79057ee477c36d155f2c507c859934f858dd (diff) | |
download | protobuf-a0f27fcd96c5bf2509ca88cca54f00b78f7b8bc5.tar.gz protobuf-a0f27fcd96c5bf2509ca88cca54f00b78f7b8bc5.tar.bz2 protobuf-a0f27fcd96c5bf2509ca88cca54f00b78f7b8bc5.zip |
Heuristically detect sub-messages when printing unknown fields.
Patch mostly written by Dilip Joseph <dilip.antony.joseph@gmail.com>.
Diffstat (limited to 'src/google/protobuf/text_format.h')
-rw-r--r-- | src/google/protobuf/text_format.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/google/protobuf/text_format.h b/src/google/protobuf/text_format.h index df27710d..00d50ad1 100644 --- a/src/google/protobuf/text_format.h +++ b/src/google/protobuf/text_format.h @@ -45,9 +45,20 @@ class LIBPROTOBUF_EXPORT TextFormat { // Outputs a textual representation of the given message to the given // output stream. static bool Print(const Message& message, io::ZeroCopyOutputStream* output); + + // Print the fields in an UnknownFieldSet. They are printed by tag number + // only. Embedded messages are heuristically identified by attempting to + // parse them. + static bool PrintUnknownFields(const UnknownFieldSet& unknown_fields, + io::ZeroCopyOutputStream* output); + // Like Print(), but outputs directly to a string. static bool PrintToString(const Message& message, string* output); + // Like PrintUnknownFields(), but outputs directly to a string. + static bool PrintUnknownFieldsToString(const UnknownFieldSet& unknown_fields, + string* output); + // Outputs a textual representation of the value of the field supplied on // the message supplied. For non-repeated fields, an index of -1 must // be supplied. Note that this method will print the default value for a @@ -130,7 +141,8 @@ class LIBPROTOBUF_EXPORT TextFormat { TextGenerator& generator); // Print the fields in an UnknownFieldSet. They are printed by tag number - // only. + // only. Embedded messages are heuristically identified by attempting to + // parse them. static void PrintUnknownFields(const UnknownFieldSet& unknown_fields, TextGenerator& generator); |