Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: third_party/protobuf/src/google/protobuf/text_format.h

Issue 2590803003: Revert "third_party/protobuf: Update to HEAD (83d681ee2c)" (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // output stream. 68 // output stream.
69 static bool Print(const Message& message, io::ZeroCopyOutputStream* output); 69 static bool Print(const Message& message, io::ZeroCopyOutputStream* output);
70 70
71 // Print the fields in an UnknownFieldSet. They are printed by tag number 71 // Print the fields in an UnknownFieldSet. They are printed by tag number
72 // only. Embedded messages are heuristically identified by attempting to 72 // only. Embedded messages are heuristically identified by attempting to
73 // parse them. 73 // parse them.
74 static bool PrintUnknownFields(const UnknownFieldSet& unknown_fields, 74 static bool PrintUnknownFields(const UnknownFieldSet& unknown_fields,
75 io::ZeroCopyOutputStream* output); 75 io::ZeroCopyOutputStream* output);
76 76
77 // Like Print(), but outputs directly to a string. 77 // Like Print(), but outputs directly to a string.
78 // Note: output will be cleared before prior to printing, and will
79 // be left empty even if printing fails.
80 static bool PrintToString(const Message& message, string* output); 78 static bool PrintToString(const Message& message, string* output);
81 79
82 // Like PrintUnknownFields(), but outputs directly to a string. 80 // Like PrintUnknownFields(), but outputs directly to a string.
83 static bool PrintUnknownFieldsToString(const UnknownFieldSet& unknown_fields, 81 static bool PrintUnknownFieldsToString(const UnknownFieldSet& unknown_fields,
84 string* output); 82 string* output);
85 83
86 // Outputs a textual representation of the value of the field supplied on 84 // Outputs a textual representation of the value of the field supplied on
87 // the message supplied. For non-repeated fields, an index of -1 must 85 // the message supplied. For non-repeated fields, an index of -1 must
88 // be supplied. Note that this method will print the default value for a 86 // be supplied. Note that this method will print the default value for a
89 // field if it is not set. 87 // field if it is not set.
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 294
297 bool hide_unknown_fields_; 295 bool hide_unknown_fields_;
298 296
299 bool print_message_fields_in_index_order_; 297 bool print_message_fields_in_index_order_;
300 298
301 bool expand_any_; 299 bool expand_any_;
302 300
303 int64 truncate_string_field_longer_than_; 301 int64 truncate_string_field_longer_than_;
304 302
305 google::protobuf::scoped_ptr<const FieldValuePrinter> default_field_value_pr inter_; 303 google::protobuf::scoped_ptr<const FieldValuePrinter> default_field_value_pr inter_;
306 typedef std::map<const FieldDescriptor*, 304 typedef map<const FieldDescriptor*,
307 const FieldValuePrinter*> CustomPrinterMap; 305 const FieldValuePrinter*> CustomPrinterMap;
308 CustomPrinterMap custom_printers_; 306 CustomPrinterMap custom_printers_;
309 }; 307 };
310 308
311 // Parses a text-format protocol message from the given input stream to 309 // Parses a text-format protocol message from the given input stream to
312 // the given message object. This function parses the human-readable format 310 // the given message object. This function parses the human-readable format
313 // written by Print(). Returns true on success. The message is cleared first, 311 // written by Print(). Returns true on success. The message is cleared first,
314 // even if the function fails -- See Merge() to avoid this behavior. 312 // even if the function fails -- See Merge() to avoid this behavior.
315 // 313 //
316 // Example input: "user {\n id: 123 extra { gender: MALE language: 'en' }\n}" 314 // Example input: "user {\n id: 123 extra { gender: MALE language: 'en' }\n}"
317 // 315 //
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 // Allow the text format parser to record information into the tree. 384 // Allow the text format parser to record information into the tree.
387 friend class TextFormat; 385 friend class TextFormat;
388 386
389 // Records the starting location of a single value for a field. 387 // Records the starting location of a single value for a field.
390 void RecordLocation(const FieldDescriptor* field, ParseLocation location); 388 void RecordLocation(const FieldDescriptor* field, ParseLocation location);
391 389
392 // Create and records a nested tree for a nested message field. 390 // Create and records a nested tree for a nested message field.
393 ParseInfoTree* CreateNested(const FieldDescriptor* field); 391 ParseInfoTree* CreateNested(const FieldDescriptor* field);
394 392
395 // Defines the map from the index-th field descriptor to its parse location. 393 // Defines the map from the index-th field descriptor to its parse location.
396 typedef std::map<const FieldDescriptor*, 394 typedef map<const FieldDescriptor*, vector<ParseLocation> > LocationMap;
397 std::vector<ParseLocation> > LocationMap;
398 395
399 // Defines the map from the index-th field descriptor to the nested parse 396 // Defines the map from the index-th field descriptor to the nested parse
400 // info tree. 397 // info tree.
401 typedef std::map<const FieldDescriptor*, 398 typedef map<const FieldDescriptor*, vector<ParseInfoTree*> > NestedMap;
402 std::vector<ParseInfoTree*> > NestedMap;
403 399
404 LocationMap locations_; 400 LocationMap locations_;
405 NestedMap nested_; 401 NestedMap nested_;
406 402
407 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ParseInfoTree); 403 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ParseInfoTree);
408 }; 404 };
409 405
410 // For more control over parsing, use this class. 406 // For more control over parsing, use this class.
411 class LIBPROTOBUF_EXPORT Parser { 407 class LIBPROTOBUF_EXPORT Parser {
412 public: 408 public:
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 508
513 inline TextFormat::ParseInfoTree* TextFormat::CreateNested( 509 inline TextFormat::ParseInfoTree* TextFormat::CreateNested(
514 ParseInfoTree* info_tree, const FieldDescriptor* field) { 510 ParseInfoTree* info_tree, const FieldDescriptor* field) {
515 return info_tree->CreateNested(field); 511 return info_tree->CreateNested(field);
516 } 512 }
517 513
518 } // namespace protobuf 514 } // namespace protobuf
519 515
520 } // namespace google 516 } // namespace google
521 #endif // GOOGLE_PROTOBUF_TEXT_FORMAT_H__ 517 #endif // GOOGLE_PROTOBUF_TEXT_FORMAT_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698