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
00047
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
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
00076
00077
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;
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
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__