aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/compiler/cpp/cpp_file.h
diff options
context:
space:
mode:
authorGravatar Adam Cozzette <acozzette@google.com>2016-11-17 16:48:38 -0800
committerGravatar Adam Cozzette <acozzette@google.com>2016-11-17 16:59:59 -0800
commit5a76e633ea9b5adb215e93fdc11e1c0c08b3fc74 (patch)
tree0276f81f8848a05d84cd7e287b43d665e30f04e3 /src/google/protobuf/compiler/cpp/cpp_file.h
parente28286fa05d8327fd6c5aa70cfb3be558f0932b8 (diff)
Integrated internal changes from Google
Diffstat (limited to 'src/google/protobuf/compiler/cpp/cpp_file.h')
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_file.h37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/google/protobuf/compiler/cpp/cpp_file.h b/src/google/protobuf/compiler/cpp/cpp_file.h
index 5dcf692b..25d6eabf 100644
--- a/src/google/protobuf/compiler/cpp/cpp_file.h
+++ b/src/google/protobuf/compiler/cpp/cpp_file.h
@@ -68,6 +68,9 @@ class FileGenerator {
FileGenerator(const FileDescriptor* file, const Options& options);
~FileGenerator();
+ // Shared code between the two header generators below.
+ void GenerateHeader(io::Printer* printer);
+
// info_path, if non-empty, should be the path (relative to printer's output)
// to the metadata file describing this proto header.
void GenerateProtoHeader(io::Printer* printer,
@@ -117,18 +120,6 @@ class FileGenerator {
// Generates types for classes.
void GenerateMessageDefinitions(io::Printer* printer);
- // Generates forward-declarations for just this file's classes. This is
- // used for .pb.h headers, but not in proto_h mode.
- void GenerateMessageForwardDeclarations(io::Printer* printer);
-
- // Fills in types for forward declarations. This is used internally, and
- // also by other FileGenerators to determine imports' declarations.
- void FillMessageForwardDeclarations(ForwardDeclarations* decls);
- void FillMessageDefinitions(ForwardDeclarations* decls);
-
- // Generates enum definitions.
- void GenerateEnumForwardDeclarations(io::Printer* printer);
- void FillEnumForwardDeclarations(ForwardDeclarations* decls);
void GenerateEnumDefinitions(io::Printer* printer);
// Generates generic service definitions.
@@ -145,13 +136,25 @@ class FileGenerator {
const FileDescriptor* file_;
const Options options_;
- google::protobuf::scoped_array<google::protobuf::scoped_ptr<MessageGenerator> > message_generators_;
- google::protobuf::scoped_array<google::protobuf::scoped_ptr<EnumGenerator> > enum_generators_;
- google::protobuf::scoped_array<google::protobuf::scoped_ptr<ServiceGenerator> > service_generators_;
- google::protobuf::scoped_array<google::protobuf::scoped_ptr<ExtensionGenerator> > extension_generators_;
+ // Contains the post-order walk of all the messages (and child messages) in
+ // this file. If you need a pre-order walk just reverse iterate.
+ std::vector<MessageGenerator*> message_generators_;
+ std::vector<EnumGenerator*> enum_generators_;
+ std::vector<ServiceGenerator*> service_generators_;
+ std::vector<ExtensionGenerator*> extension_generators_;
+
+ // These members are just for owning (and thus proper deleting). Some of the
+ // message_ and enum_generators above are owned by child messages.
+ google::protobuf::scoped_array<google::protobuf::scoped_ptr<MessageGenerator> >
+ message_generators_owner_;
+ google::protobuf::scoped_array<google::protobuf::scoped_ptr<EnumGenerator> > enum_generators_owner_;
+ google::protobuf::scoped_array<google::protobuf::scoped_ptr<ServiceGenerator> >
+ service_generators_owner_;
+ google::protobuf::scoped_array<google::protobuf::scoped_ptr<ExtensionGenerator> >
+ extension_generators_owner_;
// E.g. if the package is foo.bar, package_parts_ is {"foo", "bar"}.
- vector<string> package_parts_;
+ std::vector<string> package_parts_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator);
};