IndexedDescriptorBase.cs 920 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Google.ProtocolBuffers.DescriptorProtos;
  5. namespace Google.ProtocolBuffers.Descriptors {
  6. /// <summary>
  7. /// Base class for descriptors which are also indexed. This is all of them other than
  8. /// <see cref="FileDescriptor" />.
  9. /// </summary>
  10. public abstract class IndexedDescriptorBase<TProto, TOptions> : DescriptorBase<TProto, TOptions>
  11. where TProto : IMessage<TProto>, IDescriptorProto<TOptions> {
  12. private readonly int index;
  13. protected IndexedDescriptorBase(TProto proto, FileDescriptor file, int index)
  14. : base(proto, file) {
  15. this.index = index;
  16. }
  17. /// <value>
  18. /// The index of this descriptor within its parent descriptor.
  19. /// </value>
  20. /// <remarks>
  21. /// TODO(jonskeet): Transcribe appropriately.
  22. /// </remarks>
  23. public int Index {
  24. get { return index; }
  25. }
  26. }
  27. }