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

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

Issue 2600753002: Reverts third_party/protobuf: Update to HEAD (f52e188fe4) (Closed)
Patch Set: Created 3 years, 12 months 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 namespace protobuf { 55 namespace protobuf {
56 namespace compiler { 56 namespace compiler {
57 namespace cpp { 57 namespace cpp {
58 58
59 // Helper function: set variables in the map that are the same for all 59 // Helper function: set variables in the map that are the same for all
60 // field code generators. 60 // field code generators.
61 // ['name', 'index', 'number', 'classname', 'declared_type', 'tag_size', 61 // ['name', 'index', 'number', 'classname', 'declared_type', 'tag_size',
62 // 'deprecation']. 62 // 'deprecation'].
63 void SetCommonFieldVariables(const FieldDescriptor* descriptor, 63 void SetCommonFieldVariables(const FieldDescriptor* descriptor,
64 std::map<string, string>* variables, 64 map<string, string>* variables,
65 const Options& options); 65 const Options& options);
66 66
67 void SetCommonOneofFieldVariables(const FieldDescriptor* descriptor, 67 void SetCommonOneofFieldVariables(const FieldDescriptor* descriptor,
68 std::map<string, string>* variables); 68 map<string, string>* variables);
69 69
70 class FieldGenerator { 70 class FieldGenerator {
71 public: 71 public:
72 explicit FieldGenerator(const Options& options) : options_(options) {} 72 explicit FieldGenerator(const Options& options) : options_(options) {}
73 virtual ~FieldGenerator(); 73 virtual ~FieldGenerator();
74 74
75 // Generate lines of code declaring members fields of the message class 75 // Generate lines of code declaring members fields of the message class
76 // needed to represent this field. These are placed inside the message 76 // needed to represent this field. These are placed inside the message
77 // class. 77 // class.
78 virtual void GeneratePrivateMembers(io::Printer* printer) const = 0; 78 virtual void GeneratePrivateMembers(io::Printer* printer) const = 0;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 virtual void GenerateInlineAccessorDefinitions( 117 virtual void GenerateInlineAccessorDefinitions(
118 io::Printer* printer, bool is_inline) const = 0; 118 io::Printer* printer, bool is_inline) const = 0;
119 119
120 // Generate definitions of accessors that aren't inlined. These are 120 // Generate definitions of accessors that aren't inlined. These are
121 // placed somewhere in the .cc file. 121 // placed somewhere in the .cc file.
122 // Most field types don't need this, so the default implementation is empty. 122 // Most field types don't need this, so the default implementation is empty.
123 virtual void GenerateNonInlineAccessorDefinitions( 123 virtual void GenerateNonInlineAccessorDefinitions(
124 io::Printer* /*printer*/) const {} 124 io::Printer* /*printer*/) const {}
125 125
126 // Generate lines of code (statements, not declarations) which clear the 126 // Generate lines of code (statements, not declarations) which clear the
127 // field. This is used to define the clear_$name$() method 127 // field. This is used to define the clear_$name$() method as well as
128 // the Clear() method for the whole message.
128 virtual void GenerateClearingCode(io::Printer* printer) const = 0; 129 virtual void GenerateClearingCode(io::Printer* printer) const = 0;
129 130
130 // Generate lines of code (statements, not declarations) which clear the field
131 // as part of the Clear() method for the whole message. For message types
132 // which have field presence bits, MessageGenerator::GenerateClear will have
133 // already checked the presence bits.
134 //
135 // Since most field types can re-use GenerateClearingCode, this method is not
136 // pure virtual.
137 virtual void GenerateMessageClearingCode(io::Printer* printer) const {
138 GenerateClearingCode(printer);
139 }
140
141 // Generate lines of code (statements, not declarations) which merges the 131 // Generate lines of code (statements, not declarations) which merges the
142 // contents of the field from the current message to the target message, 132 // contents of the field from the current message to the target message,
143 // which is stored in the generated code variable "from". 133 // which is stored in the generated code variable "from".
144 // This is used to fill in the MergeFrom method for the whole message. 134 // This is used to fill in the MergeFrom method for the whole message.
145 // Details of this usage can be found in message.cc under the 135 // Details of this usage can be found in message.cc under the
146 // GenerateMergeFrom method. 136 // GenerateMergeFrom method.
147 virtual void GenerateMergingCode(io::Printer* printer) const = 0; 137 virtual void GenerateMergingCode(io::Printer* printer) const = 0;
148 138
149 // Generates a copy constructor
150 virtual void GenerateCopyConstructorCode(io::Printer* printer) const = 0;
151
152 // Generate lines of code (statements, not declarations) which swaps 139 // Generate lines of code (statements, not declarations) which swaps
153 // this field and the corresponding field of another message, which 140 // this field and the corresponding field of another message, which
154 // is stored in the generated code variable "other". This is used to 141 // is stored in the generated code variable "other". This is used to
155 // define the Swap method. Details of usage can be found in 142 // define the Swap method. Details of usage can be found in
156 // message.cc under the GenerateSwap method. 143 // message.cc under the GenerateSwap method.
157 virtual void GenerateSwappingCode(io::Printer* printer) const = 0; 144 virtual void GenerateSwappingCode(io::Printer* printer) const = 0;
158 145
159 // Generate initialization code for private members declared by 146 // Generate initialization code for private members declared by
160 // GeneratePrivateMembers(). These go into the message class's SharedCtor() 147 // GeneratePrivateMembers(). These go into the message class's SharedCtor()
161 // method, invoked by each of the generated constructors. 148 // method, invoked by each of the generated constructors.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap); 220 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap);
234 }; 221 };
235 222
236 223
237 } // namespace cpp 224 } // namespace cpp
238 } // namespace compiler 225 } // namespace compiler
239 } // namespace protobuf 226 } // namespace protobuf
240 227
241 } // namespace google 228 } // namespace google
242 #endif // GOOGLE_PROTOBUF_COMPILER_CPP_FIELD_H__ 229 #endif // GOOGLE_PROTOBUF_COMPILER_CPP_FIELD_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698