| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 using internal::WireFormat; | 55 using internal::WireFormat; |
| 56 using internal::WireFormatLite; | 56 using internal::WireFormatLite; |
| 57 | 57 |
| 58 namespace { | 58 namespace { |
| 59 | 59 |
| 60 void SetPrimitiveVariables(const FieldDescriptor* descriptor, | 60 void SetPrimitiveVariables(const FieldDescriptor* descriptor, |
| 61 int messageBitIndex, | 61 int messageBitIndex, |
| 62 int builderBitIndex, | 62 int builderBitIndex, |
| 63 const FieldGeneratorInfo* info, | 63 const FieldGeneratorInfo* info, |
| 64 ClassNameResolver* name_resolver, | 64 ClassNameResolver* name_resolver, |
| 65 std::map<string, string>* variables) { | 65 map<string, string>* variables) { |
| 66 SetCommonFieldVariables(descriptor, info, variables); | 66 SetCommonFieldVariables(descriptor, info, variables); |
| 67 | 67 |
| 68 (*variables)["empty_list"] = | 68 (*variables)["empty_list"] = |
| 69 "com.google.protobuf.GeneratedMessageLite.emptyProtobufList()"; | 69 "com.google.protobuf.GeneratedMessageLite.emptyProtobufList()"; |
| 70 | 70 |
| 71 (*variables)["default"] = ImmutableDefaultValue(descriptor, name_resolver); | 71 (*variables)["default"] = ImmutableDefaultValue(descriptor, name_resolver); |
| 72 (*variables)["default_init"] = | 72 (*variables)["default_init"] = |
| 73 "= " + ImmutableDefaultValue(descriptor, name_resolver); | 73 "= " + ImmutableDefaultValue(descriptor, name_resolver); |
| 74 (*variables)["capitalized_type"] = "String"; | 74 (*variables)["capitalized_type"] = "String"; |
| 75 (*variables)["tag"] = | 75 (*variables)["tag"] = SimpleItoa(WireFormat::MakeTag(descriptor)); |
| 76 SimpleItoa(static_cast<int32>(WireFormat::MakeTag(descriptor))); | |
| 77 (*variables)["tag_size"] = SimpleItoa( | 76 (*variables)["tag_size"] = SimpleItoa( |
| 78 WireFormat::TagSize(descriptor->number(), GetType(descriptor))); | 77 WireFormat::TagSize(descriptor->number(), GetType(descriptor))); |
| 79 (*variables)["null_check"] = | 78 (*variables)["null_check"] = |
| 80 " if (value == null) {\n" | 79 " if (value == null) {\n" |
| 81 " throw new NullPointerException();\n" | 80 " throw new NullPointerException();\n" |
| 82 " }\n"; | 81 " }\n"; |
| 83 | 82 |
| 84 // TODO(birdo): Add @deprecated javadoc when generating javadoc is supported | 83 // TODO(birdo): Add @deprecated javadoc when generating javadoc is supported |
| 85 // by the proto compiler | 84 // by the proto compiler |
| 86 (*variables)["deprecation"] = descriptor->options().deprecated() | 85 (*variables)["deprecation"] = descriptor->options().deprecated() |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 } | 863 } |
| 865 | 864 |
| 866 string RepeatedImmutableStringFieldLiteGenerator::GetBoxedType() const { | 865 string RepeatedImmutableStringFieldLiteGenerator::GetBoxedType() const { |
| 867 return "String"; | 866 return "String"; |
| 868 } | 867 } |
| 869 | 868 |
| 870 } // namespace java | 869 } // namespace java |
| 871 } // namespace compiler | 870 } // namespace compiler |
| 872 } // namespace protobuf | 871 } // namespace protobuf |
| 873 } // namespace google | 872 } // namespace google |
| OLD | NEW |