Index: third_party/protobuf/src/google/protobuf/compiler/java/java_field.h |
diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_field.h b/third_party/protobuf/src/google/protobuf/compiler/java/java_field.h |
index 00f3c601e864d3917e4af1af279927003ca0c5bf..4dd0efd60b327c1f4d2abb3a0736ec052ee0f345 100644 |
--- a/third_party/protobuf/src/google/protobuf/compiler/java/java_field.h |
+++ b/third_party/protobuf/src/google/protobuf/compiler/java/java_field.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,14 @@ |
#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_FIELD_H__ |
#define GOOGLE_PROTOBUF_COMPILER_JAVA_FIELD_H__ |
-#include <map> |
-#include <memory> |
-#ifndef _SHARED_PTR_H |
-#include <google/protobuf/stubs/shared_ptr.h> |
-#endif |
#include <string> |
- |
#include <google/protobuf/stubs/common.h> |
#include <google/protobuf/descriptor.h> |
namespace google { |
namespace protobuf { |
- namespace compiler { |
- namespace java { |
- class Context; // context.h |
- class ClassNameResolver; // name_resolver.h |
- } |
- } |
namespace io { |
- class Printer; // printer.h |
+ class Printer; // printer.h |
} |
} |
@@ -62,10 +50,10 @@ namespace protobuf { |
namespace compiler { |
namespace java { |
-class ImmutableFieldGenerator { |
+class FieldGenerator { |
public: |
- ImmutableFieldGenerator() {} |
- virtual ~ImmutableFieldGenerator(); |
+ FieldGenerator() {} |
+ virtual ~FieldGenerator(); |
virtual int GetNumBitsForMessage() const = 0; |
virtual int GetNumBitsForBuilder() const = 0; |
@@ -90,104 +78,29 @@ class ImmutableFieldGenerator { |
virtual string GetBoxedType() const = 0; |
private: |
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableFieldGenerator); |
-}; |
- |
-class ImmutableFieldLiteGenerator { |
- public: |
- ImmutableFieldLiteGenerator() {} |
- virtual ~ImmutableFieldLiteGenerator(); |
- |
- virtual int GetNumBitsForMessage() const = 0; |
- virtual int GetNumBitsForBuilder() const = 0; |
- virtual void GenerateInterfaceMembers(io::Printer* printer) const = 0; |
- virtual void GenerateMembers(io::Printer* printer) const = 0; |
- virtual void GenerateBuilderMembers(io::Printer* printer) const = 0; |
- virtual void GenerateInitializationCode(io::Printer* printer) const = 0; |
- virtual void GenerateMergingCode(io::Printer* printer) const = 0; |
- virtual void GenerateDynamicMethodMakeImmutableCode(io::Printer* printer) |
- const = 0; |
- virtual void GenerateParsingCode(io::Printer* printer) const = 0; |
- virtual void GenerateParsingCodeFromPacked(io::Printer* printer) const; |
- virtual void GenerateParsingDoneCode(io::Printer* printer) const = 0; |
- virtual void GenerateSerializationCode(io::Printer* printer) const = 0; |
- virtual void GenerateSerializedSizeCode(io::Printer* printer) const = 0; |
- virtual void GenerateFieldBuilderInitializationCode(io::Printer* printer) |
- const = 0; |
- |
- virtual void GenerateEqualsCode(io::Printer* printer) const = 0; |
- virtual void GenerateHashCode(io::Printer* printer) const = 0; |
- |
- virtual string GetBoxedType() const = 0; |
- |
- private: |
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableFieldLiteGenerator); |
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator); |
}; |
- |
// Convenience class which constructs FieldGenerators for a Descriptor. |
-template<typename FieldGeneratorType> |
class FieldGeneratorMap { |
public: |
- explicit FieldGeneratorMap(const Descriptor* descriptor, |
- Context* context); |
+ explicit FieldGeneratorMap(const Descriptor* descriptor); |
~FieldGeneratorMap(); |
- const FieldGeneratorType& get(const FieldDescriptor* field) const; |
+ const FieldGenerator& get(const FieldDescriptor* field) const; |
+ const FieldGenerator& get_extension(int index) const; |
private: |
const Descriptor* descriptor_; |
- Context* context_; |
- ClassNameResolver* name_resolver_; |
- google::protobuf::scoped_array<google::protobuf::scoped_ptr<FieldGeneratorType> > field_generators_; |
+ scoped_array<scoped_ptr<FieldGenerator> > field_generators_; |
+ scoped_array<scoped_ptr<FieldGenerator> > extension_generators_; |
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap); |
-}; |
+ static FieldGenerator* MakeGenerator(const FieldDescriptor* field, |
+ int messageBitIndex, int builderBitIndex); |
-template<typename FieldGeneratorType> |
-inline const FieldGeneratorType& |
-FieldGeneratorMap<FieldGeneratorType>::get(const FieldDescriptor* field) const { |
- GOOGLE_CHECK_EQ(field->containing_type(), descriptor_); |
- return *field_generators_[field->index()]; |
-} |
- |
-// Instantiate template for mutable and immutable maps. |
-template<> |
-FieldGeneratorMap<ImmutableFieldGenerator>:: |
-FieldGeneratorMap(const Descriptor* descriptor, |
- Context* context); |
- |
-template<> |
-FieldGeneratorMap<ImmutableFieldGenerator>::~FieldGeneratorMap(); |
- |
- |
-// Field information used in FieldGeneartors. |
-struct FieldGeneratorInfo { |
- string name; |
- string capitalized_name; |
- string disambiguated_reason; |
-}; |
- |
-// Oneof information used in OneofFieldGeneartors. |
-struct OneofGeneratorInfo { |
- string name; |
- string capitalized_name; |
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap); |
}; |
-// Set some common variables used in variable FieldGenerators. |
-void SetCommonFieldVariables(const FieldDescriptor* descriptor, |
- const FieldGeneratorInfo* info, |
- map<string, string>* variables); |
- |
-// Set some common oneof variables used in OneofFieldGenerators. |
-void SetCommonOneofVariables(const FieldDescriptor* descriptor, |
- const OneofGeneratorInfo* info, |
- map<string, string>* variables); |
- |
-// Print useful comments before a field's accessors. |
-void PrintExtraFieldInfo(const map<string, string>& variables, |
- io::Printer* printer); |
- |
} // namespace java |
} // namespace compiler |
} // namespace protobuf |