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 // http://code.google.com/p/protobuf/ | 3 // http://code.google.com/p/protobuf/ |
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // Generate lines to serialize this field directly to the array "target", | 130 // Generate lines to serialize this field directly to the array "target", |
131 // which are placed within the message's SerializeWithCachedSizesToArray() | 131 // which are placed within the message's SerializeWithCachedSizesToArray() |
132 // method. This must also advance "target" past the written bytes. | 132 // method. This must also advance "target" past the written bytes. |
133 virtual void GenerateSerializeWithCachedSizesToArray( | 133 virtual void GenerateSerializeWithCachedSizesToArray( |
134 io::Printer* printer) const = 0; | 134 io::Printer* printer) const = 0; |
135 | 135 |
136 // Generate lines to compute the serialized size of this field, which | 136 // Generate lines to compute the serialized size of this field, which |
137 // are placed in the message's ByteSize() method. | 137 // are placed in the message's ByteSize() method. |
138 virtual void GenerateByteSize(io::Printer* printer) const = 0; | 138 virtual void GenerateByteSize(io::Printer* printer) const = 0; |
139 | 139 |
| 140 virtual void GenerateVisitInterface(io::Printer* printer) const = 0; |
| 141 virtual void GenerateVisitMethods(io::Printer* printer) const = 0; |
| 142 virtual void GenerateReaderCode(io::Printer* printer) const = 0; |
| 143 virtual void GenerateReaderCodeWithPacking(io::Printer* printer) const; |
| 144 virtual void GenerateWalkerCode(io::Printer* printer) const = 0; |
| 145 |
140 private: | 146 private: |
141 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator); | 147 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator); |
142 }; | 148 }; |
143 | 149 |
144 // Convenience class which constructs FieldGenerators for a Descriptor. | 150 // Convenience class which constructs FieldGenerators for a Descriptor. |
145 class FieldGeneratorMap { | 151 class FieldGeneratorMap { |
146 public: | 152 public: |
147 explicit FieldGeneratorMap(const Descriptor* descriptor); | 153 explicit FieldGeneratorMap(const Descriptor* descriptor); |
148 ~FieldGeneratorMap(); | 154 ~FieldGeneratorMap(); |
149 | 155 |
150 const FieldGenerator& get(const FieldDescriptor* field) const; | 156 const FieldGenerator& get(const FieldDescriptor* field) const; |
151 | 157 |
152 private: | 158 private: |
153 const Descriptor* descriptor_; | 159 const Descriptor* descriptor_; |
154 scoped_array<scoped_ptr<FieldGenerator> > field_generators_; | 160 scoped_array<scoped_ptr<FieldGenerator> > field_generators_; |
155 | 161 |
156 static FieldGenerator* MakeGenerator(const FieldDescriptor* field); | 162 static FieldGenerator* MakeGenerator(const FieldDescriptor* field); |
157 | 163 |
158 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap); | 164 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap); |
159 }; | 165 }; |
160 | 166 |
161 | 167 |
162 } // namespace cpp | 168 } // namespace cpp |
163 } // namespace compiler | 169 } // namespace compiler |
164 } // namespace protobuf | 170 } // namespace protobuf |
165 | 171 |
166 } // namespace google | 172 } // namespace google |
167 #endif // GOOGLE_PROTOBUF_COMPILER_CPP_FIELD_H__ | 173 #endif // GOOGLE_PROTOBUF_COMPILER_CPP_FIELD_H__ |
OLD | NEW |