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

Unified Diff: third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_field.h

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component 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 side-by-side diff with in-line comments
Download patch
Index: third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_field.h
diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_field.h b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_field.h
index 3b01252780da26393e0056c802f068bea1b7f044..00dc25d4cf5a5e26d441aff6b955b54f218eec10 100644
--- a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_field.h
+++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_field.h
@@ -61,11 +61,11 @@ namespace cpp {
// ['name', 'index', 'number', 'classname', 'declared_type', 'tag_size',
// 'deprecation'].
void SetCommonFieldVariables(const FieldDescriptor* descriptor,
- map<string, string>* variables,
+ std::map<string, string>* variables,
const Options& options);
void SetCommonOneofFieldVariables(const FieldDescriptor* descriptor,
- map<string, string>* variables);
+ std::map<string, string>* variables);
class FieldGenerator {
public:
@@ -124,10 +124,20 @@ class FieldGenerator {
io::Printer* /*printer*/) const {}
// Generate lines of code (statements, not declarations) which clear the
- // field. This is used to define the clear_$name$() method as well as
- // the Clear() method for the whole message.
+ // field. This is used to define the clear_$name$() method
virtual void GenerateClearingCode(io::Printer* printer) const = 0;
+ // Generate lines of code (statements, not declarations) which clear the field
+ // as part of the Clear() method for the whole message. For message types
+ // which have field presence bits, MessageGenerator::GenerateClear will have
+ // already checked the presence bits.
+ //
+ // Since most field types can re-use GenerateClearingCode, this method is not
+ // pure virtual.
+ virtual void GenerateMessageClearingCode(io::Printer* printer) const {
+ GenerateClearingCode(printer);
+ }
+
// Generate lines of code (statements, not declarations) which merges the
// contents of the field from the current message to the target message,
// which is stored in the generated code variable "from".
@@ -136,6 +146,9 @@ class FieldGenerator {
// GenerateMergeFrom method.
virtual void GenerateMergingCode(io::Printer* printer) const = 0;
+ // Generates a copy constructor
+ virtual void GenerateCopyConstructorCode(io::Printer* printer) const = 0;
+
// Generate lines of code (statements, not declarations) which swaps
// this field and the corresponding field of another message, which
// is stored in the generated code variable "other". This is used to

Powered by Google App Engine
This is Rietveld 408576698