Index: third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_message.h |
diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_enum.h b/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_message.h |
similarity index 55% |
copy from third_party/protobuf/src/google/protobuf/compiler/java/java_enum.h |
copy to third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_message.h |
index 9a9e5742ac3b8590e2e2c00de5123e681a53494e..f0c49ac90e924d4de7f87eab3013230afda8c53a 100644 |
--- a/third_party/protobuf/src/google/protobuf/compiler/java/java_enum.h |
+++ b/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_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 |
@@ -28,59 +28,62 @@ |
// (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. |
- |
-#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_H__ |
-#define GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_H__ |
+#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_H__ |
+#define GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_H__ |
#include <string> |
#include <vector> |
-#include <google/protobuf/descriptor.h> |
-namespace google { |
-namespace protobuf { |
- namespace io { |
- class Printer; // printer.h |
- } |
-} |
+#include <google/protobuf/compiler/code_generator.h> |
+#include <google/protobuf/compiler/csharp/csharp_source_generator_base.h> |
+#include <google/protobuf/compiler/csharp/csharp_helpers.h> |
+namespace google { |
namespace protobuf { |
namespace compiler { |
-namespace java { |
+namespace csharp { |
+ |
+class FieldGeneratorBase; |
-class EnumGenerator { |
+class MessageGenerator : public SourceGeneratorBase { |
public: |
- explicit EnumGenerator(const EnumDescriptor* descriptor); |
- ~EnumGenerator(); |
+ MessageGenerator(const Descriptor* descriptor); |
+ ~MessageGenerator(); |
+ void GenerateCloningCode(io::Printer* printer); |
+ void GenerateFreezingCode(io::Printer* printer); |
+ void GenerateFrameworkMethods(io::Printer* printer); |
void Generate(io::Printer* printer); |
private: |
- const EnumDescriptor* descriptor_; |
+ const Descriptor* descriptor_; |
+ std::vector<std::string> field_names_; |
+ std::vector<const FieldDescriptor*> fields_by_number_; |
- // 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_; |
+ void GenerateMessageSerializationMethods(io::Printer* printer); |
+ void GenerateMergingMethods(io::Printer* printer); |
- struct Alias { |
- const EnumValueDescriptor* value; |
- const EnumValueDescriptor* canonical_value; |
- }; |
- vector<Alias> aliases_; |
+ int GetFieldOrdinal(const FieldDescriptor* descriptor); |
+ FieldGeneratorBase* CreateFieldGeneratorInternal( |
+ const FieldDescriptor* descriptor); |
- bool CanUseEnumValues(); |
+ bool HasNestedGeneratedTypes(); |
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator); |
+ std::string class_name(); |
+ std::string full_class_name(); |
+ |
+ // field names sorted alphabetically |
+ const std::vector<std::string>& field_names(); |
+ |
+ // field descriptors sorted by number |
+ const std::vector<const FieldDescriptor*>& fields_by_number(); |
+ |
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator); |
}; |
-} // namespace java |
+} // namespace csharp |
} // namespace compiler |
} // namespace protobuf |
- |
} // namespace google |
-#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_H__ |
+ |
+#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_H__ |