Lines Matching defs:descriptor
66 /// IDescriptor is implemented such that the File property returns this descriptor,
129 var descriptor = FindDescriptorForPath(location.Path);
130 if (descriptor != null)
132 dictionary[descriptor] = DescriptorDeclaration.FromProto(descriptor, location);
141 // (There can be an empty path for a descriptor declaration, but that can't have any comments,
160 // This is fine: it may be a newer version of protobuf than we understand, with a new descriptor
171 throw new InvalidProtocolBufferException($"Invalid descriptor location path: index out of range");
191 internal DescriptorDeclaration GetDeclaration(IDescriptor descriptor)
194 declarations.Value.TryGetValue(descriptor, out declaration);
199 /// Computes the full name of a descriptor within this file, with an optional parent message.
248 /// The descriptor in its protocol message representation.
286 /// if this descriptor was generated using a version of protoc that did not fully
302 /// The original serialized binary form of this descriptor.
312 /// Implementation of IDescriptor.File - just returns this descriptor.
325 /// <typeparam name="T">The type of descriptor to look for</typeparam>
326 /// <returns>The type's descriptor, or null if not found.</returns>
351 /// <param name="descriptorData">The original serialized descriptor data.
361 /// a valid descriptor. This can occur for a number of reasons, such as a field
412 /// Creates a descriptor for generated code.
434 throw new ArgumentException("Failed to parse protocol buffer descriptor for generated code.", e);
445 throw new ArgumentException($"Invalid embedded descriptor for \"{proto.Name}\".", e);
459 private static IEnumerable<Extension> GetAllDependedExtensions(FileDescriptor descriptor)
461 return descriptor.Extensions.UnorderedExtensions
464 .Concat(descriptor.Dependencies.Concat(descriptor.PublicDependencies).SelectMany(GetAllDependedExtensions))
465 .Concat(descriptor.MessageTypes.SelectMany(GetAllDependedExtensionsFromMessage));
468 private static IEnumerable<Extension> GetAllDependedExtensionsFromMessage(MessageDescriptor descriptor)
470 return descriptor.Extensions.UnorderedExtensions
473 .Concat(descriptor.NestedTypes.SelectMany(GetAllDependedExtensionsFromMessage));
477 /// Converts the given descriptor binary data into FileDescriptor objects.
480 /// <param name="descriptorData">The binary file descriptor proto data. Must not be null, and any
481 /// dependencies must come before the descriptor which depends on them. (If A depends on B, and B
507 FileDescriptor descriptor = new FileDescriptor(
510 descriptor.CrossLink();
511 descriptors.Add(descriptor);
512 if (descriptorsByName.ContainsKey(descriptor.Name))
514 throw new ArgumentException($"Duplicate descriptor name: {descriptor.Name}");
516 descriptorsByName.Add(descriptor.Name, descriptor);
533 /// Returns the file descriptor for descriptor.proto.
536 /// This is used for protos which take a direct dependency on <c>descriptor.proto</c>, typically for
537 /// annotations. While <c>descriptor.proto</c> is a proto2 file, it is built into the Google.Protobuf
539 /// proto2 semantics for full support, but the file descriptor is available via this property. The
540 /// C# codegen in protoc automatically uses this property when it detects a dependency on <c>descriptor.proto</c>.
543 /// The file descriptor for <c>descriptor.proto</c>.
554 /// The <c>FileOptions</c>, defined in <c>descriptor.proto</c>.
562 /// Gets a single value file option for this descriptor
572 /// Gets a repeated value file option for this descriptor