00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
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
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
00072
00073
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
00115
00116 #ifndef XB_MAX
00117 #define XB_MAX(a, b) (((a) < (b)) ? (b) : (a))
00118 #endif
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;
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
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
00200
00201
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__