Xbase Class Library  2.0.0
index.h
Go to the documentation of this file.
1 /* $Id: index.h,v 1.5 2000/11/10 19:04:17 dbryson Exp $
2 
3  Xbase project source code
4 
5  This file contains a header file for the NTX object, which is used
6  for handling NTX type indices. NTX are the Clipper equivalant of xbNdx
7  files.
8 
9  Copyright (C) 1998 SynXis Corp., Bob Cotton
10 
11  This library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU Lesser General Public
13  License as published by the Free Software Foundation; either
14  version 2.1 of the License, or (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  Lesser General Public License for more details.
20 
21  You should have received a copy of the GNU Lesser General Public
22  License along with this library; if not, write to the Free Software
23  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 
25  Contact:
26 
27  Mail:
28 
29  Technology Associates, Inc.
30  XBase Project
31  1455 Deming Way #11
32  Sparks, NV 89434
33  USA
34 
35  Email:
36 
37  xbase@techass.com
38 
39  See our website at:
40 
41  xdb.sourceforge.net
42 
43 
44  V 1.0 9/1/98 - Initial release of software
45 */
46 
47 #ifndef __XB_INDEX_H__
48 #define __XB_INDEX_H__
49 
50 #ifdef __GNUG__
51 #pragma interface
52 #endif
53 
54 #include <xbase/xbase.h>
55 #include <string.h>
56 
60 #define XB_UNIQUE 1
61 #define XB_NOT_UNIQUE 0
62 
64 
68 {
69  public:
72  xbExpNode *ExpressionTree;
73 
75  FILE *indexfp;
76 
77  int IndexStatus; /* 0 = closed, 1 = open */
78 
79  xbLong CurDbfRec; /* current Dbf record number */
80  char *KeyBuf; /* work area key buffer */
81  char *KeyBuf2; /* work area key buffer */
82 
83 #ifdef XB_LOCKING_ON
84 protected:
85  int CurLockCount;
86  int CurLockType;
87 #endif
88 
90 
91 public:
92  xbIndex() {}
93  xbIndex(xbDbf *);
94 
95  virtual ~xbIndex() {}
96 
97  virtual xbShort OpenIndex ( const char * ) = 0;
98  virtual xbShort CloseIndex() = 0;
99 #ifdef XBASE_DEBUG
100  virtual void DumpHdrNode() = 0;
101  virtual void DumpNodeRec( xbLong ) = 0;
102  virtual void DumpNodeChain() = 0;
103  virtual xbShort CheckIndexIntegrity( const xbShort ) = 0;
104 #endif
105  virtual xbShort CreateIndex( const char *, const char *, xbShort, xbShort ) = 0;
106  virtual xbLong GetTotalNodes() = 0;
107  virtual xbLong GetCurDbfRec() = 0;
108  virtual xbShort CreateKey( xbShort, xbShort ) = 0;
109  virtual xbShort GetCurrentKey(char *key) = 0;
110  virtual xbShort AddKey( xbLong ) = 0;
111  virtual xbShort UniqueIndex() = 0;
112  virtual xbShort DeleteKey( xbLong ) = 0;
113  virtual xbShort KeyWasChanged() = 0;
114  virtual xbShort FindKey( const char * ) = 0;
115  virtual xbShort FindKey() = 0;
116  virtual xbShort FindKey( xbDouble ) = 0;
117  virtual xbShort GetNextKey() = 0;
118  virtual xbShort GetLastKey() = 0;
119  virtual xbShort GetFirstKey() = 0;
120  virtual xbShort GetPrevKey() = 0;
121  virtual xbShort ReIndex(void (*statusFunc)(xbLong itemNum, xbLong numItems) = 0) = 0;
122 // virtual xbShort KeyExists( char * Key ) { return FindKey( Key, strlen( Key ), 0 ); }
123  virtual xbShort KeyExists( xbDouble ) = 0;
124 
125 #ifdef XB_LOCKING_ON
126  virtual xbShort LockIndex( const xbShort, const xbShort );
127 #else
128  virtual xbShort LockIndex( const xbShort, const xbShort ) const { return XB_NO_ERROR; }
129 #endif
130 
131  virtual xbShort TouchIndex( void ) { return XB_NO_ERROR; }
132 
133  virtual void SetNodeSize(xbShort size) {}
134  virtual xbShort GetNodeSize(void) { return NodeSize; }
135 
136  virtual void GetExpression(char *buf, int len) = 0;
137 };
138 
139 
140 #endif /* __XB_INDEX_H__ */
int IndexStatus
Definition: index.h:77
double xbDouble
xbDouble type
Definition: xtypes.h:76
xbDbf * dbf
Definition: index.h:71
#define XBDLLEXPORT
Definition: xbase.h:101
virtual void SetNodeSize(xbShort size)
Definition: index.h:133
virtual xbShort LockIndex(const xbShort, const xbShort) const
Definition: index.h:128
xbShort NodeSize
Definition: index.h:89
xbString IndexName
Definition: index.h:74
xbString class
Definition: xbstring.h:69
xbExpNode * ExpressionTree
Definition: index.h:72
#define XB_NO_ERROR
Definition: retcodes.h:58
xbIndex class
Definition: index.h:67
xbIndex * index
Definition: index.h:70
#define xbLong
Definition: xtypes.h:67
short int xbShort
xbShort type
Definition: xtypes.h:65
char * KeyBuf2
Definition: index.h:81
xbLong CurDbfRec
Definition: index.h:79
xbIndex()
Definition: index.h:92
virtual xbShort TouchIndex(void)
Definition: index.h:131
xbMH struct
Definition: dbf.h:201
char * KeyBuf
Definition: index.h:80
virtual xbShort GetNodeSize(void)
Definition: index.h:134
virtual ~xbIndex()
Definition: index.h:95
FILE * indexfp
Definition: index.h:75