Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

html.h

Go to the documentation of this file.
00001 /*  $Id: html.h,v 1.10 2003/08/16 19:59:39 gkunkel Exp $
00002 
00003     Xbase project source code
00004  
00005     This file contains a header file for the HTML object which is used
00006     for HTML generation.
00007 
00008     Copyright (C) 1997  Gary A. Kunkel   
00009 
00010     This library is free software; you can redistribute it and/or
00011     modify it under the terms of the GNU Lesser General Public
00012     License as published by the Free Software Foundation; either
00013     version 2.1 of the License, or (at your option) any later version.
00014 
00015     This library is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018     Lesser General Public License for more details.
00019 
00020     You should have received a copy of the GNU Lesser General Public
00021     License along with this library; if not, write to the Free Software
00022     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023 
00024     Contact:
00025 
00026       Mail:
00027 
00028         Technology Associates, Inc.
00029         XBase Project
00030         1455 Deming Way #11
00031         Sparks, NV 89434
00032         USA
00033 
00034       Email:
00035 
00036         xbase@techass.com
00037         xdb-devel@lists.sourceforge.net
00038         xdb-users@lists.sourceforge.net
00039 
00040       See our website at:
00041 
00042         xdb.sourceforge.net
00043 
00044 */
00045 
00046 #ifndef __XB_HTML_H__
00047 #define __XB_HTML_H__
00048 
00049 #ifdef __GNUG__
00050 #pragma interface
00051 #endif
00052 
00053 #ifdef __WIN32__
00054 #include <xbase/xbconfigw32.h>
00055 #else
00056 #include <xbase/xbconfig.h>
00057 #endif
00058 
00059 #include <stdlib.h>
00060 #include <string.h>
00061 
00062 #include <xbase/xtypes.h>
00063 
00067 
00068 
00071 struct xbFieldList{
00072    char * Label;                     /* field label on form */
00073    char * FieldName;                 /* form field name     */
00074    xbShort FieldLen;                   /* form display length */
00075    xbShort FieldNo;                    /* database field no   */
00076    xbShort Option;                     /* field option        */
00077 };
00078 
00079 typedef char **xbArrayPtr;
00080 
00082 
00084 class XBDLLEXPORT xbHtml {
00085 public:
00086    xbHtml();
00087    virtual ~xbHtml();
00088 
00090 
00092    void   BoldOff( void ) { std::cout << "</b>\n"; };
00094 
00096    void   BoldOn( void ) { std::cout << "<b>"; };
00098 
00100    void   Bullet( void ) { std::cout << "<li>"; };
00101    void   DumpArray( void );
00103 
00105    void   EmphasizeOff( void ) { std::cout << "</em>\n"; };
00107 
00109    void   EmphasizeOn( void ) { std::cout << "<em>"; };
00111 
00113    void   EndHtmlPage( void ) { std::cout << "</BODY>\n</HTML>\n"; }
00114    xbShort  GenFormFields(xbDbf *d, xbShort Option,const char * Title,xbFieldList *fl);
00115    xbShort  GetArrayNo( const char * FieldName );
00116    const  char * GetCookie( const char *CookieName );
00117    char * GetData( xbShort );
00118    char * GetDataForField( const char *FieldName );
00119    char * GetEnv( char * s ){ return getenv( s ); }
00120    xbShort  GetMethod( void );
00122 
00124    void   HeaderOff( xbShort i ){ std::cout << "</h" << i << ">\n"; };
00126 
00128    void   HeaderOn( xbShort i ){ std::cout << "<h" << i << ">\n"; };
00130 
00132    void   ItalicOff( void ) { std::cout << "</i>\n"; };
00134 
00136    void   ItalicOn( void ) { std::cout << "<i>"; };
00138 
00140    void   NewLine( void ) { std::cout << "<br>"; }
00141    xbShort  PostMethod( void );
00142    void   PrintEncodedChar( char );
00143    void   PrintEncodedString( const char *s );
00145 
00147    void   PrintHtml( char * s ) { std::cout << s; };
00149 
00151    void   PrintHtml( xbLong l ) { std::cout << l; };
00153 
00155    void   PrintHtml( xbShort i ) { std::cout << i; };
00157 
00159    void   PrintHtml( int i ) { std::cout << i; };
00160    void   StartHtmlPage( const char *Title );
00162 
00164    void   StartTextPage( void ) { std::cout << "Content-type: text/plain\n\n"; }
00165    void   TextOut( const char *String );
00166    xbLong   Tally( const char *FileName );
00167    xbShort  SetCookie(const char *Name, const char *Value, const char *ExpDate,
00168            const char *ExpTime,const char *TimeZone, const char *Path,
00169            const char *Domain, xbShort Secure );
00170    void   SpaceToPlus( char * );
00171    void   PlusToSpace( char * );
00172    void   SendRedirect( char * ) const;
00173 
00174 protected:
00175    xbArrayPtr FieldNameArray;
00176    xbArrayPtr DataValueArray;
00177    xbShort    NoOfDataFields;
00178    char     * HtmlWorkBuf;
00179    xbShort    HtmlBufLen;
00180    void     LoadArray( void );
00181    void     DeleteEscChars( char *String );
00182    void     InitVals( void );
00183 };
00184 
00185 #endif      // __XB_HTML_H__

Generated on Sun Jan 9 21:51:46 2005 for Xbase Class Library by  doxygen 1.4.1