C# Class TextTools.TextTable

A class for rendering text based tables. This class needs just a printing function (like Console.WriteLine) and the maximum width of the table that has to be rendered. Therefore it is suitable for use in linux consoles with Mono
Afficher le fichier Open project: txdv/sharpmod Class Usage Examples

Méthodes publiques

Méthode Description
Render ( IList data ) : void

The Render function which uses Console.Write for printing and Console.WindowWith to determine the with of the console.

Render ( IList data, OutputFunction outputFunction, int maximumWidth ) : void

The classic Render functions, which lets you supply the maximum width and the function which has to be used for printing.

TextTable ( IList
header ) : System

A constructor which requires an array of Header or a class with the IList

interaface implemeneted.

TextTable ( IList header ) : System

A constructor which requires an array of strings or a class with the IList interaface implemeneted. Internally the array will be converted in an array of Header with the default values used in TextTable.

Méthodes protégées

Méthode Description
GetHeaderArrayOfStringArray ( IList header ) : TextTools.Header[]

A function for converting the string array into a header array, needed to fit in the constructor.

GetLongestDataEntryLength ( IList data, int row ) : int

Gets the longest data entry length in a data set of a specific row.

GetLongestDataEntryLengthArray ( IList data ) : int[]

Gets the longest data entry lengths of all rows.

Trim ( Align alignment, string text, int length ) : string

Trims the text according to length and alignment.

Method Details

GetHeaderArrayOfStringArray() protected static méthode

A function for converting the string array into a header array, needed to fit in the constructor.
protected static GetHeaderArrayOfStringArray ( IList header ) : TextTools.Header[]
header IList /// An array of strings ///
Résultat TextTools.Header[]

GetLongestDataEntryLength() protected méthode

Gets the longest data entry length in a data set of a specific row.
protected GetLongestDataEntryLength ( IList data, int row ) : int
data IList /// A data object ///
row int /// The row to examine ///
Résultat int

GetLongestDataEntryLengthArray() protected méthode

Gets the longest data entry lengths of all rows.
protected GetLongestDataEntryLengthArray ( IList data ) : int[]
data IList /// A data object ///
Résultat int[]

Render() public méthode

The Render function which uses Console.Write for printing and Console.WindowWith to determine the with of the console.
public Render ( IList data ) : void
data IList /// A data object, the second dimension must fit the header length. ///
Résultat void

Render() public méthode

The classic Render functions, which lets you supply the maximum width and the function which has to be used for printing.
public Render ( IList data, OutputFunction outputFunction, int maximumWidth ) : void
data IList /// A data object ///
outputFunction OutputFunction /// A delegate to the output function ///
maximumWidth int /// the maximum width of the table ///
Résultat void

TextTable() public méthode

A constructor which requires an array of Header or a class with the IList
interaface implemeneted.
public TextTable ( IList
header ) : System
header IList
/// A header array ///
Résultat System

TextTable() public méthode

A constructor which requires an array of strings or a class with the IList interaface implemeneted. Internally the array will be converted in an array of Header with the default values used in TextTable.
public TextTable ( IList header ) : System
header IList /// A string array ///
Résultat System

Trim() protected méthode

Trims the text according to length and alignment.
protected Trim ( Align alignment, string text, int length ) : string
alignment Align /// Alignment value ///
text string /// Text to trim ///
length int /// The maximum length ///
Résultat string