00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef WEBSTATISTICSPAGE_H
00023 #define WEBSTATISTICSPAGE_H
00024
00025 #include "webpage.h"
00026 #include <list>
00027 #include "SDL/WebSrv.h"
00028
00029 using namespace std;
00030
00046 class DECLSPEC WebStatisticsPage : public WebPage
00047 {
00048 public:
00050 typedef char * (*Callback)( WebStatisticsPage *sender, void *data, const char *title, WebSrvClient * );
00051 struct TABLE_ROW
00052 {
00053 TABLE_ROW()
00054 {
00055 chTitle = NULL;
00056 cb = NULL;
00057 cbData = NULL;
00058 }
00059 TABLE_ROW( const TABLE_ROW &r )
00060 {
00061 if( r.chTitle ) {
00062 chTitle = new char[strlen(r.chTitle)+1];
00063 strcpy( chTitle, r.chTitle );
00064 }
00065 else chTitle = NULL;
00066 cb = r.cb;
00067 cbData = r.cbData;
00068 }
00069 ~TABLE_ROW()
00070 {
00071 if( chTitle )
00072 delete[] chTitle;
00073 }
00074 char *chTitle;
00075 void *cbData;
00076 Callback cb;
00077 };
00078 typedef list<TABLE_ROW>::iterator ItemIter;
00079
00080 DECLSPEC WebStatisticsPage( const char *uri );
00081 DECLSPEC ~WebStatisticsPage();
00082
00083 virtual DECLSPEC int send( WebSrvClient *client, Uint32 &responsecode );
00084
00085 DECLSPEC ItemIter addItem( const char *title, Callback c, void *cb_data );
00086 DECLSPEC void removeItem( ItemIter i );
00087
00088 DECLSPEC void setTitle( const char *t );
00089 DECLSPEC void setHeading( const char *t );
00090 DECLSPEC void setEnding( const char *t );
00091
00092 int wTableTitles,
00093 wTable, wBorder;
00094 Uint32 colorTable;
00095
00096 private:
00097 char *chTitle, *chHeading, *chEnding;
00098 list<TABLE_ROW> lItems;
00099 };
00100
00101 #endif