| Index: third_party/protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.h
|
| diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_file.h b/third_party/protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.h
|
| similarity index 63%
|
| copy from third_party/protobuf/src/google/protobuf/compiler/java/java_file.h
|
| copy to third_party/protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.h
|
| index 59911462668d56811f2bcc762a5556431c36b32e..38a32fc2d1ecb901a79c727524386dff3a8f9e79 100644
|
| --- a/third_party/protobuf/src/google/protobuf/compiler/java/java_file.h
|
| +++ b/third_party/protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.h
|
| @@ -1,6 +1,6 @@
|
| // Protocol Buffers - Google's data interchange format
|
| // Copyright 2008 Google Inc. All rights reserved.
|
| -// http://code.google.com/p/protobuf/
|
| +// https://developers.google.com/protocol-buffers/
|
| //
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| @@ -28,54 +28,51 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -// Author: kenton@google.com (Kenton Varda)
|
| -// Based on original Protocol Buffers design by
|
| -// Sanjay Ghemawat, Jeff Dean, and others.
|
| +// Author: xiaofeng@google.com (Feng Xiao)
|
| +//
|
| +// Generators that generate shared code between immutable API and mutable API.
|
|
|
| -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__
|
| -#define GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__
|
| +#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_SHARED_CODE_GENERATOR_H__
|
| +#define GOOGLE_PROTOBUF_COMPILER_JAVA_SHARED_CODE_GENERATOR_H__
|
|
|
| +#include <memory>
|
| +#ifndef _SHARED_PTR_H
|
| +#include <google/protobuf/stubs/shared_ptr.h>
|
| +#endif
|
| #include <string>
|
| #include <vector>
|
| +
|
| #include <google/protobuf/stubs/common.h>
|
|
|
| namespace google {
|
| namespace protobuf {
|
| class FileDescriptor; // descriptor.h
|
| + namespace compiler {
|
| + class GeneratorContext; // code_generator.h
|
| + namespace java {
|
| + class ClassNameResolver; // name_resolver.h
|
| + }
|
| + }
|
| namespace io {
|
| class Printer; // printer.h
|
| }
|
| - namespace compiler {
|
| - class GeneratorContext; // code_generator.h
|
| - }
|
| }
|
|
|
| namespace protobuf {
|
| namespace compiler {
|
| namespace java {
|
|
|
| -class FileGenerator {
|
| +// A generator that generates code that are shared between immutable API
|
| +// and mutable API. Currently only descriptors are shared.
|
| +class SharedCodeGenerator {
|
| public:
|
| - explicit FileGenerator(const FileDescriptor* file);
|
| - ~FileGenerator();
|
| -
|
| - // Checks for problems that would otherwise lead to cryptic compile errors.
|
| - // Returns true if there are no problems, or writes an error description to
|
| - // the given string and returns false otherwise.
|
| - bool Validate(string* error);
|
| + explicit SharedCodeGenerator(const FileDescriptor* file);
|
| + ~SharedCodeGenerator();
|
|
|
| - void Generate(io::Printer* printer);
|
| -
|
| - // If we aren't putting everything into one file, this will write all the
|
| - // 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,
|
| - vector<string>* file_list);
|
| -
|
| - const string& java_package() { return java_package_; }
|
| - const string& classname() { return classname_; }
|
| + void Generate(GeneratorContext* generator_context,
|
| + vector<string>* file_list);
|
|
|
| + void GenerateDescriptors(io::Printer* printer);
|
|
|
| private:
|
| // Returns whether the dependency should be included in the output file.
|
| @@ -83,19 +80,15 @@ class FileGenerator {
|
| // improve compatibility with version 1 of protocol buffers.
|
| bool ShouldIncludeDependency(const FileDescriptor* descriptor);
|
|
|
| + google::protobuf::scoped_ptr<ClassNameResolver> name_resolver_;
|
| const FileDescriptor* file_;
|
| - string java_package_;
|
| - string classname_;
|
| -
|
| -
|
| - void GenerateEmbeddedDescriptor(io::Printer* printer);
|
| -
|
| - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator);
|
| + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(SharedCodeGenerator);
|
| };
|
|
|
| +
|
| } // namespace java
|
| } // namespace compiler
|
| } // namespace protobuf
|
|
|
| } // namespace google
|
| -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_FILE_H__
|
| +#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_SHARED_CODE_GENERATOR_H__
|
|
|