/** * table.h: Table rendering class. * * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team * Rights to this code are as documented in COPYING. * * * Portions of this file were derived from sources bearing the following license: * Copyright © 2007 William Pitcock * Rights to this code are as documented in doc/pod/license.pod. * * $Id: table.h,v 1.4 2007/09/16 18:54:42 pippijn Exp $ */ #ifndef ATHEME_TABLE_H #define ATHEME_TABLE_H struct table_t : zero_initialised { object_t parent; list_t rows; }; struct table_row_t : zero_initialised { int id; list_t cells; }; struct table_cell_t : zero_initialised { int width; /* only if first row. */ char *name; char *value; }; /* * Creates a new table object. Use object_unref() to destroy it. */ E table_t *table_new (char const * const fmt, ...); /* * Renders a table, each line going to callback(). */ E void table_render (table_t * t, void (*callback) (char const * const line, void *data), void *data); /* * Associates a value with a row. */ E void table_cell_associate (table_row_t * r, char const * const name, char const * const value); /* * Associates a row with a table. */ E table_row_t *table_row_new (table_t * t); #endif