pike.git / lib / modules / ADT.pmod / Table.pmod

version» Context lines:

pike.git/lib/modules/ADT.pmod/Table.pmod:1:   // Table.pmod by Fredrik Noring, 1998 - // $Id: Table.pmod,v 1.18 2001/01/05 21:12:19 grubba Exp $ + // $Id: Table.pmod,v 1.19 2001/04/25 12:19:21 grubba Exp $      #pike __REAL_VERSION__   #define TABLE_ERR(msg) throw(({ "(Table) "+msg+"\n", backtrace() }))      //! ADT.Table is a generic module for manipulating tables.   //!   //! Each table contains one or several columns.   //! Each column is associated with a name, the column name.   //! Optionally, one can provide a column type. The Table module can do a number   //! of operations on a given table, like computing the sum of a column,
pike.git/lib/modules/ADT.pmod/Table.pmod:427:    {    options = options || ([]);    string rowsep = options->rowsep||"\n";    string colsep = options->colsep||"\t";    return Array.map(({ indices(t) }) + values(t),    lambda(array r, string colsep)    { return Array.map(r, _string)*colsep; }, colsep)*rowsep;    }   }();    + //! @module ASCII +    object ASCII = class {    object decode(string s, void|mapping options)    {    // Yet to be done.    return 0;    }    -  +  //! @decl string encode(object table, void|mapping options) +  //! +  //! This method returns a table represented in ASCII suitable for human eyes. +  //! @[options] is an optional mapping. If the keyword @tt{"indent"@} is used +  //! with a number, the table will be indented with that number of space +  //! characters. +     string encode(object t, void|mapping options)    {    options = options || ([]);    mapping sizes = ([]);    array fields = indices(t);    string indent = String.strmult(" ", options->indent);       t = t->copy(({ fields }) + values(t));    for(int field = 0; field < sizeof(fields); field++)    t = (t->map(lambda(mixed m, int field, mapping sizes)
pike.git/lib/modules/ADT.pmod/Table.pmod:469:    lambda(int n)    { return String.strmult("-", n); })*"---"+"-");    array table = values(t);    return (indent+" "+table[0]*" "+"\n"+l+"\n"+    Array.map(table[1..], lambda(array row, string indent)    { return indent+" "+row*" "; },    indent)*"\n"+(sizeof(table)>1?"\n":"")+l+"\n");    }   }();    + //! @endmodule +    // Experimental   object SQL = class {    object decode(array t, void|mapping options)    {    // Yet to be done    return 0;    }       array encode(object t, void|mapping options)    {