source: OniSplit/Metadata/MetaVarArray.cs@ 1119

Last change on this file since 1119 was 1114, checked in by iritscen, 5 years ago

Adding OniSplit source code (v0.9.99.0). Many thanks to Neo for all his work over the years.

File size: 980 bytes
RevLine 
[1114]1using System;
2
3namespace Oni.Metadata
4{
5 internal class MetaVarArray : MetaType
6 {
7 private readonly MetaType elementType;
8 private readonly Field lengthField;
9
10 public MetaVarArray(MetaType lengthType, MetaType elementType)
11 {
12 if (lengthType != MetaType.Int16 && lengthType != MetaType.Int32)
13 throw new ArgumentException("lengthType must be Int16 or Int32", "lengthType");
14
15 this.lengthField = new Field(lengthType, "Length");
16 this.elementType = elementType;
17
18 Name = string.Format("{0}[{1}]", elementType.Name, lengthType.Name);
19 Size = lengthType.Size;
20 }
21
22 public Field CountField => lengthField;
23
24 public MetaType ElementType => elementType;
25
26 protected override bool IsLeafImpl() => elementType.IsLeaf;
27
28 public override void Accept(IMetaTypeVisitor visitor) => visitor.VisitVarArray(this);
29 }
30}
Note: See TracBrowser for help on using the repository browser.