using System; using System.Collections.Generic; using System.Text; using Google.ProtocolBuffers.DescriptorProtos; namespace Google.ProtocolBuffers.Descriptors { /// /// Base class for all descriptors, providing common functionality. /// /// Type of the protocol buffer form of this descriptor /// Type of the options protocol buffer for this descriptor public abstract class DescriptorBase where TProto : IMessage, IDescriptorProto { private readonly TProto proto; private readonly FileDescriptor file; protected DescriptorBase(TProto proto, FileDescriptor file) { this.proto = proto; this.file = file; } /// /// Returns the protocol buffer form of this descriptor /// public TProto Proto { get { return proto; } } public TOptions Options { get { return proto.Options; } } /// /// The fully qualified name of the descriptor's target. /// public string FullName { get { return proto.FullName; } } /// /// The brief name of the descriptor's target. /// public string Name { get { return proto.Name; } } /// /// The file this descriptor was declared in. /// public FileDescriptor File { get { return file; } } } }