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;
        }
Exemple #2
0
 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);
 }
Exemple #5
0
        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;
            }
        }
Exemple #6
0
 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);
 }
Exemple #8
0
        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++;
            }
        }
Exemple #9
0
        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();
        }
Exemple #10
0
 protected override void Write <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, T data)
 {
     data.Serialize(s);
 }
Exemple #11
0
        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);
        }
Exemple #12
0
 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);
     }
 }
Exemple #13
0
        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();
        }
Exemple #14
0
        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;
            }
        }
Exemple #15
0
 protected abstract void Write <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, T data)
     where TDoc : class
     where TCursor : class;
Exemple #16
0
        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);
        }
Exemple #17
0
 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);
 }
Exemple #18
0
        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);
        }
Exemple #21
0
 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);
        }
Exemple #23
0
 protected override void WriteExplicitIndex <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s, BXmlSerializerInterface xs, int index)
 {
     throw new NotImplementedException();
 }
Exemple #24
0
        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);
        }
Exemple #25
0
        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);
                }
            }
        }
Exemple #26
0
 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);
 }
Exemple #28
0
        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);
 }