TestTable.cs revision 9d66af6efc0498e90e2757659761ae0c4f797eee
19d66af6efc0498e90e2757659761ae0c4f797eeeevolutionalnamespace FlatBuffers.Test 29d66af6efc0498e90e2757659761ae0c4f797eeeevolutional{ 39d66af6efc0498e90e2757659761ae0c4f797eeeevolutional /// <summary> 49d66af6efc0498e90e2757659761ae0c4f797eeeevolutional /// A test Table object that gives easy access to the slot data 59d66af6efc0498e90e2757659761ae0c4f797eeeevolutional /// </summary> 69d66af6efc0498e90e2757659761ae0c4f797eeeevolutional internal class TestTable : Table 79d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 89d66af6efc0498e90e2757659761ae0c4f797eeeevolutional public TestTable(ByteBuffer bb, int pos) 99d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 109d66af6efc0498e90e2757659761ae0c4f797eeeevolutional base.bb = bb; 119d66af6efc0498e90e2757659761ae0c4f797eeeevolutional base.bb_pos = pos; 129d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 139d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 149d66af6efc0498e90e2757659761ae0c4f797eeeevolutional public bool GetSlot(int slot, bool def) 159d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 169d66af6efc0498e90e2757659761ae0c4f797eeeevolutional var off = base.__offset(slot); 179d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 189d66af6efc0498e90e2757659761ae0c4f797eeeevolutional if (off == 0) 199d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 209d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return def; 219d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 229d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return bb.GetSbyte(bb_pos + off) != 0; 239d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 249d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 259d66af6efc0498e90e2757659761ae0c4f797eeeevolutional public sbyte GetSlot(int slot, sbyte def) 269d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 279d66af6efc0498e90e2757659761ae0c4f797eeeevolutional var off = base.__offset(slot); 289d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 299d66af6efc0498e90e2757659761ae0c4f797eeeevolutional if (off == 0) 309d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 319d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return def; 329d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 339d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return bb.GetSbyte(bb_pos + off); 349d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 359d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 369d66af6efc0498e90e2757659761ae0c4f797eeeevolutional public byte GetSlot(int slot, byte def) 379d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 389d66af6efc0498e90e2757659761ae0c4f797eeeevolutional var off = base.__offset(slot); 399d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 409d66af6efc0498e90e2757659761ae0c4f797eeeevolutional if (off == 0) 419d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 429d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return def; 439d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 449d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return bb.Get(bb_pos + off); 459d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 469d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 479d66af6efc0498e90e2757659761ae0c4f797eeeevolutional public short GetSlot(int slot, short def) 489d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 499d66af6efc0498e90e2757659761ae0c4f797eeeevolutional var off = base.__offset(slot); 509d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 519d66af6efc0498e90e2757659761ae0c4f797eeeevolutional if (off == 0) 529d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 539d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return def; 549d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 559d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return bb.GetShort(bb_pos + off); 569d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 579d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 589d66af6efc0498e90e2757659761ae0c4f797eeeevolutional public ushort GetSlot(int slot, ushort def) 599d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 609d66af6efc0498e90e2757659761ae0c4f797eeeevolutional var off = base.__offset(slot); 619d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 629d66af6efc0498e90e2757659761ae0c4f797eeeevolutional if (off == 0) 639d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 649d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return def; 659d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 669d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return bb.GetUshort(bb_pos + off); 679d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 689d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 699d66af6efc0498e90e2757659761ae0c4f797eeeevolutional public int GetSlot(int slot, int def) 709d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 719d66af6efc0498e90e2757659761ae0c4f797eeeevolutional var off = base.__offset(slot); 729d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 739d66af6efc0498e90e2757659761ae0c4f797eeeevolutional if (off == 0) 749d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 759d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return def; 769d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 779d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return bb.GetInt(bb_pos + off); 789d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 799d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 809d66af6efc0498e90e2757659761ae0c4f797eeeevolutional public uint GetSlot(int slot, uint def) 819d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 829d66af6efc0498e90e2757659761ae0c4f797eeeevolutional var off = base.__offset(slot); 839d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 849d66af6efc0498e90e2757659761ae0c4f797eeeevolutional if (off == 0) 859d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 869d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return def; 879d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 889d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return bb.GetUint(bb_pos + off); 899d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 909d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 919d66af6efc0498e90e2757659761ae0c4f797eeeevolutional public long GetSlot(int slot, long def) 929d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 939d66af6efc0498e90e2757659761ae0c4f797eeeevolutional var off = base.__offset(slot); 949d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 959d66af6efc0498e90e2757659761ae0c4f797eeeevolutional if (off == 0) 969d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 979d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return def; 989d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 999d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return bb.GetLong(bb_pos + off); 1009d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 1019d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 1029d66af6efc0498e90e2757659761ae0c4f797eeeevolutional public ulong GetSlot(int slot, ulong def) 1039d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 1049d66af6efc0498e90e2757659761ae0c4f797eeeevolutional var off = base.__offset(slot); 1059d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 1069d66af6efc0498e90e2757659761ae0c4f797eeeevolutional if (off == 0) 1079d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 1089d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return def; 1099d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 1109d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return bb.GetUlong(bb_pos + off); 1119d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 1129d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 1139d66af6efc0498e90e2757659761ae0c4f797eeeevolutional public float GetSlot(int slot, float def) 1149d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 1159d66af6efc0498e90e2757659761ae0c4f797eeeevolutional var off = base.__offset(slot); 1169d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 1179d66af6efc0498e90e2757659761ae0c4f797eeeevolutional if (off == 0) 1189d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 1199d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return def; 1209d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 1219d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return bb.GetFloat(bb_pos + off); 1229d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 1239d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 1249d66af6efc0498e90e2757659761ae0c4f797eeeevolutional public double GetSlot(int slot, double def) 1259d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 1269d66af6efc0498e90e2757659761ae0c4f797eeeevolutional var off = base.__offset(slot); 1279d66af6efc0498e90e2757659761ae0c4f797eeeevolutional 1289d66af6efc0498e90e2757659761ae0c4f797eeeevolutional if (off == 0) 1299d66af6efc0498e90e2757659761ae0c4f797eeeevolutional { 1309d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return def; 1319d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 1329d66af6efc0498e90e2757659761ae0c4f797eeeevolutional return bb.GetDouble(bb_pos + off); 1339d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 1349d66af6efc0498e90e2757659761ae0c4f797eeeevolutional } 1359d66af6efc0498e90e2757659761ae0c4f797eeeevolutional}