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