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.19 2001/04/25 12:19:21 grubba Exp $ + // $Id: Table.pmod,v 1.20 2001/04/27 13:34:06 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,   //! grouping, sorting etc.   //!   //! All column references are case insensitive. A column can be referred to by   //! its position (starting from zero). All operations are non-destructive. That   //! means that a new table object will be returned after, for example, a sort.    -  + //! The table base-class.   class table {    static private mapping fieldmap;    static private array table, fields, types;       static private array|int remap(array|string|int cs, int|void forgive)    {    array v = ({});    int ap = arrayp(cs);    if(!ap) cs = ({ cs });    foreach(cs, string|int f)
pike.git/lib/modules/ADT.pmod/Table.pmod:429:    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    + //! @ignore   object ASCII = class { -  + //! @endignore    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
pike.git/lib/modules/ADT.pmod/Table.pmod:476:    string l = (indent+"-"+    Array.map(values(sizes),    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");    } + //! @ignore   }(); -  + //! @endignore      //! @endmodule      // Experimental   object SQL = class {    object decode(array t, void|mapping options)    {    // Yet to be done    return 0;    }