diff options
Diffstat (limited to 'src/google/protobuf/compiler/java/java_file.h')
-rw-r--r-- | src/google/protobuf/compiler/java/java_file.h | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/src/google/protobuf/compiler/java/java_file.h b/src/google/protobuf/compiler/java/java_file.h index c805b9a..9e35d33 100644 --- a/src/google/protobuf/compiler/java/java_file.h +++ b/src/google/protobuf/compiler/java/java_file.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -35,26 +35,18 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__ #define GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__ -#include <memory> #include <string> #include <vector> #include <google/protobuf/stubs/common.h> namespace google { namespace protobuf { - class FileDescriptor; // descriptor.h + class FileDescriptor; // descriptor.h namespace io { - class Printer; // printer.h + class Printer; // printer.h } namespace compiler { - class GeneratorContext; // code_generator.h - namespace java { - class Context; // context.h - class MessageGenerator; // message.h - class GeneratorFactory; // generator_factory.h - class ExtensionGenerator; // extension.h - class ClassNameResolver; // name_resolver.h - } + class OutputDirectory; // code_generator.h } } @@ -64,7 +56,7 @@ namespace java { class FileGenerator { public: - FileGenerator(const FileDescriptor* file, bool immutable_api = true); + explicit FileGenerator(const FileDescriptor* file); ~FileGenerator(); // Checks for problems that would otherwise lead to cryptic compile errors. @@ -78,31 +70,23 @@ class FileGenerator { // files other than the outer file (i.e. one for each message, enum, and // service type). void GenerateSiblings(const string& package_dir, - GeneratorContext* generator_context, + OutputDirectory* output_directory, vector<string>* file_list); const string& java_package() { return java_package_; } const string& classname() { return classname_; } - private: - void GenerateDescriptorInitializationCodeForImmutable(io::Printer* printer); - void GenerateDescriptorInitializationCodeForMutable(io::Printer* printer); - - bool ShouldIncludeDependency(const FileDescriptor* descriptor, - bool immutable_api_); + // Returns whether the dependency should be included in the output file. + // Always returns true for opensource, but used internally at Google to help + // improve compatibility with version 1 of protocol buffers. + bool ShouldIncludeDependency(const FileDescriptor* descriptor); const FileDescriptor* file_; string java_package_; string classname_; - scoped_array<scoped_ptr<MessageGenerator> > message_generators_; - scoped_array<scoped_ptr<ExtensionGenerator> > extension_generators_; - scoped_ptr<GeneratorFactory> generator_factory_; - scoped_ptr<Context> context_; - ClassNameResolver* name_resolver_; - bool immutable_api_; - + void GenerateEmbeddedDescriptor(io::Printer* printer); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator); }; |