| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 void WrapperFieldGenerator::GenerateMembers(io::Printer* printer) { | 66 void WrapperFieldGenerator::GenerateMembers(io::Printer* printer) { |
| 67 printer->Print( | 67 printer->Print( |
| 68 variables_, | 68 variables_, |
| 69 "private static readonly pb::FieldCodec<$type_name$> _single_$name$_code
c = "); | 69 "private static readonly pb::FieldCodec<$type_name$> _single_$name$_code
c = "); |
| 70 GenerateCodecCode(printer); | 70 GenerateCodecCode(printer); |
| 71 printer->Print( | 71 printer->Print( |
| 72 variables_, | 72 variables_, |
| 73 ";\n" | 73 ";\n" |
| 74 "private $type_name$ $name$_;\n"); | 74 "private $type_name$ $name$_;\n"); |
| 75 WritePropertyDocComment(printer, descriptor_); | 75 WritePropertyDocComment(printer, descriptor_); |
| 76 AddPublicMemberAttributes(printer); | 76 AddDeprecatedFlag(printer); |
| 77 printer->Print( | 77 printer->Print( |
| 78 variables_, | 78 variables_, |
| 79 "$access_level$ $type_name$ $property_name$ {\n" | 79 "$access_level$ $type_name$ $property_name$ {\n" |
| 80 " get { return $name$_; }\n" | 80 " get { return $name$_; }\n" |
| 81 " set {\n" | 81 " set {\n" |
| 82 " $name$_ = value;\n" | 82 " $name$_ = value;\n" |
| 83 " }\n" | 83 " }\n" |
| 84 "}\n"); | 84 "}\n"); |
| 85 } | 85 } |
| 86 | 86 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 162 } |
| 163 | 163 |
| 164 void WrapperOneofFieldGenerator::GenerateMembers(io::Printer* printer) { | 164 void WrapperOneofFieldGenerator::GenerateMembers(io::Printer* printer) { |
| 165 // Note: deliberately _oneof_$name$_codec, not _$oneof_name$_codec... we have
one codec per field. | 165 // Note: deliberately _oneof_$name$_codec, not _$oneof_name$_codec... we have
one codec per field. |
| 166 printer->Print( | 166 printer->Print( |
| 167 variables_, | 167 variables_, |
| 168 "private static readonly pb::FieldCodec<$type_name$> _oneof_$name$_codec
= "); | 168 "private static readonly pb::FieldCodec<$type_name$> _oneof_$name$_codec
= "); |
| 169 GenerateCodecCode(printer); | 169 GenerateCodecCode(printer); |
| 170 printer->Print(";\n"); | 170 printer->Print(";\n"); |
| 171 WritePropertyDocComment(printer, descriptor_); | 171 WritePropertyDocComment(printer, descriptor_); |
| 172 AddPublicMemberAttributes(printer); | 172 AddDeprecatedFlag(printer); |
| 173 printer->Print( | 173 printer->Print( |
| 174 variables_, | 174 variables_, |
| 175 "$access_level$ $type_name$ $property_name$ {\n" | 175 "$access_level$ $type_name$ $property_name$ {\n" |
| 176 " get { return $has_property_check$ ? ($type_name$) $oneof_name$_ : ($type_
name$) null; }\n" | 176 " get { return $has_property_check$ ? ($type_name$) $oneof_name$_ : ($type_
name$) null; }\n" |
| 177 " set {\n" | 177 " set {\n" |
| 178 " $oneof_name$_ = value;\n" | 178 " $oneof_name$_ = value;\n" |
| 179 " $oneof_name$Case_ = value == null ? $oneof_property_name$OneofCase.None
: $oneof_property_name$OneofCase.$property_name$;\n" | 179 " $oneof_name$Case_ = value == null ? $oneof_property_name$OneofCase.None
: $oneof_property_name$OneofCase.$property_name$;\n" |
| 180 " }\n" | 180 " }\n" |
| 181 "}\n"); | 181 "}\n"); |
| 182 } | 182 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 202 variables_, | 202 variables_, |
| 203 "if ($has_property_check$) {\n" | 203 "if ($has_property_check$) {\n" |
| 204 " size += _oneof_$name$_codec.CalculateSizeWithTag($property_name$);\n" | 204 " size += _oneof_$name$_codec.CalculateSizeWithTag($property_name$);\n" |
| 205 "}\n"); | 205 "}\n"); |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace csharp | 208 } // namespace csharp |
| 209 } // namespace compiler | 209 } // namespace compiler |
| 210 } // namespace protobuf | 210 } // namespace protobuf |
| 211 } // namespace google | 211 } // namespace google |
| OLD | NEW |