Exemplo n.º 1
0
        /// <summary>
        /// Creates a new sub-context for writing, using a new scrawler.
        /// </summary>
        /// <param name="scrawler">The new scrawler to use for writing.</param>
        /// <param name="parentContext">The parent context, to birth this context from.</param>
        public SubWriteContext(Scrawler scrawler, ObjectWriteContext parentContext)
            : base(scrawler, parentContext.Stringifier)
        {
            ParentContext = parentContext;

            NullSymbol     = parentContext.NullSymbol;
            LineTerminator = parentContext.LineTerminator;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new write context which contains helper methods for writing to a <see cref="Scrawler"/>.
        /// </summary>
        /// <param name="scrawler">The scrawler to write to.</param>
        public WriteContext(Scrawler scrawler)
        {
            if (scrawler == null)
            {
                throw new ArgumentNullException(nameof(scrawler));
            }

            Scrawler = scrawler;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a new write context which contains helper methods for writing to a <see cref="Scrawler"/>.
        /// </summary>
        /// <param name="scrawler">The scrawler to use for writing.</param>
        /// <param name="stringifier">The stringifier to use for object stringification.</param>
        public ObjectWriteContext(Scrawler scrawler, Stringifier stringifier)
            : base(scrawler)
        {
            if (stringifier == null)
            {
                throw new ArgumentNullException(nameof(stringifier));
            }

            Stringifier = stringifier;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a new context with the same properties as the current context, but with the provided sub-scrawler.
 /// </summary>
 /// <param name="context">The context to create a sub context from.</param>
 /// <param name="subscrawler">The scrawler to use in the sub context.</param>
 public static SubWriteContext CreateSubContext(this ObjectWriteContext context, Scrawler subscrawler)
 => new SubWriteContext(subscrawler, context);