LAview.LaTeX-Struct/src/latex-struct/ColParam.vala

66 lines
1.3 KiB
Vala
Raw Normal View History

2014-04-09 17:43:14 +04:00
namespace LAview {
namespace Table {
/**
* Parameter of the table's column.
*/
public class ColParam : ADoc {
/**
* Column's alignment.
*
* Possible values: "c", "r", "l", ">{\centering}p{0.07\paperwidth}", etc.
*/
public string align { get; set; default = "c"; }
2014-04-09 17:43:14 +04:00
/**
* Number of left lines.
*/
public uint nllines { get; set; default = 1; }
2014-04-09 17:43:14 +04:00
/**
* Number of right lines.
*/
public uint nrlines { get; set; }
2014-04-09 17:43:14 +04:00
/**
2014-07-25 18:30:55 +04:00
* Constructs a new ``ColParam`` by it's properties.
2014-04-09 17:43:14 +04:00
*/
public ColParam.with_params (uint nllines = 1,
string align = "c",
uint nrlines = 0) {
this.nllines = nllines;
this.align = align;
this.nrlines = nrlines;
}
private ColParam () {}
/**
2014-07-25 18:30:55 +04:00
* Gets a copy of the ``ColParam``.
2014-04-09 17:43:14 +04:00
*/
public override IDoc copy () {
return new ColParam.with_params (nllines, align, nrlines);
}
/**
2014-07-25 18:30:55 +04:00
* Generates LaTeX string for the ``ColParam``.
2014-04-09 17:43:14 +04:00
*/
public override string generate () {
var result = new StringBuilder ();
for (uint i = 0; i < nllines; ++i)
result.append_c ('|');
result.append (align);
for (uint i = 0; i < nrlines; ++i)
result.append_c ('|');
return result.str;
}
}
}
}