public Nesting( Bonk myBonk, OneOfEach myOoe ) { this.MyBonk = myBonk; this.MyOoe = myOoe; }
public VersioningTestV2( int? beginInBoth, int? newint, sbyte? newbyte, short? newshort, long? newlong, double? newdouble, Bonk newstruct, List<int?> newlist, HashSet<int?> newset, Dictionary<int?, int?> newmap, string newstring, int? endInBoth ) { this.BeginInBoth = beginInBoth; this.Newint = newint; this.Newbyte = newbyte; this.Newshort = newshort; this.Newlong = newlong; this.Newdouble = newdouble; this.Newstruct = newstruct; this.Newlist = newlist; this.Newset = newset; this.Newmap = newmap; this.Newstring = newstring; this.EndInBoth = endInBoth; }
public void Read(TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.List) { { Bonk = new List<List<List<Bonk>>>(); TList _list0 = iprot.ReadListBegin(); for(int _i1 = 0; _i1 < _list0.Count; ++_i1) { List<List<Bonk>> _elem2 = new List<List<Bonk>>(); { _elem2 = new List<List<Bonk>>(); TList _list3 = iprot.ReadListBegin(); for(int _i4 = 0; _i4 < _list3.Count; ++_i4) { List<Bonk> _elem5 = new List<Bonk>(); { _elem5 = new List<Bonk>(); TList _list6 = iprot.ReadListBegin(); for(int _i7 = 0; _i7 < _list6.Count; ++_i7) { Bonk _elem8 = new Bonk(); _elem8 = new Bonk(); _elem8.Read(iprot); _elem5.Add(_elem8); } iprot.ReadListEnd(); } _elem2.Add(_elem5); } iprot.ReadListEnd(); } Bonk.Add(_elem2); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.List) { { Bonk = new List <Bonk>(); TList _list133 = iprot.ReadListBegin(); for (int _i134 = 0; _i134 < _list133.Count; ++_i134) { Bonk _elem135; _elem135 = new Bonk(); _elem135.Read(iprot); Bonk.Add(_elem135); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public void Read(TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.Struct) { MyBonk = new Bonk(); MyBonk.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.Struct) { MyOoe = new OneOfEach(); MyOoe.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
public void Read(TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.List) { { Big = new List<OneOfEach>(); TList _list0 = iprot.ReadListBegin(); for(int _i1 = 0; _i1 < _list0.Count; ++_i1) { OneOfEach _elem2 = new OneOfEach(); _elem2 = new OneOfEach(); _elem2.Read(iprot); Big.Add(_elem2); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.Set) { { Contain = new HashSet<List<string>>(); TSet _set3 = iprot.ReadSetBegin(); for(int _i4 = 0; _i4 < _set3.Count; ++_i4) { List<string> _elem5 = new List<string>(); { _elem5 = new List<string>(); TList _list6 = iprot.ReadListBegin(); for(int _i7 = 0; _i7 < _list6.Count; ++_i7) { string _elem8 = null; _elem8 = iprot.ReadString(); _elem5.Add(_elem8); } iprot.ReadListEnd(); } Contain.Add(_elem5); } iprot.ReadSetEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.Map) { { Bonks = new Dictionary<string, List<Bonk>>(); TMap _map9 = iprot.ReadMapBegin(); for(int _i10 = 0; _i10 < _map9.Count; ++_i10) { string _key11; List<Bonk> _val12; _key11 = iprot.ReadString(); { _val12 = new List<Bonk>(); TList _list13 = iprot.ReadListBegin(); for(int _i14 = 0; _i14 < _list13.Count; ++_i14) { Bonk _elem15 = new Bonk(); _elem15 = new Bonk(); _elem15.Read(iprot); _val12.Add(_elem15); } iprot.ReadListEnd(); } Bonks[_key11] = _val12; } iprot.ReadMapEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.I32) { Begin_in_both = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.I32) { Newint = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.Byte) { Newbyte = iprot.ReadByte(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.I16) { Newshort = iprot.ReadI16(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.I64) { Newlong = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 6: if (field.Type == TType.Double) { Newdouble = iprot.ReadDouble(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 7: if (field.Type == TType.Struct) { Newstruct = new Bonk(); Newstruct.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 8: if (field.Type == TType.List) { { Newlist = new List <int>(); TList _list44 = iprot.ReadListBegin(); for (int _i45 = 0; _i45 < _list44.Count; ++_i45) { int _elem46; _elem46 = iprot.ReadI32(); Newlist.Add(_elem46); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 9: if (field.Type == TType.Set) { { Newset = new THashSet <int>(); TSet _set47 = iprot.ReadSetBegin(); for (int _i48 = 0; _i48 < _set47.Count; ++_i48) { int _elem49; _elem49 = iprot.ReadI32(); Newset.Add(_elem49); } iprot.ReadSetEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 10: if (field.Type == TType.Map) { { Newmap = new Dictionary <int, int>(); TMap _map50 = iprot.ReadMapBegin(); for (int _i51 = 0; _i51 < _map50.Count; ++_i51) { int _key52; int _val53; _key52 = iprot.ReadI32(); _val53 = iprot.ReadI32(); Newmap[_key52] = _val53; } iprot.ReadMapEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 11: if (field.Type == TType.String) { Newstring = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 12: if (field.Type == TType.I32) { End_in_both = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
static Fixtures() { oneOfEach = new OneOfEach(); oneOfEach.ImTrue = true; oneOfEach.ImFalse = false; oneOfEach.ABite = (sbyte)0x16; oneOfEach.Integer16 = 27000; oneOfEach.Integer32 = 1 << 24; oneOfEach.Integer64 = (long)6000 * 1000 * 1000; oneOfEach.DoublePrecision = Math.PI; oneOfEach.SomeCharacters = "JSON THIS! \""; oneOfEach.ZomgUnicode = Encoding.UTF8.GetString(kUnicodeBytes); oneOfEach.Base64 = Encoding.UTF8.GetBytes("base64"); Bonk bonk = new Bonk(); bonk.Type = 31337; bonk.Message = "I am a bonk... xor!"; nesting = new Nesting(bonk, oneOfEach); holyMoley = new HolyMoley(); List<OneOfEach> big = new List<OneOfEach>(); big.Add(oneOfEach); big.Add(nesting.MyOoe); holyMoley.Big = big; holyMoley.Big[0].ABite = 0x22; holyMoley.Big[0].ABite = 0x23; holyMoley.Contain = new HashSet<List<string>>(); List<string> stage1 = new List<string>(2); stage1.Add("and a one"); stage1.Add("and a two"); holyMoley.Contain.Add(stage1); stage1 = new List<string>(3); stage1.Add("then a one, two"); stage1.Add("three!"); stage1.Add("FOUR!!"); holyMoley.Contain.Add(stage1); stage1 = new List<string>(0); holyMoley.Contain.Add(stage1); List<Bonk> stage2 = new List<Bonk>(); holyMoley.Bonks = new Dictionary<string, List<Bonk>>(); // one empty holyMoley.Bonks["zero"] = stage2; // one with two stage2 = new List<Bonk>(); Bonk b = new Bonk(); b.Type = 1; b.Message = "Wait."; stage2.Add(b); b = new Bonk(); b.Type = 2; b.Message = "What?"; stage2.Add(b); holyMoley.Bonks["two"] = stage2; // one with three stage2 = new List<Bonk>(); b = new Bonk(); b.Type = 3; b.Message = "quoth"; stage2.Add(b); b = new Bonk(); b.Type = 4; b.Message = "the raven"; stage2.Add(b); b = new Bonk(); b.Type = 5; b.Message = "nevermore"; stage2.Add(b); holyMoley.Bonks["three"] = stage2; // superhuge compact proto test struct compactProtoTestStruct = new CompactProtoTestStruct(); compactProtoTestStruct.ABinary = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; compactProtoTestStruct.AByte = 127; compactProtoTestStruct.AI16 = 32000; compactProtoTestStruct.AI32 = 100000000; compactProtoTestStruct.AI64 = 0xffffffffffL; compactProtoTestStruct.ADouble = 5.6789; compactProtoTestStruct.AString = "my string"; compactProtoTestStruct.TrueField = true; compactProtoTestStruct.FalseField = false; compactProtoTestStruct.EmptyStructField = new Empty(); compactProtoTestStruct.ByteList = new List<sbyte?> { -127, -1, 0, 1, 127 }; compactProtoTestStruct.I16List = new List<short?> { -1, 0, 1, 0x7fff }; compactProtoTestStruct.I32List = new List<int?> { -1, 0, 0xff, 0xffff, 0xffffff, 0x7fffffff }; compactProtoTestStruct.I64List = new List<long?> { -1L, 0L, 0xffL, 0xffffL, 0xffffffL, 0xffffffffL, 0xffffffffffL, 0xffffffffffffL, 0xffffffffffffffL, 0x7fffffffffffffffL }; compactProtoTestStruct.DoubleList = new List<double?> { 0.1, 0.2, 0.3 }; compactProtoTestStruct.StringList = new List<string> { "first", "second", "third" }; compactProtoTestStruct.BooleanList = new List<bool?> { true, true, true, false, false, false }; compactProtoTestStruct.StructList = new List<Empty> { new Empty(), new Empty() }; compactProtoTestStruct.ByteSet = new HashSet<sbyte?> { (sbyte)-127, (sbyte)-1, (sbyte)0, (sbyte)1, (sbyte)127 }; compactProtoTestStruct.I16Set = new HashSet<short?> { (short)-1, (short)0, (short)1, (short)0x7fff }; compactProtoTestStruct.I32Set = new HashSet<int?> { 1, 2, 3 }; compactProtoTestStruct.I64Set = new HashSet<long?> { -1L, 0L, 0xffL, 0xffffL, 0xffffffL, 0xffffffffL, 0xffffffffffL, 0xffffffffffffL, 0xffffffffffffffL, 0x7fffffffffffffffL }; compactProtoTestStruct.DoubleSet = new HashSet<double?> { 0.1, 0.2, 0.3 }; compactProtoTestStruct.StringSet = new HashSet<string> { "first", "second", "third" }; compactProtoTestStruct.BooleanSet = new HashSet<bool?> { true, false }; compactProtoTestStruct.StructSet = new HashSet<Empty> { new Empty() }; compactProtoTestStruct.ByteByteMap = new Dictionary<sbyte?, sbyte?> { { 1, 2 } }; compactProtoTestStruct.I16ByteMap = new Dictionary<short?, sbyte?> { { 1, 1 }, { -11, 1 }, { 0x7fff, 1 } }; compactProtoTestStruct.I32ByteMap = new Dictionary<int?, sbyte?> { {1, 1}, {-1, 1}, {0x7fffffff, 1} }; compactProtoTestStruct.I64ByteMap = new Dictionary<long?, sbyte?> { {0, 1}, {1, 1}, {-1, 1}, {0x7fffffffffffffffL, 1} }; compactProtoTestStruct.DoubleByteMap = new Dictionary<double?, sbyte?> { { -1.1, 1}, {1.1, 1} }; compactProtoTestStruct.StringByteMap = new Dictionary<string, sbyte?> { {"first", 1}, {"second", 2}, {"third", 3}, {"", 0}}; compactProtoTestStruct.BooleanByteMap = new Dictionary<bool?, sbyte?> { { true, 1 }, { false, 0 } }; compactProtoTestStruct.ByteI16Map = new Dictionary<sbyte?, short?> { { 1, 1 }, { 2, -1 }, { 3, 0x7fff } }; compactProtoTestStruct.ByteI32Map = new Dictionary<sbyte?, int?> { {1, 1}, {2, -1}, {3, 0x7fffffff} }; compactProtoTestStruct.ByteI64Map = new Dictionary<sbyte?, long?> { { 1, 1 }, { 2, -1 }, { 3, 0x7fffffffffffffffL } }; compactProtoTestStruct.ByteDoubleMap = new Dictionary<sbyte?, double?> { { 1, 0.1 }, { 2, -0.1 }, { 3, 1000000.1 } }; compactProtoTestStruct.ByteStringMap = new Dictionary<sbyte?, string> { { 1, "" }, { 2, "blah" }, { 3, "loooooooooooooong string" } }; compactProtoTestStruct.ByteBooleanMap = new Dictionary<sbyte?, bool?> { {1, true}, {2, false} }; compactProtoTestStruct.ListByteMap = new Dictionary<List<sbyte?>, sbyte?> { {new List<sbyte?> {1, 2, 3}, 1}, {new List<sbyte?> {0, 1}, 2 }, {new List<sbyte?>(), 0}}; compactProtoTestStruct.SetByteMap = new Dictionary<HashSet<sbyte?>, sbyte?> { { new HashSet<sbyte?> { 1, 2, 3 }, 1 }, { new HashSet<sbyte?> {0, 1}, 2}, { new HashSet<sbyte?>(), 0} }; compactProtoTestStruct.MapByteMap = new Dictionary<Dictionary<sbyte?, sbyte?>, sbyte?> { { new Dictionary<sbyte?, sbyte?> { { 1, 1 } }, 1 }, { new Dictionary<sbyte?, sbyte?> { { 2, 2 } }, 2 }, { new Dictionary<sbyte?, sbyte?>(), 0 } }; compactProtoTestStruct.ByteMapMap = new Dictionary<sbyte?, Dictionary<sbyte?, sbyte?>> { { 0, new Dictionary<sbyte?, sbyte?>() }, { 1, new Dictionary<sbyte?, sbyte?> { { 1, 1 } } }, { 2, new Dictionary<sbyte?, sbyte?> { { 1, 1 }, {2, 2} } } }; compactProtoTestStruct.ByteSetMap = new Dictionary<sbyte?, HashSet<sbyte?>> { {0, new HashSet<sbyte?>() }, {1, new HashSet<sbyte?> {1}}, {2, new HashSet<sbyte?> {1, 2}} }; compactProtoTestStruct.ByteListMap = new Dictionary<sbyte?, List<sbyte?>> { {0, new List<sbyte?>()}, {1, new List<sbyte?> { 1 }}, { 2, new List<sbyte?> {1, 2} } }; }
public void Read(TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.I32) { BeginInBoth = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.I32) { Newint = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.Byte) { Newbyte = iprot.ReadByte(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.I16) { Newshort = iprot.ReadI16(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.I64) { Newlong = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 6: if (field.Type == TType.Double) { Newdouble = iprot.ReadDouble(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 7: if (field.Type == TType.Struct) { Newstruct = new Bonk(); Newstruct.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 8: if (field.Type == TType.List) { { Newlist = new List<int?>(); TList _list0 = iprot.ReadListBegin(); for(int _i1 = 0; _i1 < _list0.Count; ++_i1) { int? _elem2 = 0; _elem2 = iprot.ReadI32(); Newlist.Add(_elem2); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 9: if (field.Type == TType.Set) { { Newset = new HashSet<int?>(); TSet _set3 = iprot.ReadSetBegin(); for(int _i4 = 0; _i4 < _set3.Count; ++_i4) { int? _elem5 = 0; _elem5 = iprot.ReadI32(); Newset.Add(_elem5); } iprot.ReadSetEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 10: if (field.Type == TType.Map) { { Newmap = new Dictionary<int?, int?>(); TMap _map6 = iprot.ReadMapBegin(); for(int _i7 = 0; _i7 < _map6.Count; ++_i7) { int? _key8; int? _val9; _key8 = iprot.ReadI32(); _val9 = iprot.ReadI32(); Newmap[_key8] = _val9; } iprot.ReadMapEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 11: if (field.Type == TType.String) { Newstring = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 12: if (field.Type == TType.I32) { EndInBoth = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.List) { { Bonk = new List <List <List <Bonk> > >(); TList _list132 = iprot.ReadListBegin(); for (int _i133 = 0; _i133 < _list132.Count; ++_i133) { List <List <Bonk> > _elem134; { _elem134 = new List <List <Bonk> >(); TList _list135 = iprot.ReadListBegin(); for (int _i136 = 0; _i136 < _list135.Count; ++_i136) { List <Bonk> _elem137; { _elem137 = new List <Bonk>(); TList _list138 = iprot.ReadListBegin(); for (int _i139 = 0; _i139 < _list138.Count; ++_i139) { Bonk _elem140; _elem140 = new Bonk(); _elem140.Read(iprot); _elem137.Add(_elem140); } iprot.ReadListEnd(); } _elem134.Add(_elem137); } iprot.ReadListEnd(); } Bonk.Add(_elem134); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.List) { { Bonk = new List <List <List <Bonk> > >(); TList _list137 = iprot.ReadListBegin(); for (int _i138 = 0; _i138 < _list137.Count; ++_i138) { List <List <Bonk> > _elem139; { _elem139 = new List <List <Bonk> >(); TList _list140 = iprot.ReadListBegin(); for (int _i141 = 0; _i141 < _list140.Count; ++_i141) { List <Bonk> _elem142; { _elem142 = new List <Bonk>(); TList _list143 = iprot.ReadListBegin(); for (int _i144 = 0; _i144 < _list143.Count; ++_i144) { Bonk _elem145; _elem145 = new Bonk(); _elem145.Read(iprot); _elem142.Add(_elem145); } iprot.ReadListEnd(); } _elem139.Add(_elem142); } iprot.ReadListEnd(); } Bonk.Add(_elem139); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }