004
Four legs, and a top useful for placing your mug on.
Defining a table
begin_table(bool rows_cols)
Starts a table definition at the current insert position. The boolean argument is taken to mean column-majority in the case of true, and row-majority in the false case.
end_table
Ends the last table definition that was started with begin_table.
row_break
Signals that the current row (or cell in a column-major table) is fully defined.
column_break
Signals that the current column (or cell in a row-major table) is fully defined.
bool_break(bool row_col)
The boolean argument selects whether to operate as row_break or column_break.
colspan
The argument specifies the number of cells the current cell will take up, expanding from the current position to the right.
rowspan
The argument specifies the number of cells the current cell will take up, expanding from the current position downward.
bool_span(bool row_col)
The boolean argument selects whether to operate as rowspan or colspan, the second argument behaves as though respectively passed to either aforementioned constructors.
transpose
Turns a column-major table into a row-major one, or the other way around. This effectively also switches colspan and rowspan usages into each other.
The table can be composed in two ways: you either construct columns of rows, or else rows of columns. When constructing columns of rows, you start with column one. When the upperleft cell has been defined, you have to insert a row_break (if there will be more than one row in the table you’re defining). You then define the cell below the upperleft one, and so on until you complete all required rows. Inserting a column_break signals the beginning of the second column. Repeat until all cells are defined. Interchange row_break and column_break in the above if you are defining the table in row-major order instead. Then you move to the right in one successive row at a time. The order can be specified as a boolean argument to begin_table(majority).
When the stream is in a position to accept data for the current cell, then the stream can also relate any received box model modifiers, or colspan or rowspan objects, to the current cell. A cell can only be modified from when it is reached for the first time. When colspan or rowspan have been previously used, then the next time you could presume to have reached the same cell again it will in actuality be skipped and the next cell in definition order will have been reached instead.
Make sure you keep in mind the natural order of the table, or things might segfault on you. Mentally, divide the picture of the table you want to draw into a grid. On this grid, imagine colspan and rowspan repeat the same contents amongst the number of cells they span. If cell contents overlap in this mental picture, then there is something wrong with the definition, and a segfault will occur. Also make sure there are no cells undefined in this mental grid overlay.
Tables are block-elements, as are cells within.
<
>
006
The ellipsoid model is still in development. For now, please resort to the
Box model
padding(top,right,bottom,left)
padding(topbottom,rightleft)
padding(topbottomrightleft)
Stream a ‘padding’ to define the space between the content of a block element and its border.
border(top,right,bottom,left)
border(topbottom,rightleft)
border(topbottomrightleft)
Stream a ‘border’ to define the width of the border between the padding of a block element and its margin.
margin(top,right,bottom,left)
margin(topbottom,rightleft)
margin(topbottomrightleft)
Stream a ‘margin’ to define the widths of space around the border of a block element.
separator(width)
Only affects colums, rows, or sections thereof. Set number of separators.
Box-border manipulators operate on block-elements only.
Example:
os << begin_table(false) << border(2)
<< "1x1" << padding(1)
<< column_break << "1x2" << padding(2) << border(2)
<< column_break << "1x3" << rowspan(2)
<< row_break << "2x1" << colspan(2)
<< row_break << "3x1"
<< column_break << "3x2" << border(1,2,2,1)
<< column_break << "3x3" << margin(1)
<< end_table
<< std::flush;
Output:
╭───────────────────────────╮
│╭─────────────────────────╮│
││╭─────╮╭─────────╮╭─────╮││
│││ ││╭───────╮││1x3 │││
│││ 1x1 │││ │││ │││
│││ │││ │││ │││
│││ │││ 1x2 │││ │││
│││ │││ │││ │││
│││ │││ │││ │││
│││ ││╰───────╯││ │││
││╰─────╯╰─────────╯│ │││
││╭────────────────╮│ │││
│││2x1 ││ │││
││╰────────────────╯╰─────╯││
││╭─────╮╭────────╮╮ ││
│││3x1 ││3x2 ││ ╭───╮ ││
│││ ││ ││ │3x3│ ││
│││ ││╰───────╯│ ╰───╯ ││
││╰─────╯╰─────────╯ ││
│╰─────────────────────────╯│
╰───────────────────────────╯
<
>
007
Going to war with the
Bulleted list
list
Signals the beginning of a list.
item
Signals the beginning of an item (also the end of any previous item).
end_list
Signals the end of a list.
Lists are block-elements, as are items.
Example:
os << list
<< item << "Potatoes"
<< item << "Tomatoes"
<< item << "Toilet paper"
<< item << "Toilet paper"
<< item << "Toilet paper\n"
<< "Toilet paper"
<< item << "..."
<< std::flush;
Output:
• Potatoes
• Tomatoes
• Toilet paper
• Toilet paper
• Toilet paper
Toilet paper
• ...
<