OLD | NEW |
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 Loading... |
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 AddPublicMemberAttributes(printer); | 74 AddDeprecatedFlag(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 Loading... |
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 AddPublicMemberAttributes(printer); | 177 AddDeprecatedFlag(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 Loading... |
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 |
OLD | NEW |