00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef GXLIB_GXXMLTABLE_H
00019 #define GXLIB_GXXMLTABLE_H
00020
00021
00033 class gxXmlTable
00034 {
00035 public:
00036 gxXmlTable();
00037 virtual ~gxXmlTable();
00038
00039 int addHeaders( std::list<std::string> & items );
00040
00044 int addHeaders( const char * item1, const char * item2 = NULL,
00045 const char * item3 = NULL, const char * item4 = NULL);
00046
00047 int addRow( std::list<std::string> & items );
00051 int addRow( const char * item1, const char * item2 = NULL,
00052 const char * item3 = NULL, const char * item4 = NULL);
00057 int getColumnCount();
00061 std::string getColumnText(int index);
00066 int getColumnIndex(const char * text);
00070 std::string getId()
00071 {
00072 return m_tableId;
00073 }
00077 int getRowCount();
00081 std::string getItem( int rowIndex, int columnIndex );
00082
00083 enum error_codes_t {
00084 TABLE_OK = 0,
00085 TABLE_NOHEADERS = 1,
00086 TABLE_MULTIHEADERS = 2,
00087 TABLE_TOOFEW = 3,
00088 TABLE_TOOMANY = 4,
00089 };
00090 typedef std::vector<std::string> strings_t;
00091
00092 void setId( const char * id )
00093 {
00094 m_tableId = id;
00095 }
00100 void write( std::ostream & out );
00101 private:
00102 void copyStrings( std::list<std::string> & items, gxXmlTable::strings_t * result );
00103
00104 strings_t * m_headers;
00105
00106 typedef std::vector<strings_t> rows_t;
00107 rows_t m_rows;
00108
00109 std::string m_tableId;
00110 gxXmlTable( const gxXmlTable & rhs);
00111 gxXmlTable & operator=( const gxXmlTable & rhs);
00112 };
00113
00114
00115 #endif