webstatisticspage.h

Go to the documentation of this file.
00001 /********************************************************************************/
00002 /*                                                                              */
00003 /*  Netrinjo-Engine - a library for game-development                            */
00004 /*  Copyright (C) 2005 by Tobias Nadler                                         */
00005 /*                                                                              */
00006 /*  This library is free software; you can redistribute it and/or               */
00007 /*  modify it under the terms of the GNU Lesser General Public                  */
00008 /*  License as published by the Free Software Foundation; either                */
00009 /*  version 2.1 of the License, or (at your option) any later version.          */
00010 /*                                                                              */
00011 /*  This library is distributed in the hope that it will be useful,             */
00012 /*  but WITHOUT ANY WARRANTY; without even the implied warranty of              */
00013 /*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU           */
00014 /*  Lesser General Public License for more details.                             */
00015 /*                                                                              */
00016 /*  You should have received a copy of the GNU Lesser General Public            */
00017 /*  License along with this library; if not, write to the Free Software         */
00018 /*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   */
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 );// returns the number of bytes sent to client
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,// in percent
00093         wTable, wBorder;
00094     Uint32 colorTable;
00095 
00096 private:
00097     char *chTitle, *chHeading, *chEnding;
00098     list<TABLE_ROW> lItems;
00099 };
00100 
00101 #endif

Generated on Wed May 9 17:35:55 2007 for netrinjo by  doxygen 1.5.1