public static void SetSerializerInterface <TDoc, TCursor>(this IO.TagElementStream <TDoc, TCursor, string> s, XML.BXmlSerializerInterface xsi) where TDoc : class where TCursor : class { if (xsi != null) { Contract.Assert(s.Owner == null || !(s.Owner is XML.BXmlSerializerInterface)); } s.Owner = xsi; }
protected abstract void Read <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, int iteration) where TDoc : class where TCursor : class;
/// <summary>Stream the current element's Text as a ProtoTech</summary> internal static void StreamTechID <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, [Phx.Meta.BProtoTechReference] ref int techProtoId) where TDoc : class where TCursor : class { xs.StreamDBID(s, XML.XmlUtil.kNoXmlName, ref techProtoId, Phx.DatabaseObjectKind.Object, false, XmlUtil.kSourceCursor); }
/// <summary>Stream the current element's Text as a a string</summary> internal static void StreamStringValue <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, ref string value) where TDoc : class where TCursor : class { s.StreamCursor(ref value); }
protected override void ReadNodes <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs) { var penum = mList.TypeValuesParams.kGetProtoEnumFromDB(xs.Database); foreach (var attrName in s.AttributeNames) { // The only attributes in this are actual member names so we don't waste time calling // penum.IsValidMemberName only to call GetMemberId when we can just compare id to -1 int index = penum.GetMemberId(attrName); if (index.IsNone()) { continue; } mList.InitializeItem(index); float value = PhxUtil.kInvalidSingle; s.ReadAttribute(attrName, ref value); mList[index] = value; } }
protected override void Write <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, float data) { throw new NotImplementedException(); }
protected override void Write <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, int data) { s.WriteCursor(data); }
protected override void WriteNodes <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs) { var eip = ListExplicitIndex.ExplicitIndexParams; T k_invalid = eip.kTypeGetInvalid(); int index = 0; foreach (T data in ListExplicitIndex) { if (eip.kComparer.Compare(data, k_invalid) != 0) { using (s.EnterCursorBookmark(WriteGetElementName(data))) { WriteExplicitIndex(s, xs, index); Write(s, xs, data); } } index++; } }
public void StreamXmlPreload <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs) where TDoc : class where TCursor : class { Contract.Requires(Params.RequiresDataNamePreloading); throw new NotImplementedException(); }
protected override void Write <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, T data) { data.Serialize(s); }
protected override void Read <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, int iteration) { T item = new T(); item.Serialize(s); List.AddItem(item); }
protected virtual void WriteNodes <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs) where TDoc : class where TCursor : class { foreach (T data in List) { using (s.EnterCursorBookmark(WriteGetElementName(data))) Write(s, xs, data); } }
protected virtual void ReadNodes <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs) where TDoc : class where TCursor : class { ReadDetermineListSize(s, xs); int x = 0; foreach (var n in ReadGetNodes(s)) { using (s.EnterCursorBookmark(n)) Read(s, xs, x++); } List.OptimizeStorage(); }
protected virtual void ReadDetermineListSize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs) where TDoc : class where TCursor : class { int child_element_count = s.TryGetCursorElementCount(); if (List.Capacity < child_element_count) { List.Capacity = child_element_count; } }
protected abstract void Write <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, T data) where TDoc : class where TCursor : class;
protected virtual int ReadExplicitIndex <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs) where TDoc : class where TCursor : class { int index = TypeExtensions.kNone; mParams.StreamExplicitIndex(s, ref index); return(index); }
protected virtual void WriteExplicitIndex <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, int index) where TDoc : class where TCursor : class { mParams.StreamExplicitIndex(s, ref index); }
public void StreamXmlUpdate <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs) where TDoc : class where TCursor : class { Contract.Requires(Params.SupportsUpdating); throw new NotImplementedException(); }
protected override void Read <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, int iteration) { int index = ReadExplicitIndex(s, xs); ListExplicitIndex.InitializeItem(index); int value = 0; s.ReadCursor(ref value); ListExplicitIndex[index] = value; }
protected override int ReadExplicitIndex <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs) { string name = null; Params.StreamDataName(s, ref name); int index = mList.TypeValuesParams.kGetProtoEnumFromDB(xs.Database).GetMemberId(name); return(index); }
protected override void Read <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, int iteration) { throw new NotImplementedException(); }
protected override void WriteExplicitIndex <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, int index) { string name = mList.TypeValuesParams.kGetProtoEnumFromDB(xs.Database).GetMemberName(index); Params.StreamDataName(s, ref name); }
protected override void WriteExplicitIndex <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, int index) { throw new NotImplementedException(); }
protected override void Read <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, int iteration) { string name = null; mParams.StreamDataName(s, ref name); mList.AddItem(name); }
protected override void WriteNodes <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs) { var tvp = mList.TypeValuesParams; var penum = tvp.kGetProtoEnumFromDB(xs.Database); float k_invalid = tvp.kTypeGetInvalid(); for (int x = 0; x < mList.Count; x++) { float data = mList[x]; if (tvp.kComparer.Compare(data, k_invalid) != 0) { string name = penum.GetMemberName(x); s.WriteAttribute(name, data); } } }
protected override void Write <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, string name) { mParams.StreamDataName(s, ref name); }
/// <summary>Stream the current element's Text as a ObjectType</summary> internal static void StreamObjectType <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, [Phx.Meta.ObjectTypeReference] ref int objectType) where TDoc : class where TCursor : class { xs.StreamDBID(s, XML.XmlUtil.kNoXmlName, ref objectType, Phx.DatabaseObjectKind.ObjectType, false, XmlUtil.kSourceCursor); }
protected override void WriteNodes <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs) { base.WriteNodes(s, xs); ProtoEnumUndefinedMembers.Write(s, mParams, mList.UndefinedInterface); }
/// <summary>Stream the current element's Text as a ProtoObject or ObjectType</summary> internal static void StreamUnitID <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, ref int unitProtoId) where TDoc : class where TCursor : class { xs.StreamDBID(s, XML.XmlUtil.kNoXmlName, ref unitProtoId, Phx.DatabaseObjectKind.Unit, false, XmlUtil.kSourceCursor); }
protected override void Write <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, float data) { s.WriteAttribute(kAttrName, data); }