Ejemplo n.º 1
0
 /// <summary>
 /// Appends the given <see cref="ChainedSerializer"/> to this serializer.
 /// </summary>
 /// <param name="nextSerializer">The serializer to append.</param>
 public void Append([CanBeNull] ChainedSerializer nextSerializer)
 {
     // Update current Next if non-null to target the last of the chain we're appending
     Next?.SetPrev(nextSerializer?.Last);
     nextSerializer?.Last.SetNext(Next);
     // Set the current Next to the given serializer
     Next = nextSerializer;
     // Make sure that the link with the old Prev of the given serializer is cleared
     nextSerializer?.Prev?.SetNext(null);
     // And set the Prev of the given serializer to be this one.
     nextSerializer?.SetPrev(this);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Prepends the given <see cref="ChainedSerializer"/> to this serializer.
 /// </summary>
 /// <param name="previousSerializer">The serializer to prepend.</param>
 public void Prepend([CanBeNull] ChainedSerializer previousSerializer)
 {
     // Update current Prev if non-null to target the first of the chain we're prepending
     Prev?.SetNext(previousSerializer?.First);
     previousSerializer?.First.SetPrev(Prev);
     // Set the current Prev to the given serializer
     Prev = previousSerializer;
     // Make sure that the link with the old Next of the given serializer is cleared
     previousSerializer?.Next?.SetPrev(null);
     // And set the Next of the given serializer to be this one.
     previousSerializer?.SetNext(this);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Sets the serializer to chain with an instance of <see cref="ChainedSerializer"/>.
 /// </summary>
 /// <param name="chained">The chained serializer.</param>
 /// <param name="serializer">The serializer to chain.</param>
 /// <returns>The chained argument passed in the <paramref name="chained"/> parameter.</returns>
 public static ChainedSerializer Prepend(ChainedSerializer chained, IYamlSerializable serializer)
 {
     chained.PrependTo(serializer);
     return chained;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Sets the serializer to chain with an instance of <see cref="ChainedSerializer"/>.
 /// </summary>
 /// <param name="chained">The chained serializer.</param>
 /// <param name="serializer">The serializer to chain.</param>
 /// <returns>The chained argument passed in the <paramref name="chained"/> parameter.</returns>
 public static ChainedSerializer Prepend(ChainedSerializer chained, IYamlSerializable serializer)
 {
     chained.PrependTo(serializer);
     return(chained);
 }
Ejemplo n.º 5
0
 private void SetNext(ChainedSerializer next) => Next = next;
Ejemplo n.º 6
0
 private void SetPrev(ChainedSerializer prev) => Prev = prev;