Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members

table.h

Go to the documentation of this file.
00001 /*--------------------------------------------------------------------
00002  *
00003  * (C) Copyright Koninklijke Philips Electronics NV 2006. 
00004  * All rights reserved. This software is licensed under the terms of
00005  * version 2.1 of the GNU Lesser General Public License as published 
00006  * by the Free Software Foundation. For licensing and warranty
00007  * information, see the file COPYING in the main directory.
00008  *
00009  *------------------------------------------------------------------*/
00010 
00011 #ifndef TABLE_H
00012 #define TABLE_H
00013 
00014 #include <vector>
00015 #include <iostream>
00016 
00017 class Table
00018 {
00019 public:
00020   enum Align {none, left, right, center};
00021 
00022   Table(unsigned int columns, const char* title);
00023   ~Table();
00024   void align(unsigned int col, Align al);
00025   Align align(int col) const;
00026 
00027   Table& operator<<(const char* s);
00028   Table& operator<<(int i);
00029 
00030   const char* title() const     { return t; }
00031   const char* item(unsigned int i) const;
00032   const char* item(unsigned int row, unsigned int col) const;
00033 
00034   unsigned int columns() const                    { return c; }
00035   unsigned int rows() const;
00036 
00037   // unsigned int width() const;
00038   // unsigned int height() const;
00039   unsigned int width(unsigned int col) const;
00040   // unsigned int height(unsigned int row) const     { return 1; }
00041 
00042   static bool format;
00043   void print(std::ostream& o) const;
00044   void clean();
00045 
00046 private:
00047   char*   t;  // title
00048   unsigned int  c;  // number of columns
00049   std::vector<Align>  a;  // alignment of column
00050   std::vector<char*>  v;  // the data
00051 };
00052 
00054 
00055 /*
00056 class Format
00057 {
00058 public:
00059   virtual void print(ostream& o, const Table& t) const = 0;
00060 };
00061 
00062 class Text : public Format
00063 {
00064 public:
00065   void print(ostream& o, const Table& t) const;
00066 };
00067 
00068 class Html : public Format
00069 {
00070 public:
00071   void print(ostream& o, const Table& t) const;
00072 };
00073 
00074 class Latex: public Format
00075 {
00076 public:
00077   void print(ostream& o, const Table& t) const;
00078 };
00079 */
00080 
00081 #endif

Generated on Wed Feb 15 14:52:39 2006 for yapi by doxygen 1.3.2