Index: third_party/protobuf/src/google/protobuf/compiler/java/java_message.h |
diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_message.h b/third_party/protobuf/src/google/protobuf/compiler/java/java_message.h |
index a30f020267557cc659f6e7d2921000a89a4d755f..be5bfb07546e908930a2907346c8a1c901ed4fc4 100644 |
--- a/third_party/protobuf/src/google/protobuf/compiler/java/java_message.h |
+++ b/third_party/protobuf/src/google/protobuf/compiler/java/java_message.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 |
@@ -36,11 +36,17 @@ |
#define GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_H__ |
#include <string> |
-#include <google/protobuf/stubs/common.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 |
} |
@@ -53,32 +59,54 @@ namespace java { |
class MessageGenerator { |
public: |
explicit MessageGenerator(const Descriptor* descriptor); |
- ~MessageGenerator(); |
+ virtual ~MessageGenerator(); |
// All static variables have to be declared at the top-level of the file |
// so that we can control initialization order, which is important for |
// DescriptorProto bootstrapping to work. |
- void GenerateStaticVariables(io::Printer* printer); |
+ virtual void GenerateStaticVariables(io::Printer* printer) = 0; |
// Output code which initializes the static variables generated by |
- // GenerateStaticVariables(). |
- void GenerateStaticVariableInitializers(io::Printer* printer); |
+ // GenerateStaticVariables(). Returns an estimate of bytecode size. |
+ virtual int GenerateStaticVariableInitializers(io::Printer* printer) = 0; |
// Generate the class itself. |
- void Generate(io::Printer* printer); |
+ virtual void Generate(io::Printer* printer) = 0; |
// Generates the base interface that both the class and its builder implement |
- void GenerateInterface(io::Printer* printer); |
+ virtual void GenerateInterface(io::Printer* printer) = 0; |
// Generate code to register all contained extensions with an |
// ExtensionRegistry. |
- void GenerateExtensionRegistrationCode(io::Printer* printer); |
+ virtual void GenerateExtensionRegistrationCode(io::Printer* printer) = 0; |
+ |
+ protected: |
+ const Descriptor* descriptor_; |
+ |
+ private: |
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator); |
+}; |
+ |
+class ImmutableMessageGenerator : public MessageGenerator { |
+ public: |
+ explicit ImmutableMessageGenerator(const Descriptor* descriptor, |
+ Context* context); |
+ virtual ~ImmutableMessageGenerator(); |
+ |
+ virtual void Generate(io::Printer* printer); |
+ virtual void GenerateInterface(io::Printer* printer); |
+ virtual void GenerateExtensionRegistrationCode(io::Printer* printer); |
+ virtual void GenerateStaticVariables(io::Printer* printer); |
+ |
+ // Returns an estimate of the number of bytes the printed code will compile to |
+ virtual int GenerateStaticVariableInitializers(io::Printer* printer); |
private: |
- enum UseMemoization { |
- MEMOIZE, |
- DONT_MEMOIZE |
- }; |
+ |
+ void GenerateFieldAccessorTable(io::Printer* printer); |
+ |
+ // Returns an estimate of the number of bytes the printed code will compile to |
+ int GenerateFieldAccessorTableInitializer(io::Printer* printer); |
void GenerateMessageSerializationMethods(io::Printer* printer); |
void GenerateParseFromMethods(io::Printer* printer); |
@@ -88,20 +116,19 @@ class MessageGenerator { |
io::Printer* printer, const Descriptor::ExtensionRange* range); |
void GenerateBuilder(io::Printer* printer); |
- void GenerateCommonBuilderMethods(io::Printer* printer); |
+ void GenerateIsInitialized(io::Printer* printer); |
void GenerateDescriptorMethods(io::Printer* printer); |
- void GenerateBuilderParsingMethods(io::Printer* printer); |
- void GenerateIsInitialized(io::Printer* printer, |
- UseMemoization useMemoization); |
+ void GenerateInitializers(io::Printer* printer); |
void GenerateEqualsAndHashCode(io::Printer* printer); |
- |
void GenerateParser(io::Printer* printer); |
void GenerateParsingConstructor(io::Printer* printer); |
+ void GenerateAnyMethods(io::Printer* printer); |
- const Descriptor* descriptor_; |
- FieldGeneratorMap field_generators_; |
+ Context* context_; |
+ ClassNameResolver* name_resolver_; |
+ FieldGeneratorMap<ImmutableFieldGenerator> field_generators_; |
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator); |
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableMessageGenerator); |
}; |
} // namespace java |