Index: third_party/protobuf/objectivec/GPBExtensionRegistry.h |
diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_generator.h b/third_party/protobuf/objectivec/GPBExtensionRegistry.h |
similarity index 52% |
copy from third_party/protobuf/src/google/protobuf/compiler/java/java_generator.h |
copy to third_party/protobuf/objectivec/GPBExtensionRegistry.h |
index 888b8d85e929d3cab46ed24fe25ef24f906457b4..0363c70ab8f71c8eb41c71edbf2f74aff4a3152c 100644 |
--- a/third_party/protobuf/src/google/protobuf/compiler/java/java_generator.h |
+++ b/third_party/protobuf/objectivec/GPBExtensionRegistry.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,45 +28,40 @@ |
// (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. |
-// |
-// Generates Java code for a given .proto file. |
- |
-#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_H__ |
-#define GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_H__ |
+#import <Foundation/Foundation.h> |
-#include <string> |
-#include <google/protobuf/compiler/code_generator.h> |
+@class GPBDescriptor; |
+@class GPBExtensionDescriptor; |
-namespace google { |
-namespace protobuf { |
-namespace compiler { |
-namespace java { |
+NS_ASSUME_NONNULL_BEGIN |
-// CodeGenerator implementation which generates Java code. If you create your |
-// own protocol compiler binary and you want it to support Java output, you |
-// can do so by registering an instance of this CodeGenerator with the |
-// CommandLineInterface in your main() function. |
-class LIBPROTOC_EXPORT JavaGenerator : public CodeGenerator { |
- public: |
- JavaGenerator(); |
- ~JavaGenerator(); |
+// A table of known extensions, searchable by name or field number. When |
+// parsing a protocol message that might have extensions, you must provide an |
+// ExtensionRegistry in which you have registered any extensions that you want |
+// to be able to parse. Otherwise, those extensions will just be treated like |
+// unknown fields. |
+// |
+// The *Root classes provide +extensionRegistry for the extensions defined in a |
+// given file *and* all files it imports. You can also create a |
+// GPBExtensionRegistry, and merge those registries to handle parsing extensions |
+// defined from non overlapping files. |
+// |
+// GPBExtensionRegistry *registry = |
+// [[[MyProtoFileRoot extensionRegistry] copy] autorelease]; |
+// [registry addExtension:[OtherMessage neededExtension]; // Not in MyProtoFile |
+// NSError *parseError = nil; |
+// MyMessage *msg = [MyMessage parseData:data |
+// extensionRegistry:registry |
+// error:&parseError]; |
+// |
+@interface GPBExtensionRegistry : NSObject<NSCopying> |
- // implements CodeGenerator ---------------------------------------- |
- bool Generate(const FileDescriptor* file, |
- const string& parameter, |
- GeneratorContext* context, |
- string* error) const; |
+- (void)addExtension:(GPBExtensionDescriptor *)extension; |
+- (void)addExtensions:(GPBExtensionRegistry *)registry; |
- private: |
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(JavaGenerator); |
-}; |
+- (nullable GPBExtensionDescriptor *)extensionForDescriptor:(GPBDescriptor *)descriptor |
+ fieldNumber:(NSInteger)fieldNumber; |
-} // namespace java |
-} // namespace compiler |
-} // namespace protobuf |
+@end |
-} // namespace google |
-#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_H__ |
+NS_ASSUME_NONNULL_END |