Index: third_party/protobuf/src/google/protobuf/compiler/java/java_message_builder.h |
diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_enum.h b/third_party/protobuf/src/google/protobuf/compiler/java/java_message_builder.h |
similarity index 63% |
copy from third_party/protobuf/src/google/protobuf/compiler/java/java_enum.h |
copy to third_party/protobuf/src/google/protobuf/compiler/java/java_message_builder.h |
index 9a9e5742ac3b8590e2e2c00de5123e681a53494e..015ea06206c9610dc1e655d483b00e05444f66dd 100644 |
--- a/third_party/protobuf/src/google/protobuf/compiler/java/java_enum.h |
+++ b/third_party/protobuf/src/google/protobuf/compiler/java/java_message_builder.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,19 +28,25 @@ |
// (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) |
+// Author: dweis@google.com (Daniel Weis) |
// Based on original Protocol Buffers design by |
// Sanjay Ghemawat, Jeff Dean, and others. |
-#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_H__ |
-#define GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_H__ |
+#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_BUILDER_H__ |
+#define GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_BUILDER_H__ |
#include <string> |
-#include <vector> |
-#include <google/protobuf/descriptor.h> |
+#include <map> |
+#include <google/protobuf/compiler/java/java_field.h> |
namespace google { |
namespace protobuf { |
+ namespace compiler { |
+ namespace java { |
+ class Context; // context.h |
+ class ClassNameResolver; // name_resolver.h |
+ } |
+ } |
namespace io { |
class Printer; // printer.h |
} |
@@ -50,32 +56,26 @@ namespace protobuf { |
namespace compiler { |
namespace java { |
-class EnumGenerator { |
+class MessageBuilderGenerator { |
public: |
- explicit EnumGenerator(const EnumDescriptor* descriptor); |
- ~EnumGenerator(); |
+ explicit MessageBuilderGenerator(const Descriptor* descriptor, |
+ Context* context); |
+ virtual ~MessageBuilderGenerator(); |
- void Generate(io::Printer* printer); |
+ virtual void Generate(io::Printer* printer); |
private: |
- const EnumDescriptor* descriptor_; |
- |
- // 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_; |
- |
- struct Alias { |
- const EnumValueDescriptor* value; |
- const EnumValueDescriptor* canonical_value; |
- }; |
- vector<Alias> aliases_; |
+ void GenerateCommonBuilderMethods(io::Printer* printer); |
+ void GenerateDescriptorMethods(io::Printer* printer); |
+ void GenerateBuilderParsingMethods(io::Printer* printer); |
+ void GenerateIsInitialized(io::Printer* printer); |
- bool CanUseEnumValues(); |
+ const Descriptor* descriptor_; |
+ Context* context_; |
+ ClassNameResolver* name_resolver_; |
+ FieldGeneratorMap<ImmutableFieldGenerator> field_generators_; |
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator); |
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageBuilderGenerator); |
}; |
} // namespace java |
@@ -83,4 +83,4 @@ class EnumGenerator { |
} // namespace protobuf |
} // namespace google |
-#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_H__ |
+#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_BUILDER_H__ |