/// <remarks> /// List's description must provide a valid implement for its ObjectToIndex /// /// Reading runs the <paramref name="ctor"/> then calls the object's serialize method. It then uses /// ObjectToIndex to figure out where to add the object within the list /// /// Writing will skip items that return true with <paramref name="writeShouldSkip"/>. If the predicate /// is null, it defaults to one which always returns false, so -all- items will be written /// /// The caller can define when the serialize method of the object is called during reads via <paramref name="getReadMode"/>. /// This is useful when the <paramref name="ctor"/> actually populates the Id of the object, instead of reading it /// </remarks> public static void Serialize <TDoc, TCursor, T, TContext>(IO.TagElementStream <TDoc, TCursor, string> s, string elementName, ActiveList <T> list, TContext ctxt, Func <IO.TagElementStream <TDoc, TCursor, string>, TContext, T> ctor, Predicate <T> writeShouldSkip = null, Func <TContext, TagElementStreamReadMode> getReadMode = null) where TDoc : class where TCursor : class where T : class, IO.ITagElementStringNameStreamable { Contract.Requires(list != null); Contract.Requires(ctor != null); if (writeShouldSkip == null) { writeShouldSkip = Predicates.False; } if (s.IsReading) { TagElementTextStreamUtils <TDoc, TCursor, T, TContext> .ReadElements(s, elementName, list, ctxt, ctor, getReadMode); } else if (s.IsWriting) { TagElementTextStreamUtils <TDoc, TCursor, T, TContext> .WriteElements(s, elementName, list, writeShouldSkip); } }
public override void ReadAttribute(string name, ref float value) { TagElementTextStreamUtils.ParseString(ReadAttribute(name), ref value, kThrowExcept, mReadErrorState); }
protected override void ReadElement(TCursor n, ref double value) { TagElementTextStreamUtils.ParseString(GetInnerText(n), ref value, kThrowExcept, mReadErrorState); }
public override bool ReadAttributeOpt(string name, ref double value) { return(TagElementTextStreamUtils.ParseString(ReadAttributeOpt(name), ref value, kNoExcept, mReadErrorState)); }