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

Side by Side Diff: third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc

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 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 65
66 void PrimitiveFieldGenerator::GenerateMembers(io::Printer* printer) { 66 void PrimitiveFieldGenerator::GenerateMembers(io::Printer* printer) {
67 // TODO(jonskeet): Work out whether we want to prevent the fields from ever be ing 67 // TODO(jonskeet): Work out whether we want to prevent the fields from ever be ing
68 // null, or whether we just handle it, in the cases of bytes and string. 68 // null, or whether we just handle it, in the cases of bytes and string.
69 // (Basically, should null-handling code be in the getter or the setter?) 69 // (Basically, should null-handling code be in the getter or the setter?)
70 printer->Print( 70 printer->Print(
71 variables_, 71 variables_,
72 "private $type_name$ $name_def_message$;\n"); 72 "private $type_name$ $name_def_message$;\n");
73 WritePropertyDocComment(printer, descriptor_); 73 WritePropertyDocComment(printer, descriptor_);
74 AddDeprecatedFlag(printer); 74 AddPublicMemberAttributes(printer);
75 printer->Print( 75 printer->Print(
76 variables_, 76 variables_,
77 "$access_level$ $type_name$ $property_name$ {\n" 77 "$access_level$ $type_name$ $property_name$ {\n"
78 " get { return $name$_; }\n" 78 " get { return $name$_; }\n"
79 " set {\n"); 79 " set {\n");
80 if (is_value_type) { 80 if (is_value_type) {
81 printer->Print( 81 printer->Print(
82 variables_, 82 variables_,
83 " $name$_ = value;\n"); 83 " $name$_ = value;\n");
84 } else { 84 } else {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 const FieldDescriptor* descriptor, int fieldOrdinal, const Options *options) 167 const FieldDescriptor* descriptor, int fieldOrdinal, const Options *options)
168 : PrimitiveFieldGenerator(descriptor, fieldOrdinal, options) { 168 : PrimitiveFieldGenerator(descriptor, fieldOrdinal, options) {
169 SetCommonOneofFieldVariables(&variables_); 169 SetCommonOneofFieldVariables(&variables_);
170 } 170 }
171 171
172 PrimitiveOneofFieldGenerator::~PrimitiveOneofFieldGenerator() { 172 PrimitiveOneofFieldGenerator::~PrimitiveOneofFieldGenerator() {
173 } 173 }
174 174
175 void PrimitiveOneofFieldGenerator::GenerateMembers(io::Printer* printer) { 175 void PrimitiveOneofFieldGenerator::GenerateMembers(io::Printer* printer) {
176 WritePropertyDocComment(printer, descriptor_); 176 WritePropertyDocComment(printer, descriptor_);
177 AddDeprecatedFlag(printer); 177 AddPublicMemberAttributes(printer);
178 printer->Print( 178 printer->Print(
179 variables_, 179 variables_,
180 "$access_level$ $type_name$ $property_name$ {\n" 180 "$access_level$ $type_name$ $property_name$ {\n"
181 " get { return $has_property_check$ ? ($type_name$) $oneof_name$_ : $defaul t_value$; }\n" 181 " get { return $has_property_check$ ? ($type_name$) $oneof_name$_ : $defaul t_value$; }\n"
182 " set {\n"); 182 " set {\n");
183 if (is_value_type) { 183 if (is_value_type) {
184 printer->Print( 184 printer->Print(
185 variables_, 185 variables_,
186 " $oneof_name$_ = value;\n"); 186 " $oneof_name$_ = value;\n");
187 } else { 187 } else {
(...skipping 21 matching lines...) Expand all
209 209
210 void PrimitiveOneofFieldGenerator::GenerateCloningCode(io::Printer* printer) { 210 void PrimitiveOneofFieldGenerator::GenerateCloningCode(io::Printer* printer) {
211 printer->Print(variables_, 211 printer->Print(variables_,
212 "$property_name$ = other.$property_name$;\n"); 212 "$property_name$ = other.$property_name$;\n");
213 } 213 }
214 214
215 } // namespace csharp 215 } // namespace csharp
216 } // namespace compiler 216 } // namespace compiler
217 } // namespace protobuf 217 } // namespace protobuf
218 } // namespace google 218 } // namespace google
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698