html.h

Go to the documentation of this file.
00001 /*  $Id: html.h,v 1.7 2000/11/10 19:04:17 dbryson 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  StarTech, 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 
00038       See our website at:
00039 
00040         xdb.sourceforge.net
00041 
00042 
00043     V 1.0    10/10/97   - Initial release of software
00044     V 1.5    1/2/98     - Added memo field support
00045     V 1.6a   4/1/98     - Added expression support
00046     V 1.6b   4/8/98     - Numeric index keys
00047     V 1.7.4c 10/26/98   - Added GenFormFields, SetCookie, GetCookie
00048     V 1.8    11/29/98   - Version 1.8 upgrade
00049 */
00050 
00051 #ifndef __XB_HTML_H__
00052 #define __XB_HTML_H__
00053 
00054 #ifdef __GNUG__
00055 #pragma interface
00056 #endif
00057 
00058 #ifdef __WIN32__
00059 #include <xbase/xbconfigw32.h>
00060 #else
00061 #include <xbase/xbconfig.h>
00062 #endif
00063 
00064 #include <stdlib.h>
00065 #include <string.h>
00066 
00067 #include <xbase/xtypes.h>
00068 
00072 
00073 
00076 struct xbFieldList{
00077    char * Label;                     /* field label on form */
00078    char * FieldName;                 /* form field name     */
00079    xbShort FieldLen;                   /* form display length */
00080    xbShort FieldNo;                    /* database field no   */
00081    xbShort Option;                     /* field option        */
00082 };
00083 
00084 typedef char **xbArrayPtr;
00085 
00087 
00089 class XBDLLEXPORT xbHtml {
00090 public:
00091    xbHtml  ( void );
00093 
00095    void   BoldOff( void ) { cout << "</b>\n"; };
00097 
00099    void   BoldOn( void ) { cout << "<b>"; };
00101 
00103    void   Bullet( void ) { cout << "<li>"; };
00104    void   DumpArray( void );
00106 
00108    void   EmphasizeOff( void ) { cout << "</em>\n"; };
00110 
00112    void   EmphasizeOn( void ) { cout << "<em>"; };
00114 
00116    void   EndHtmlPage( void ) { cout << "</BODY>\n</HTML>\n"; }
00117    xbShort  GenFormFields(xbDbf *d, xbShort Option,const char * Title,xbFieldList *fl);
00118    xbShort  GetArrayNo( const char * FieldName );
00119    const  char * GetCookie( const char *CookieName );
00120    char * GetData( xbShort );
00121    char * GetDataForField( const char *FieldName );
00122    char * GetEnv( char * s ){ return getenv( s ); }
00123    xbShort  GetMethod( void );
00125 
00127    void   HeaderOff( xbShort i ){ cout << "</h" << i << ">\n"; };
00129 
00131    void   HeaderOn( xbShort i ){ cout << "<h" << i << ">\n"; };
00133 
00135    void   ItalicOff( void ) { cout << "</i>\n"; };
00137 
00139    void   ItalicOn( void ) { cout << "<i>"; };
00141 
00143    void   NewLine( void ) { cout << "<br>"; }
00144    xbShort  PostMethod( void );
00145    void   PrintEncodedChar( char );
00146    void   PrintEncodedString( const char *s );
00148 
00150    void   PrintHtml( char * s ) { cout << s; };
00152 
00154    void   PrintHtml( xbLong l ) { cout << l; };
00156 
00158    void   PrintHtml( xbShort i ) { cout << i; };
00160 
00162    void   PrintHtml( int i ) { cout << i; };
00163    void   StartHtmlPage( const char *Title );
00165 
00167    void   StartTextPage( void ) { cout << "Content-type: text/plain\n\n"; }
00168    void   TextOut( const char *String );
00169    xbLong   Tally( const char *FileName );
00170    xbShort  SetCookie(const char *Name, const char *Value, const char *ExpDate,
00171            const char *ExpTime,const char *TimeZone, const char *Path,
00172            const char *Domain, xbShort Secure );
00173    void   SpaceToPlus( char * );
00174    void   PlusToSpace( char * );
00175    void   SendRedirect( char * ) const;
00176 
00177 protected:
00178    xbArrayPtr FieldNameArray;
00179    xbArrayPtr DataValueArray;
00180    xbShort    NoOfDataFields;
00181    char     * HtmlWorkBuf;
00182    xbShort    HtmlBufLen;
00183    void     LoadArray( void );
00184    void     DeleteEscChars( char *String );
00185    void     InitVals( void );
00186 };
00187 
00188 #endif      // __XB_HTML_H__

Generated on Tue Oct 30 09:55:11 2007 for Xbase Class Library by  doxygen 1.5.2