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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 namespace compiler { | 49 namespace compiler { |
50 namespace java { | 50 namespace java { |
51 | 51 |
52 namespace { | 52 namespace { |
53 | 53 |
54 void SetMessageVariables(const FieldDescriptor* descriptor, | 54 void SetMessageVariables(const FieldDescriptor* descriptor, |
55 int messageBitIndex, | 55 int messageBitIndex, |
56 int builderBitIndex, | 56 int builderBitIndex, |
57 const FieldGeneratorInfo* info, | 57 const FieldGeneratorInfo* info, |
58 ClassNameResolver* name_resolver, | 58 ClassNameResolver* name_resolver, |
59 map<string, string>* variables) { | 59 std::map<string, string>* variables) { |
60 SetCommonFieldVariables(descriptor, info, variables); | 60 SetCommonFieldVariables(descriptor, info, variables); |
61 | 61 |
62 (*variables)["type"] = | 62 (*variables)["type"] = |
63 name_resolver->GetImmutableClassName(descriptor->message_type()); | 63 name_resolver->GetImmutableClassName(descriptor->message_type()); |
64 (*variables)["mutable_type"] = | 64 (*variables)["mutable_type"] = |
65 name_resolver->GetMutableClassName(descriptor->message_type()); | 65 name_resolver->GetMutableClassName(descriptor->message_type()); |
66 (*variables)["group_or_message"] = | 66 (*variables)["group_or_message"] = |
67 (GetType(descriptor) == FieldDescriptor::TYPE_GROUP) ? | 67 (GetType(descriptor) == FieldDescriptor::TYPE_GROUP) ? |
68 "Group" : "Message"; | 68 "Group" : "Message"; |
69 // TODO(birdo): Add @deprecated javadoc when generating javadoc is supported | 69 // TODO(birdo): Add @deprecated javadoc when generating javadoc is supported |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 printer->Print(variables_, | 138 printer->Print(variables_, |
139 "$deprecation$boolean has$capitalized_name$();\n"); | 139 "$deprecation$boolean has$capitalized_name$();\n"); |
140 } | 140 } |
141 WriteFieldDocComment(printer, descriptor_); | 141 WriteFieldDocComment(printer, descriptor_); |
142 printer->Print(variables_, | 142 printer->Print(variables_, |
143 "$deprecation$$type$ get$capitalized_name$();\n"); | 143 "$deprecation$$type$ get$capitalized_name$();\n"); |
144 } | 144 } |
145 | 145 |
146 void ImmutableMessageFieldLiteGenerator:: | 146 void ImmutableMessageFieldLiteGenerator:: |
147 GenerateMembers(io::Printer* printer) const { | 147 GenerateMembers(io::Printer* printer) const { |
| 148 |
148 printer->Print(variables_, | 149 printer->Print(variables_, |
149 "private $type$ $name$_;\n"); | 150 "private $type$ $name$_;\n"); |
150 PrintExtraFieldInfo(variables_, printer); | 151 PrintExtraFieldInfo(variables_, printer); |
151 | 152 |
152 if (SupportFieldPresence(descriptor_->file())) { | 153 if (SupportFieldPresence(descriptor_->file())) { |
153 WriteFieldDocComment(printer, descriptor_); | 154 WriteFieldDocComment(printer, descriptor_); |
154 printer->Print(variables_, | 155 printer->Print(variables_, |
155 "$deprecation$public boolean has$capitalized_name$() {\n" | 156 "$deprecation$public boolean has$capitalized_name$() {\n" |
156 " return $get_has_field_bit_message$;\n" | 157 " return $get_has_field_bit_message$;\n" |
157 "}\n"); | 158 "}\n"); |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 } | 933 } |
933 | 934 |
934 string RepeatedImmutableMessageFieldLiteGenerator::GetBoxedType() const { | 935 string RepeatedImmutableMessageFieldLiteGenerator::GetBoxedType() const { |
935 return name_resolver_->GetImmutableClassName(descriptor_->message_type()); | 936 return name_resolver_->GetImmutableClassName(descriptor_->message_type()); |
936 } | 937 } |
937 | 938 |
938 } // namespace java | 939 } // namespace java |
939 } // namespace compiler | 940 } // namespace compiler |
940 } // namespace protobuf | 941 } // namespace protobuf |
941 } // namespace google | 942 } // namespace google |
OLD | NEW |