xbase.h

Go to the documentation of this file.
00001 /*  $Id: xbase.h.in,v 1.5 2000/11/10 19:30:29 dbryson Exp $
00002 
00003     Xbase project source code
00004 
00005     This file contains a header file for the xbXBase class, which is the
00006     base class for using the Xbase DBMS library.
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.8.0a 1/27/99    - Added DisplayError method
00048 */
00049 
00050 #ifndef __XB_XBASE_H__
00051 #define __XB_XBASE_H__
00052 
00053 #ifdef __GNUG__
00054 #pragma interface
00055 #endif
00056 
00057 #ifdef __WIN32__
00058 #include "xbase/xbconfigw32.h"
00059 #else
00060 #include "xbase/xbconfig.h"
00061 #endif
00062 
00063 //
00064 //  Identify ourselves
00065 //
00066 #define XDB_VERSION        "2.0.0"
00067 #define XBASE_VERSION        "2.0.0"
00068 
00069 #include <string.h>
00070 
00071 #if defined(__WIN32__)
00072 
00073 #include "windows.h"
00074 
00075 // ripped from wxWindows
00076 
00077 // _declspec works in BC++ 5 and later, as well as VC++
00078 #if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__GNUC__)
00079 #  ifdef XBMAKINGDLL
00080 #    define XBDLLEXPORT __declspec( dllexport )
00081 #    define XBDLLEXPORT_DATA(type) __declspec( dllexport ) type
00082 #    define XBDLLEXPORT_CTORFN
00083 #  elif defined(XBUSINGDLL)
00084 #    define XBDLLEXPORT __declspec( dllimport )
00085 #    define XBDLLEXPORT_DATA(type) __declspec( dllimport ) type
00086 #    define XBDLLEXPORT_CTORFN
00087 #  else
00088 #    define XBDLLEXPORT
00089 #    define XBDLLEXPORT_DATA(type) type
00090 #    define XBDLLEXPORT_CTORFN
00091 #  endif
00092 
00093 #else
00094 
00095 #  define XBDLLEXPORT
00096 #  define XBDLLEXPORT_DATA(type) type
00097 #  define XBDLLEXPORT_CTORFN
00098 #endif
00099 
00100 #else // !Windows
00101 #  define XBDLLEXPORT
00102 #  define XBDLLEXPORT_DATA(type) type
00103 #  define XBDLLEXPORT_CTORFN
00104 #endif // Win/!Win
00105 
00106 #include <xbase/xtypes.h>
00107 #include <xbase/retcodes.h>
00108 #include <xbase/xdate.h>
00109 
00110 #include <xbase/xbstring.h>
00111 
00112 #if defined(XB_EXPRESSIONS)
00113 #include <xbase/exp.h>
00114 #endif
00115 
00119 class XBDLLEXPORT xbDbf;
00120 
00122 
00125 struct XBDLLEXPORT xbDbList{
00126    xbDbList * NextDbf;
00127    char * DbfName;
00128    xbDbf  * dbf;
00129 };
00130 
00132 
00135 #if defined(XB_EXPRESSIONS)
00136 class XBDLLEXPORT xbXBase : public xbExpn {
00137 #else
00138 class XBDLLEXPORT xbXBase : public xbDate {
00139 #endif
00140 
00141 protected:
00142    xbDbList * DbfList;
00143    xbDbList * FreeDbfList;
00144    xbShort EndianType;                     /* B = Big Endian, L = Little Endian */
00145 
00146 public:
00147    ~xbXBase();
00148    xbXBase();
00149    xbShort  AddDbfToDbfList(xbDbf *d, const char *DatabaseName);
00150    xbDbf *  GetDbfPtr( const char *Name );
00151    xbShort  DirectoryExistsInName( const char *Name );
00152    xbShort  GetEndianType( void ) { return EndianType; }
00153    void     DisplayError( const xbShort ErrorCode ) const;
00154    static const char* GetErrorMessage( const xbShort ErrorNo );
00155 
00156    /* next 6 routines handle both big endian and little endian machines */
00157    xbDouble GetDouble( const char *p );
00158    xbLong   GetLong  ( const char *p );
00159    xbULong  GetULong ( const char *p );
00160    xbShort  GetShort ( const char *p );
00161    void   PutLong  ( char *p, const xbLong   l );
00162    void   PutShort ( char *p, const xbShort  s );
00163    void   PutULong ( char *p, const xbULong  l );
00164    void   PutUShort( char *p, const xbUShort s );
00165    void   PutDouble( char *p, const xbDouble d );
00166 
00167    xbShort  RemoveDbfFromDbfList( xbDbf * );
00168 };
00169 
00170 #include <xbase/dbf.h>
00171 
00172 #if defined(XB_INDEX_ANY)
00173 #include <xbase/index.h>
00174 #endif
00175 
00176 #ifdef XB_INDEX_NDX
00177 #include <xbase/ndx.h>
00178 #endif
00179 
00180 #ifdef XB_INDEX_NTX
00181 #include <xbase/ntx.h>
00182 #endif
00183 
00184 #if defined(XB_FILTERS) && !defined(XB_INDEX_ANY)
00185 #error XB_FILTERS cant be used without index support
00186 #elif defined(XB_FILTERS)
00187 #include <xbase/xbfilter.h>
00188 #endif
00189 
00190 #ifdef XB_LOCKING_ON
00191 
00192 #ifdef HAVE_FCNTL_H
00193 #include <fcntl.h>
00194 #endif
00195 
00196 #ifdef HAVE_SYS_LOCKING_H
00197 #include <sys/locking.h>
00198 #define F_SETLKW 0
00199 #define F_SETLK  1
00200 #define F_RDLCK  2
00201 #define F_WRLCK  3
00202 #define F_UNLCK  4
00203 #endif
00204 
00205 #else
00206 enum { F_SETLKW = 0, F_WRLCK = 0 };
00207 #endif
00208 
00209 #ifdef XB_HTML
00210 #include <xbase/html.h>
00211 #endif
00212 
00213 #endif          // __XB_XBASE_H__

Generated on Mon Sep 11 18:27:56 2006 for Xbase Class Library by  doxygen 1.4.7