public static FormatProcessor Get(OutputWriter outputWriter, FormatShape shape) { // we use cached instances as the instance is able then to continue old output if (_lastProcessor != null && _lastProcessor.Shape.Equals(shape) && _lastProcessor.OutputWriter.Equals(outputWriter)) { return _lastProcessor; } switch (shape) { case FormatShape.List: _lastProcessor = new ListFormatProcessor(outputWriter); break; case FormatShape.Table: _lastProcessor = new TableFormatProcessor(outputWriter); break; default: throw new PSInvalidOperationException("Cannot get FormatProcessor for undefined shape"); } return _lastProcessor; }
public static FormatProcessor Get(OutputWriter outputWriter, FormatShape shape) { // we use cached instances as the instance is able then to continue old output if (_lastProcessor != null && _lastProcessor.Shape.Equals(shape) && _lastProcessor.OutputWriter.Equals(outputWriter)) { return(_lastProcessor); } switch (shape) { case FormatShape.List: _lastProcessor = new ListFormatProcessor(outputWriter); break; case FormatShape.Table: _lastProcessor = new TableFormatProcessor(outputWriter); break; default: throw new PSInvalidOperationException("Cannot get FormatProcessor for undefined shape"); } return(_lastProcessor); }
protected FormatProcessor(FormatShape shape, OutputWriter outputWriter) { Shape = shape; OutputWriter = outputWriter; _state = FormattingState.FormatEnd; }
protected virtual void ProcessGroupEnd(GroupEndData data) { OutputWriter.WriteToErrorStream = false; OutputWriter.WriteLine(""); }
internal TableFormatProcessor(OutputWriter writer) : base(FormatShape.Table, writer) { }
internal ListFormatProcessor(OutputWriter writer) : base(FormatShape.List, writer) { }