File: insert2.cc

package info (click to toggle)
bobcat 6.11.00-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,292 kB
  • sloc: cpp: 21,370; fortran: 6,507; makefile: 2,787; sh: 724; perl: 401; ansic: 26
file content (28 lines) | stat: -rw-r--r-- 738 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#define XERR
#include "csvtabdef.ih"

CSVTabDef &CSVTabDef::insert(FMT const &fmt)
{
    if (fmt.d_nCols != 1)
        throw Exception{} <<
            "table column definitions cannot span multiple columns (col. " <<
            d_idx << ')';

    if (FMT::lrcFun(fmt.d_align) == 0)
        throw Exception{} <<
            "table column alignments must be "
                "left, right or center (col. " << d_idx << ')';

    if (d_idx == d_format.size())
        d_format.push_back(fmt);
    else
    {
                                                // keep the larger width
        unsigned width = max(d_format[d_idx].d_width, fmt.d_width);
        (d_format[d_idx] = fmt).d_width = width;
    }

    ++d_idx;

    return *this;
}