/// <summary> /// Initializes a new instance of the <see cref="FormatTextWriter" /> class. /// </summary> /// <param name="writer">The out writer.</param> /// <exception cref="System.InvalidOperationException">Cannot wrap an ILayoutTextWriter in a FormatTextWriter as this can cause issues with position tracking.</exception> public FormatTextWriter([NotNull] TextWriter writer) : base(new UnderlyingFormatTextWriter(writer, new FormatBuilder(), 0)) { if (writer == null) { throw new ArgumentNullException("writer"); } _writer = (UnderlyingFormatTextWriter)Writer; }
/// <summary> /// Initializes a new instance of the <see cref="FormatTextWriter" /> class. /// </summary> /// <param name="writer">The out writer.</param> /// <param name="defaultLayout">The default layout.</param> /// <param name="startPosition">The starting horizontal position.</param> public FormatTextWriter( [NotNull] TextWriter writer, [CanBeNull] Layout defaultLayout, int startPosition = 0) : base(new UnderlyingFormatTextWriter(writer, new FormatBuilder(defaultLayout), startPosition)) { if (writer == null) { throw new ArgumentNullException("writer"); } _writer = (UnderlyingFormatTextWriter)Writer; }
/// <summary> /// Initializes a new instance of the <see cref="FormatTextWriter" /> class. /// </summary> /// <param name="writer">The out writer.</param> /// <param name="width">The width.</param> /// <param name="indentSize">Size of the indent.</param> /// <param name="rightMarginSize">Size of the right margin.</param> /// <param name="indentChar">The indent character.</param> /// <param name="firstLineIndentSize">First size of the line indent.</param> /// <param name="tabStops">The tab stops.</param> /// <param name="tabSize">Size of the tab.</param> /// <param name="tabChar">The tab character.</param> /// <param name="alignment">The alignment.</param> /// <param name="splitLength">The split length.</param> /// <param name="hyphenate">The hyphenate.</param> /// <param name="hyphenChar">The hyphen character.</param> /// <param name="wrapMode">The wrap mode.</param> /// <param name="startPosition">The starting horizontal position.</param> public FormatTextWriter( [NotNull] TextWriter writer, Optional <int> width = default(Optional <int>), Optional <int> indentSize = default(Optional <int>), Optional <int> rightMarginSize = default(Optional <int>), Optional <char> indentChar = default(Optional <char>), Optional <int> firstLineIndentSize = default(Optional <int>), Optional <IEnumerable <int> > tabStops = default(Optional <IEnumerable <int> >), Optional <byte> tabSize = default(Optional <byte>), Optional <char> tabChar = default(Optional <char>), Optional <Alignment> alignment = default(Optional <Alignment>), Optional <byte> splitLength = default(Optional <byte>), Optional <bool> hyphenate = default(Optional <bool>), Optional <char> hyphenChar = default(Optional <char>), Optional <LayoutWrapMode> wrapMode = default(Optional <LayoutWrapMode>), int startPosition = 0) : base(new UnderlyingFormatTextWriter( writer, new FormatBuilder( width, indentSize, rightMarginSize, indentChar, firstLineIndentSize, tabStops, tabSize, tabChar, alignment, splitLength, hyphenate, hyphenChar, wrapMode), startPosition)) { if (writer == null) { throw new ArgumentNullException("writer"); } _writer = (UnderlyingFormatTextWriter)Writer; }
/// <summary> /// Initializes a new instance of the <see cref="FormatTextWriter" /> class. /// </summary> /// <param name="writer">The out writer.</param> /// <exception cref="System.InvalidOperationException">Cannot wrap an ILayoutTextWriter in a FormatTextWriter as this can cause issues with position tracking.</exception> public FormatTextWriter([NotNull] TextWriter writer) : base(new UnderlyingFormatTextWriter(writer, new FormatBuilder(), 0)) { if (writer == null) throw new ArgumentNullException("writer"); _writer = (UnderlyingFormatTextWriter)Writer; }
/// <summary> /// Initializes a new instance of the <see cref="FormatTextWriter" /> class. /// </summary> /// <param name="writer">The out writer.</param> /// <param name="width">The width.</param> /// <param name="indentSize">Size of the indent.</param> /// <param name="rightMarginSize">Size of the right margin.</param> /// <param name="indentChar">The indent character.</param> /// <param name="firstLineIndentSize">First size of the line indent.</param> /// <param name="tabStops">The tab stops.</param> /// <param name="tabSize">Size of the tab.</param> /// <param name="tabChar">The tab character.</param> /// <param name="alignment">The alignment.</param> /// <param name="splitLength">The split length.</param> /// <param name="hyphenate">The hyphenate.</param> /// <param name="hyphenChar">The hyphen character.</param> /// <param name="wrapMode">The wrap mode.</param> /// <param name="startPosition">The starting horizontal position.</param> public FormatTextWriter( [NotNull] TextWriter writer, Optional<int> width = default(Optional<int>), Optional<int> indentSize = default(Optional<int>), Optional<int> rightMarginSize = default(Optional<int>), Optional<char> indentChar = default(Optional<char>), Optional<int> firstLineIndentSize = default(Optional<int>), Optional<IEnumerable<int>> tabStops = default(Optional<IEnumerable<int>>), Optional<byte> tabSize = default(Optional<byte>), Optional<char> tabChar = default(Optional<char>), Optional<Alignment> alignment = default(Optional<Alignment>), Optional<byte> splitLength = default(Optional<byte>), Optional<bool> hyphenate = default(Optional<bool>), Optional<char> hyphenChar = default(Optional<char>), Optional<LayoutWrapMode> wrapMode = default(Optional<LayoutWrapMode>), int startPosition = 0) : base(new UnderlyingFormatTextWriter( writer, new FormatBuilder( width, indentSize, rightMarginSize, indentChar, firstLineIndentSize, tabStops, tabSize, tabChar, alignment, splitLength, hyphenate, hyphenChar, wrapMode), startPosition)) { if (writer == null) throw new ArgumentNullException("writer"); _writer = (UnderlyingFormatTextWriter)Writer; }
/// <summary> /// Initializes a new instance of the <see cref="FormatTextWriter" /> class. /// </summary> /// <param name="writer">The out writer.</param> /// <param name="defaultLayout">The default layout.</param> /// <param name="startPosition">The starting horizontal position.</param> public FormatTextWriter( [NotNull] TextWriter writer, [CanBeNull] Layout defaultLayout, int startPosition = 0) : base(new UnderlyingFormatTextWriter(writer, new FormatBuilder(defaultLayout), startPosition)) { if (writer == null) throw new ArgumentNullException("writer"); _writer = (UnderlyingFormatTextWriter)Writer; }