| 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 20 matching lines...) Expand all Loading... |
| 31 // Author: kenton@google.com (Kenton Varda) | 31 // Author: kenton@google.com (Kenton Varda) |
| 32 // Based on original Protocol Buffers design by | 32 // Based on original Protocol Buffers design by |
| 33 // Sanjay Ghemawat, Jeff Dean, and others. | 33 // Sanjay Ghemawat, Jeff Dean, and others. |
| 34 | 34 |
| 35 #ifndef GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_H__ | 35 #ifndef GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_H__ |
| 36 #define GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_H__ | 36 #define GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_H__ |
| 37 | 37 |
| 38 #include <string> | 38 #include <string> |
| 39 #include <google/protobuf/stubs/common.h> | 39 #include <google/protobuf/stubs/common.h> |
| 40 #include <google/protobuf/compiler/cpp/cpp_field.h> | 40 #include <google/protobuf/compiler/cpp/cpp_field.h> |
| 41 #include <google/protobuf/compiler/cpp/cpp_options.h> |
| 41 | 42 |
| 42 namespace google { | 43 namespace google { |
| 43 namespace protobuf { | 44 namespace protobuf { |
| 44 namespace io { | 45 namespace io { |
| 45 class Printer; // printer.h | 46 class Printer; // printer.h |
| 46 } | 47 } |
| 47 } | 48 } |
| 48 | 49 |
| 49 namespace protobuf { | 50 namespace protobuf { |
| 50 namespace compiler { | 51 namespace compiler { |
| 51 namespace cpp { | 52 namespace cpp { |
| 52 | 53 |
| 53 class EnumGenerator; // enum.h | 54 class EnumGenerator; // enum.h |
| 54 class ExtensionGenerator; // extension.h | 55 class ExtensionGenerator; // extension.h |
| 55 | 56 |
| 56 class MessageGenerator { | 57 class MessageGenerator { |
| 57 public: | 58 public: |
| 58 // See generator.cc for the meaning of dllexport_decl. | 59 // See generator.cc for the meaning of dllexport_decl. |
| 59 explicit MessageGenerator(const Descriptor* descriptor, | 60 explicit MessageGenerator(const Descriptor* descriptor, |
| 60 const string& dllexport_decl); | 61 const Options& options); |
| 61 ~MessageGenerator(); | 62 ~MessageGenerator(); |
| 62 | 63 |
| 63 // Header stuff. | 64 // Header stuff. |
| 64 | 65 |
| 65 // Generate foward declarations for this class and all its nested types. | 66 // Generate foward declarations for this class and all its nested types. |
| 66 void GenerateForwardDeclaration(io::Printer* printer); | 67 void GenerateForwardDeclaration(io::Printer* printer); |
| 67 | 68 |
| 68 // Generate definitions of all nested enums (must come before class | 69 // Generate definitions of all nested enums (must come before class |
| 69 // definitions because those classes use the enums definitions). | 70 // definitions because those classes use the enums definitions). |
| 70 void GenerateEnumDefinitions(io::Printer* printer); | 71 void GenerateEnumDefinitions(io::Printer* printer); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 void GenerateSerializeOneField(io::Printer* printer, | 147 void GenerateSerializeOneField(io::Printer* printer, |
| 147 const FieldDescriptor* field, | 148 const FieldDescriptor* field, |
| 148 bool unbounded); | 149 bool unbounded); |
| 149 void GenerateSerializeOneExtensionRange( | 150 void GenerateSerializeOneExtensionRange( |
| 150 io::Printer* printer, const Descriptor::ExtensionRange* range, | 151 io::Printer* printer, const Descriptor::ExtensionRange* range, |
| 151 bool unbounded); | 152 bool unbounded); |
| 152 | 153 |
| 153 | 154 |
| 154 const Descriptor* descriptor_; | 155 const Descriptor* descriptor_; |
| 155 string classname_; | 156 string classname_; |
| 156 string dllexport_decl_; | 157 Options options_; |
| 157 FieldGeneratorMap field_generators_; | 158 FieldGeneratorMap field_generators_; |
| 158 scoped_array<scoped_ptr<MessageGenerator> > nested_generators_; | 159 scoped_array<scoped_ptr<MessageGenerator> > nested_generators_; |
| 159 scoped_array<scoped_ptr<EnumGenerator> > enum_generators_; | 160 scoped_array<scoped_ptr<EnumGenerator> > enum_generators_; |
| 160 scoped_array<scoped_ptr<ExtensionGenerator> > extension_generators_; | 161 scoped_array<scoped_ptr<ExtensionGenerator> > extension_generators_; |
| 161 | 162 |
| 162 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator); | 163 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator); |
| 163 }; | 164 }; |
| 164 | 165 |
| 165 } // namespace cpp | 166 } // namespace cpp |
| 166 } // namespace compiler | 167 } // namespace compiler |
| 167 } // namespace protobuf | 168 } // namespace protobuf |
| 168 | 169 |
| 169 } // namespace google | 170 } // namespace google |
| 170 #endif // GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_H__ | 171 #endif // GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_H__ |
| OLD | NEW |