aboutsummaryrefslogtreecommitdiff
path: root/csharp/ProtocolBuffers/Descriptors/EnumValueDescriptor.cs
blob: 15b901bd9b3b8d2f47b804a362a630ebc83fc800 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using Google.ProtocolBuffers.DescriptorProtos;

namespace Google.ProtocolBuffers.Descriptors {
  public class EnumValueDescriptor : IndexedDescriptorBase<EnumValueDescriptorProto, EnumValueOptions> {

    private readonly EnumDescriptor enumDescriptor;

    internal EnumValueDescriptor(EnumValueDescriptorProto proto, FileDescriptor file,
        EnumDescriptor parent, int index) 
        : base (proto, file, parent.FullName + "." + proto.Name, index) {
      enumDescriptor = parent;
      file.DescriptorPool.AddSymbol(this);
      file.DescriptorPool.AddEnumValueByNumber(this);
    }

    public int Number {
      get { return Proto.Number; }
    }

    public EnumDescriptor EnumDescriptor {
      get { return enumDescriptor; }
    }
  }
}