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 map<string, string>* variables) { | 65 std::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"] = SimpleItoa(WireFormat::MakeTag(descriptor)); | 75 (*variables)["tag"] = |
| 76 SimpleItoa(static_cast<int32>(WireFormat::MakeTag(descriptor))); |
76 (*variables)["tag_size"] = SimpleItoa( | 77 (*variables)["tag_size"] = SimpleItoa( |
77 WireFormat::TagSize(descriptor->number(), GetType(descriptor))); | 78 WireFormat::TagSize(descriptor->number(), GetType(descriptor))); |
78 (*variables)["null_check"] = | 79 (*variables)["null_check"] = |
79 " if (value == null) {\n" | 80 " if (value == null) {\n" |
80 " throw new NullPointerException();\n" | 81 " throw new NullPointerException();\n" |
81 " }\n"; | 82 " }\n"; |
82 | 83 |
83 // TODO(birdo): Add @deprecated javadoc when generating javadoc is supported | 84 // TODO(birdo): Add @deprecated javadoc when generating javadoc is supported |
84 // by the proto compiler | 85 // by the proto compiler |
85 (*variables)["deprecation"] = descriptor->options().deprecated() | 86 (*variables)["deprecation"] = descriptor->options().deprecated() |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 } | 864 } |
864 | 865 |
865 string RepeatedImmutableStringFieldLiteGenerator::GetBoxedType() const { | 866 string RepeatedImmutableStringFieldLiteGenerator::GetBoxedType() const { |
866 return "String"; | 867 return "String"; |
867 } | 868 } |
868 | 869 |
869 } // namespace java | 870 } // namespace java |
870 } // namespace compiler | 871 } // namespace compiler |
871 } // namespace protobuf | 872 } // namespace protobuf |
872 } // namespace google | 873 } // namespace google |
OLD | NEW |