| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 // implements FieldGenerator --------------------------------------- | 53 // implements FieldGenerator --------------------------------------- |
| 54 void GeneratePrivateMembers(io::Printer* printer) const; | 54 void GeneratePrivateMembers(io::Printer* printer) const; |
| 55 void GenerateDependentAccessorDeclarations(io::Printer* printer) const; | 55 void GenerateDependentAccessorDeclarations(io::Printer* printer) const; |
| 56 void GenerateAccessorDeclarations(io::Printer* printer) const; | 56 void GenerateAccessorDeclarations(io::Printer* printer) const; |
| 57 void GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const; | 57 void GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const; |
| 58 void GenerateInlineAccessorDefinitions(io::Printer* printer, | 58 void GenerateInlineAccessorDefinitions(io::Printer* printer, |
| 59 bool is_inline) const; | 59 bool is_inline) const; |
| 60 void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const; | 60 void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const; |
| 61 void GenerateClearingCode(io::Printer* printer) const; | 61 void GenerateClearingCode(io::Printer* printer) const; |
| 62 void GenerateMessageClearingCode(io::Printer* printer) const; |
| 62 void GenerateMergingCode(io::Printer* printer) const; | 63 void GenerateMergingCode(io::Printer* printer) const; |
| 63 void GenerateSwappingCode(io::Printer* printer) const; | 64 void GenerateSwappingCode(io::Printer* printer) const; |
| 65 void GenerateDestructorCode(io::Printer* printer) const; |
| 64 void GenerateConstructorCode(io::Printer* printer) const; | 66 void GenerateConstructorCode(io::Printer* printer) const; |
| 67 void GenerateCopyConstructorCode(io::Printer* printer) const; |
| 65 void GenerateMergeFromCodedStream(io::Printer* printer) const; | 68 void GenerateMergeFromCodedStream(io::Printer* printer) const; |
| 66 void GenerateSerializeWithCachedSizes(io::Printer* printer) const; | 69 void GenerateSerializeWithCachedSizes(io::Printer* printer) const; |
| 67 void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; | 70 void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; |
| 68 void GenerateByteSize(io::Printer* printer) const; | 71 void GenerateByteSize(io::Printer* printer) const; |
| 69 | 72 |
| 70 protected: | 73 protected: |
| 71 void GenerateArenaManipulationCode(const map<string, string>& variables, | 74 void GenerateArenaManipulationCode(const std::map<string, string>& variables, |
| 72 io::Printer* printer) const; | 75 io::Printer* printer) const; |
| 73 | 76 |
| 74 virtual void GenerateGetterDeclaration(io::Printer* printer) const; | 77 virtual void GenerateGetterDeclaration(io::Printer* printer) const; |
| 75 | 78 |
| 76 const FieldDescriptor* descriptor_; | 79 const FieldDescriptor* descriptor_; |
| 77 const bool dependent_field_; | 80 const bool dependent_field_; |
| 78 map<string, string> variables_; | 81 std::map<string, string> variables_; |
| 79 | 82 |
| 80 private: | 83 private: |
| 81 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator); | 84 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator); |
| 82 }; | 85 }; |
| 83 | 86 |
| 84 class MessageOneofFieldGenerator : public MessageFieldGenerator { | 87 class MessageOneofFieldGenerator : public MessageFieldGenerator { |
| 85 public: | 88 public: |
| 86 MessageOneofFieldGenerator(const FieldDescriptor* descriptor, | 89 MessageOneofFieldGenerator(const FieldDescriptor* descriptor, |
| 87 const Options& options); | 90 const Options& options); |
| 88 ~MessageOneofFieldGenerator(); | 91 ~MessageOneofFieldGenerator(); |
| 89 | 92 |
| 90 // implements FieldGenerator --------------------------------------- | 93 // implements FieldGenerator --------------------------------------- |
| 91 void GenerateDependentAccessorDeclarations(io::Printer* printer) const; | 94 void GenerateDependentAccessorDeclarations(io::Printer* printer) const; |
| 92 void GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const; | 95 void GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const; |
| 93 void GenerateInlineAccessorDefinitions(io::Printer* printer, | 96 void GenerateInlineAccessorDefinitions(io::Printer* printer, |
| 94 bool is_inline) const; | 97 bool is_inline) const; |
| 95 void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const; | 98 void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const; |
| 96 void GenerateClearingCode(io::Printer* printer) const; | 99 void GenerateClearingCode(io::Printer* printer) const; |
| 100 |
| 101 // MessageFieldGenerator, from which we inherit, overrides this so we need to |
| 102 // override it as well. |
| 103 void GenerateMessageClearingCode(io::Printer* printer) const; |
| 97 void GenerateSwappingCode(io::Printer* printer) const; | 104 void GenerateSwappingCode(io::Printer* printer) const; |
| 105 void GenerateDestructorCode(io::Printer* printer) const; |
| 98 void GenerateConstructorCode(io::Printer* printer) const; | 106 void GenerateConstructorCode(io::Printer* printer) const; |
| 99 | 107 |
| 100 protected: | 108 protected: |
| 101 void GenerateGetterDeclaration(io::Printer* printer) const; | 109 void GenerateGetterDeclaration(io::Printer* printer) const; |
| 102 | 110 |
| 103 private: | 111 private: |
| 104 void InternalGenerateInlineAccessorDefinitions( | 112 void InternalGenerateInlineAccessorDefinitions( |
| 105 const map<string, string>& variables, io::Printer* printer) const; | 113 const std::map<string, string>& variables, io::Printer* printer) const; |
| 106 | 114 |
| 107 const bool dependent_base_; | 115 const bool dependent_base_; |
| 108 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageOneofFieldGenerator); | 116 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageOneofFieldGenerator); |
| 109 }; | 117 }; |
| 110 | 118 |
| 111 class RepeatedMessageFieldGenerator : public FieldGenerator { | 119 class RepeatedMessageFieldGenerator : public FieldGenerator { |
| 112 public: | 120 public: |
| 113 RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor, | 121 RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor, |
| 114 const Options& options); | 122 const Options& options); |
| 115 ~RepeatedMessageFieldGenerator(); | 123 ~RepeatedMessageFieldGenerator(); |
| 116 | 124 |
| 117 // implements FieldGenerator --------------------------------------- | 125 // implements FieldGenerator --------------------------------------- |
| 118 void GeneratePrivateMembers(io::Printer* printer) const; | 126 void GeneratePrivateMembers(io::Printer* printer) const; |
| 119 void GenerateDependentAccessorDeclarations(io::Printer* printer) const; | 127 void GenerateDependentAccessorDeclarations(io::Printer* printer) const; |
| 120 void GenerateAccessorDeclarations(io::Printer* printer) const; | 128 void GenerateAccessorDeclarations(io::Printer* printer) const; |
| 121 void GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const; | 129 void GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const; |
| 122 void GenerateInlineAccessorDefinitions(io::Printer* printer, | 130 void GenerateInlineAccessorDefinitions(io::Printer* printer, |
| 123 bool is_inline) const; | 131 bool is_inline) const; |
| 124 void GenerateClearingCode(io::Printer* printer) const; | 132 void GenerateClearingCode(io::Printer* printer) const; |
| 125 void GenerateMergingCode(io::Printer* printer) const; | 133 void GenerateMergingCode(io::Printer* printer) const; |
| 126 void GenerateSwappingCode(io::Printer* printer) const; | 134 void GenerateSwappingCode(io::Printer* printer) const; |
| 127 void GenerateConstructorCode(io::Printer* printer) const; | 135 void GenerateConstructorCode(io::Printer* printer) const; |
| 136 void GenerateCopyConstructorCode(io::Printer* printer) const {} |
| 128 void GenerateMergeFromCodedStream(io::Printer* printer) const; | 137 void GenerateMergeFromCodedStream(io::Printer* printer) const; |
| 129 void GenerateSerializeWithCachedSizes(io::Printer* printer) const; | 138 void GenerateSerializeWithCachedSizes(io::Printer* printer) const; |
| 130 void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; | 139 void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; |
| 131 void GenerateByteSize(io::Printer* printer) const; | 140 void GenerateByteSize(io::Printer* printer) const; |
| 132 | 141 |
| 133 private: | 142 private: |
| 134 void InternalGenerateTypeDependentAccessorDeclarations( | 143 void InternalGenerateTypeDependentAccessorDeclarations( |
| 135 io::Printer* printer) const; | 144 io::Printer* printer) const; |
| 136 | 145 |
| 137 const FieldDescriptor* descriptor_; | 146 const FieldDescriptor* descriptor_; |
| 138 const bool dependent_field_; | 147 const bool dependent_field_; |
| 139 const bool dependent_getter_; | 148 const bool dependent_getter_; |
| 140 map<string, string> variables_; | 149 std::map<string, string> variables_; |
| 141 | 150 |
| 142 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator); | 151 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator); |
| 143 }; | 152 }; |
| 144 | 153 |
| 145 } // namespace cpp | 154 } // namespace cpp |
| 146 } // namespace compiler | 155 } // namespace compiler |
| 147 } // namespace protobuf | 156 } // namespace protobuf |
| 148 | 157 |
| 149 } // namespace google | 158 } // namespace google |
| 150 #endif // GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_FIELD_H__ | 159 #endif // GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_FIELD_H__ |
| OLD | NEW |