Xbase Class Library  2.0.0
xbase.h
Go to the documentation of this file.
1 /* $Id: xbase.h.in,v 1.5 2000/11/10 19:30:29 dbryson Exp $
2 
3  Xbase project source code
4 
5  This file contains a header file for the xbXBase class, which is the
6  base class for using the Xbase DBMS library.
7 
8  Copyright (C) 1997 StarTech, Gary A. Kunkel
9 
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Lesser General Public
12  License as published by the Free Software Foundation; either
13  version 2.1 of the License, or (at your option) any later version.
14 
15  This library is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public
21  License along with this library; if not, write to the Free Software
22  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 
24  Contact:
25 
26  Mail:
27 
28  Technology Associates, Inc.
29  XBase Project
30  1455 Deming Way #11
31  Sparks, NV 89434
32  USA
33 
34  Email:
35 
36  xbase@techass.com
37 
38  See our website at:
39 
40  xdb.sourceforge.net
41 
42 
43  V 1.0 10/10/97 - Initial release of software
44  V 1.5 1/2/98 - Added memo field support
45  V 1.6a 4/1/98 - Added expression support
46  V 1.6b 4/8/98 - Numeric index keys
47  V 1.8.0a 1/27/99 - Added DisplayError method
48 */
49 
50 #ifndef __XB_XBASE_H__
51 #define __XB_XBASE_H__
52 
53 #ifdef __GNUG__
54 #pragma interface
55 #endif
56 
57 #ifdef __WIN32__
58 #include "xbase/xbconfigw32.h"
59 #else
60 #include "xbase/xbconfig.h"
61 #endif
62 
63 //
64 // Identify ourselves
65 //
66 #define XDB_VERSION "2.0.0"
67 #define XBASE_VERSION "2.0.0"
68 
69 #include <string.h>
70 
71 #if defined(__WIN32__)
72 
73 #include "windows.h"
74 
75 // ripped from wxWindows
76 
77 // _declspec works in BC++ 5 and later, as well as VC++
78 #if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__GNUC__)
79 # ifdef XBMAKINGDLL
80 # define XBDLLEXPORT __declspec( dllexport )
81 # define XBDLLEXPORT_DATA(type) __declspec( dllexport ) type
82 # define XBDLLEXPORT_CTORFN
83 # elif defined(XBUSINGDLL)
84 # define XBDLLEXPORT __declspec( dllimport )
85 # define XBDLLEXPORT_DATA(type) __declspec( dllimport ) type
86 # define XBDLLEXPORT_CTORFN
87 # else
88 # define XBDLLEXPORT
89 # define XBDLLEXPORT_DATA(type) type
90 # define XBDLLEXPORT_CTORFN
91 # endif
92 
93 #else
94 
95 # define XBDLLEXPORT
96 # define XBDLLEXPORT_DATA(type) type
97 # define XBDLLEXPORT_CTORFN
98 #endif
99 
100 #else // !Windows
101 # define XBDLLEXPORT
102 # define XBDLLEXPORT_DATA(type) type
103 # define XBDLLEXPORT_CTORFN
104 #endif // Win/!Win
105 
106 #include <xbase/xtypes.h>
107 #include <xbase/retcodes.h>
108 #include <xbase/xdate.h>
109 
110 #include <xbase/xbstring.h>
111 
112 #if defined(XB_EXPRESSIONS)
113 #include <xbase/exp.h>
114 #endif
115 
120 
122 
127  char * DbfName;
129 };
130 
132 
135 #if defined(XB_EXPRESSIONS)
136 class XBDLLEXPORT xbXBase : public xbExpn {
137 #else
138 class XBDLLEXPORT xbXBase : public xbDate {
139 #endif
140 
141 protected:
144  xbShort EndianType; /* B = Big Endian, L = Little Endian */
145 
146 public:
147  ~xbXBase();
148  xbXBase();
149  xbShort AddDbfToDbfList(xbDbf *d, const char *DatabaseName);
150  xbDbf * GetDbfPtr( const char *Name );
151  xbShort DirectoryExistsInName( const char *Name );
152  xbShort GetEndianType( void ) { return EndianType; }
153  void DisplayError( const xbShort ErrorCode ) const;
154  static const char* GetErrorMessage( const xbShort ErrorNo );
155 
156  /* next 6 routines handle both big endian and little endian machines */
157  xbDouble GetDouble( const char *p );
158  xbLong GetLong ( const char *p );
159  xbULong GetULong ( const char *p );
160  xbShort GetShort ( const char *p );
161  void PutLong ( char *p, const xbLong l );
162  void PutShort ( char *p, const xbShort s );
163  void PutULong ( char *p, const xbULong l );
164  void PutUShort( char *p, const xbUShort s );
165  void PutDouble( char *p, const xbDouble d );
166 
167  xbShort RemoveDbfFromDbfList( xbDbf * );
168 };
169 
170 #include <xbase/dbf.h>
171 
172 #if defined(XB_INDEX_ANY)
173 #include <xbase/index.h>
174 #endif
175 
176 #ifdef XB_INDEX_NDX
177 #include <xbase/ndx.h>
178 #endif
179 
180 #ifdef XB_INDEX_NTX
181 #include <xbase/ntx.h>
182 #endif
183 
184 #if defined(XB_FILTERS) && !defined(XB_INDEX_ANY)
185 #error XB_FILTERS cant be used without index support
186 #elif defined(XB_FILTERS)
187 #include <xbase/xbfilter.h>
188 #endif
189 
190 #ifdef XB_LOCKING_ON
191 
192 #ifdef HAVE_FCNTL_H
193 #include <fcntl.h>
194 #endif
195 
196 #ifdef HAVE_SYS_LOCKING_H
197 #include <sys/locking.h>
198 #define F_SETLKW 0
199 #define F_SETLK 1
200 #define F_RDLCK 2
201 #define F_WRLCK 3
202 #define F_UNLCK 4
203 #endif
204 
205 #else
206 enum { F_SETLKW = 0, F_WRLCK = 0 };
207 #endif
208 
209 #ifdef XB_HTML
210 #include <xbase/html.h>
211 #endif
212 
213 #endif // __XB_XBASE_H__
xbXBase class
Definition: xbase.h:138
xbShort GetEndianType(void)
Definition: xbase.h:152
double xbDouble
xbDouble type
Definition: xtypes.h:76
xbDbList * FreeDbfList
Definition: xbase.h:143
xbShort EndianType
Definition: xbase.h:144
char * DbfName
Definition: xbase.h:127
xbDate class
Definition: xdate.h:78
#define XBDLLEXPORT
Definition: xbase.h:101
xbDbList * NextDbf
Definition: xbase.h:126
xbDbList struct
Definition: xbase.h:125
unsigned long int xbULong
xbULong type
Definition: xtypes.h:57
#define xbLong
Definition: xtypes.h:67
short int xbShort
xbShort type
Definition: xtypes.h:65
xbDbf * dbf
Definition: xbase.h:128
Definition: xbase.h:206
xbMH struct
Definition: dbf.h:201
unsigned short int xbUShort
xbUShort type
Definition: xtypes.h:61
xbDbList * DbfList
Definition: xbase.h:142
Definition: xbase.h:206