| Index: third_party/protobuf/src/google/protobuf/compiler/java/java_generator_factory.cc
|
| diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_enum.h b/third_party/protobuf/src/google/protobuf/compiler/java/java_generator_factory.cc
|
| similarity index 52%
|
| copy from third_party/protobuf/src/google/protobuf/compiler/java/java_enum.h
|
| copy to third_party/protobuf/src/google/protobuf/compiler/java/java_generator_factory.cc
|
| index 9a9e5742ac3b8590e2e2c00de5123e681a53494e..92ef851b8d9042a10838452af34d76f304e1704c 100644
|
| --- a/third_party/protobuf/src/google/protobuf/compiler/java/java_enum.h
|
| +++ b/third_party/protobuf/src/google/protobuf/compiler/java/java_generator_factory.cc
|
| @@ -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,59 +28,56 @@
|
| // (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: liujisi@google.com (Pherl Liu)
|
|
|
| -#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_H__
|
| -#define GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_H__
|
| +#include <google/protobuf/compiler/java/java_generator_factory.h>
|
|
|
| -#include <string>
|
| -#include <vector>
|
| -#include <google/protobuf/descriptor.h>
|
| +#include <google/protobuf/compiler/java/java_context.h>
|
| +#include <google/protobuf/compiler/java/java_enum_field.h>
|
| +#include <google/protobuf/compiler/java/java_extension.h>
|
| +#include <google/protobuf/compiler/java/java_field.h>
|
| +#include <google/protobuf/compiler/java/java_helpers.h>
|
| +#include <google/protobuf/compiler/java/java_message.h>
|
| +#include <google/protobuf/compiler/java/java_message_lite.h>
|
| +#include <google/protobuf/compiler/java/java_service.h>
|
|
|
| namespace google {
|
| namespace protobuf {
|
| - namespace io {
|
| - class Printer; // printer.h
|
| - }
|
| -}
|
| -
|
| -namespace protobuf {
|
| namespace compiler {
|
| namespace java {
|
|
|
| -class EnumGenerator {
|
| - public:
|
| - explicit EnumGenerator(const EnumDescriptor* descriptor);
|
| - ~EnumGenerator();
|
| +GeneratorFactory::GeneratorFactory() {}
|
| +GeneratorFactory::~GeneratorFactory() {}
|
|
|
| - void Generate(io::Printer* printer);
|
| +// ===================================================================
|
|
|
| - private:
|
| - const EnumDescriptor* descriptor_;
|
| +ImmutableGeneratorFactory::ImmutableGeneratorFactory(
|
| + Context* context) : context_(context) {
|
| +}
|
| +ImmutableGeneratorFactory::~ImmutableGeneratorFactory() {}
|
|
|
| - // The proto language allows multiple enum constants to have the same numeric
|
| - // value. Java, however, does not allow multiple enum constants to be
|
| - // considered equivalent. We treat the first defined constant for any
|
| - // given numeric value as "canonical" and the rest as aliases of that
|
| - // canonical value.
|
| - vector<const EnumValueDescriptor*> canonical_values_;
|
| +MessageGenerator* ImmutableGeneratorFactory::NewMessageGenerator(
|
| + const Descriptor* descriptor) const {
|
| + if (descriptor->file()->options().optimize_for() ==
|
| + FileOptions::LITE_RUNTIME) {
|
| + return new ImmutableMessageLiteGenerator(descriptor, context_);
|
| + } else {
|
| + return new ImmutableMessageGenerator(descriptor, context_);
|
| + }
|
| +}
|
|
|
| - struct Alias {
|
| - const EnumValueDescriptor* value;
|
| - const EnumValueDescriptor* canonical_value;
|
| - };
|
| - vector<Alias> aliases_;
|
| +ExtensionGenerator* ImmutableGeneratorFactory::NewExtensionGenerator(
|
| + const FieldDescriptor* descriptor) const {
|
| + return new ImmutableExtensionGenerator(descriptor, context_);
|
| +}
|
|
|
| - bool CanUseEnumValues();
|
| +ServiceGenerator* ImmutableGeneratorFactory::NewServiceGenerator(
|
| + const ServiceDescriptor* descriptor) const {
|
| + return new ImmutableServiceGenerator(descriptor, context_);
|
| +}
|
|
|
| - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator);
|
| -};
|
|
|
| } // namespace java
|
| } // namespace compiler
|
| } // namespace protobuf
|
| -
|
| } // namespace google
|
| -#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_H__
|
|
|