internal MessageDescriptor(DescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int typeIndex)
            : base(proto, file, ComputeFullName(file, parent, proto.Name), typeIndex)
        {
            containingType = parent;

            nestedTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.NestedTypeList,
                                                                (type, index) =>
                                                                new MessageDescriptor(type, file, this, index));

            enumTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.EnumTypeList,
                                                              (type, index) =>
                                                              new EnumDescriptor(type, file, this, index));

            // TODO(jonskeet): Sort fields first?
            fields = DescriptorUtil.ConvertAndMakeReadOnly(proto.FieldList,
                                                           (field, index) =>
                                                           new FieldDescriptor(field, file, this, index, false));

            extensions = DescriptorUtil.ConvertAndMakeReadOnly(proto.ExtensionList,
                                                               (field, index) =>
                                                               new FieldDescriptor(field, file, this, index, true));

            file.DescriptorPool.AddSymbol(this);
        }
Beispiel #2
0
 protected DescriptorBase(TProto proto, FileDescriptor file, string fullName)
 {
     this.proto    = proto;
     this.file     = file;
     this.fullName = fullName;
 }
 protected IndexedDescriptorBase(TProto proto, FileDescriptor file, string fullName, int index)
     : base(proto, file, fullName)
 {
     this.index = index;
 }
Beispiel #4
0
 internal PackageDescriptor(string name, string fullName, FileDescriptor file)
 {
     this.file     = file;
     this.fullName = fullName;
     this.name     = name;
 }