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

xbase.h

Go to the documentation of this file.
00001 /* $Id: xbase.h.in,v 1.11 2003/08/16 19:59:39 gkunkel 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 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_XBASE_H__ 00047 #define __XB_XBASE_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 // 00060 // Identify ourselves 00061 // 00062 #define XDB_VERSION "2.1.1" 00063 #define XBASE_VERSION "2.1.1" 00064 00065 #include <string.h> 00066 00067 #if defined(__WIN32__) 00068 00069 #include "windows.h" 00070 00071 // ripped from wxWindows 00072 00073 // _declspec works in BC++ 5 and later, as well as VC++ 00074 #if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__GNUC__) 00075 # ifdef XBMAKINGDLL 00076 # define XBDLLEXPORT __declspec( dllexport ) 00077 # define XBDLLEXPORT_DATA(type) __declspec( dllexport ) type 00078 # define XBDLLEXPORT_CTORFN 00079 # elif defined(XBUSINGDLL) 00080 # define XBDLLEXPORT __declspec( dllimport ) 00081 # define XBDLLEXPORT_DATA(type) __declspec( dllimport ) type 00082 # define XBDLLEXPORT_CTORFN 00083 # else 00084 # define XBDLLEXPORT 00085 # define XBDLLEXPORT_DATA(type) type 00086 # define XBDLLEXPORT_CTORFN 00087 # endif 00088 00089 #else 00090 00091 # define XBDLLEXPORT 00092 # define XBDLLEXPORT_DATA(type) type 00093 # define XBDLLEXPORT_CTORFN 00094 #endif 00095 00096 #else // !Windows 00097 # define XBDLLEXPORT 00098 # define XBDLLEXPORT_DATA(type) type 00099 # define XBDLLEXPORT_CTORFN 00100 #endif // Win/!Win 00101 00102 #include "xtypes.h" 00103 #include "retcodes.h" 00104 #include "xdate.h" 00105 00106 #include "xbstring.h" 00107 00108 #if defined(XB_EXPRESSIONS) 00109 #include "exp.h" 00110 #endif 00111 00112 #ifndef XB_MIN 00113 #define XB_MIN(a, b) (((a) < (b)) ? (a) : (b)) 00114 #endif /* XB_MIN */ 00115 00116 #ifndef XB_MAX 00117 #define XB_MAX(a, b) (((a) < (b)) ? (b) : (a)) 00118 #endif /* XB_MAX */ 00119 00123 class XBDLLEXPORT xbDbf; 00124 00126 00129 struct XBDLLEXPORT xbDbList{ 00130 xbDbList * NextDbf; 00131 char * DbfName; 00132 xbDbf * dbf; 00133 }; 00134 00136 00139 #if defined(XB_EXPRESSIONS) 00140 class XBDLLEXPORT xbXBase : public xbExpn { 00141 #else 00142 class XBDLLEXPORT xbXBase : public xbDate { 00143 #endif 00144 00145 protected: 00146 xbDbList * DbfList; 00147 xbDbList * FreeDbfList; 00148 xbShort EndianType; /* B = Big Endian, L = Little Endian */ 00149 00150 public: 00151 ~xbXBase(); 00152 xbXBase(); 00153 xbShort AddDbfToDbfList(xbDbf *d, const char *DatabaseName); 00154 xbDbf * GetDbfPtr( const char *Name ); 00155 xbShort DirectoryExistsInName( const char *Name ); 00156 xbShort GetEndianType( void ) { return EndianType; } 00157 void DisplayError( const xbShort ErrorCode ) const; 00158 static const char* GetErrorMessage( const xbShort ErrorNo ); 00159 00160 /* next 6 routines handle both big endian and little endian machines */ 00161 xbDouble GetDouble( const char *p ); 00162 xbLong GetLong ( const char *p ); 00163 xbULong GetULong ( const char *p ); 00164 xbShort GetShort ( const char *p ); 00165 00166 xbULong GetHBFULong( const char *p ); 00167 xbShort GetHBFShort ( const char *p ); 00168 00169 void PutLong ( char *p, const xbLong l ); 00170 void PutShort ( char *p, const xbShort s ); 00171 void PutULong ( char *p, const xbULong l ); 00172 void PutUShort( char *p, const xbUShort s ); 00173 void PutDouble( char *p, const xbDouble d ); 00174 00175 xbShort RemoveDbfFromDbfList( xbDbf * ); 00176 }; 00177 00178 #include "dbf.h" 00179 00180 #if defined(XB_INDEX_ANY) 00181 #include "index.h" 00182 #endif 00183 00184 #ifdef XB_INDEX_NDX 00185 #include "ndx.h" 00186 #endif 00187 00188 #ifdef XB_INDEX_NTX 00189 #include "ntx.h" 00190 #endif 00191 00192 #if defined(XB_FILTERS) && !defined(XB_INDEX_ANY) 00193 #error XB_FILTERS cant be used without index support 00194 #elif defined(XB_FILTERS) 00195 #include "xbfilter.h" 00196 #endif 00197 00198 // 00199 // Use these instead of F_SETLK and F_SETLKW to insure Xbase gets 00200 // the right value rather than whatever is defined in your environment 00201 // during compile. 00202 // 00203 XBDLLEXPORT_DATA(extern const int) 00204 xbF_SETLK, 00205 xbF_SETLKW; 00206 00207 #ifdef XB_LOCKING_ON 00208 00209 #ifdef HAVE_FCNTL_H 00210 #include <fcntl.h> 00211 #endif 00212 00213 #ifdef HAVE_SYS_LOCKING_H 00214 #include <sys/locking.h> 00215 #define F_SETLKW 0 00216 #define F_SETLK 1 00217 #define F_RDLCK 2 00218 #define F_WRLCK 3 00219 #define F_UNLCK 4 00220 #endif 00221 00222 #else 00223 enum { F_SETLKW = 0, F_WRLCK = 0 }; 00224 #endif 00225 00226 #ifdef XB_HTML 00227 #include "html.h" 00228 #endif 00229 00230 #endif // __XB_XBASE_H__

Generated on Sat Sep 11 04:01:10 2004 for Xbase Class Library by doxygen 1.3.7