ArgumentsToCellsConverter

convert arguments to Cell[]

class ArgumentsToCellsConverter (
Args...
) {}

Constructors

this
this(Args args)
Undocumented in source.

Members

Functions

cells
Cell[] cells()
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

text style

import scone.output.text_style : TextStyle;

auto converter1 = new ArgumentsToCellsConverter!(TextStyle)(TextStyle()
        .fg(Color.red).bg(Color.green));
assert(converter1.cells == []);
assert(converter1.length == 0);

auto converter2 = new ArgumentsToCellsConverter!(TextStyle)(TextStyle().fg(Color.red));
assert(converter2.cells == []);
assert(converter2.length == 0);

auto converter3 = new ArgumentsToCellsConverter!(TextStyle, string)(TextStyle()
        .fg(Color.red), "1");
assert(converter3.cells == [Cell('1', TextStyle().fg(Color.red))]);
assert(converter3.length == 1);

auto converter4 = new ArgumentsToCellsConverter!(TextStyle, Cell)(TextStyle()
        .fg(Color.red), Cell('1'));
assert(converter4.cells == [Cell('1', TextStyle(Color.initial, Color.initial))]);
assert(converter4.length == 1);

auto converter5 = new ArgumentsToCellsConverter!(StyledText)(StyledText("abc", TextStyle().fg(
        Color.red)));
assert(converter5.cells == [Cell('a', TextStyle(Color.red, Color.same)), Cell('b', TextStyle(Color.red, Color
            .same)), Cell('c', TextStyle(Color.red, Color.same))]);
assert(converter5.length == 3);

only color

auto converter1 = new ArgumentsToCellsConverter!(Color)(Color.green);
assert(converter1.cells == []);
assert(converter1.length == 0);

immutable and const

immutable(TextStyle) immutableStyle = TextStyle().fg(Color.yellow);
immutable(TextStyle) constStyle = TextStyle().fg(Color.red);
auto converter1 = new ArgumentsToCellsConverter!(immutable(TextStyle), const(TextStyle), string)(
        immutableStyle, constStyle, "1");
assert(converter1.length == 1);
assert(converter1.cells == [Cell('1', TextStyle().fg(Color.red))]);

Meta