Xbase64 Class Library 3.1.2
xbindex.h
Go to the documentation of this file.
1/* xbindex.h
2
3 Xbase64 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 program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU Lesser General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
15
16 This program 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
19 GNU Lesser General Public License for more details.
20
21 You should have received a copy of the GNU Lesser General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
25
26 Contact:
27
28 Email:
29
30 xdb-devel@lists.sourceforge.net
31 xdb-users@lists.sourceforge.net
32
33
34 Regular Mail:
35
36 XBase Support
37 149C South Main St
38 Keller Texas, 76248
39 USA
40
41*/
42
43#ifndef __XB_INDEX_H__
44#define __XB_INDEX_H__
45
46#ifdef __GNU_LesserG__
47#pragma interface
48#endif
49
50#include <xbase64/xbase64.h>
51#include <string.h>
54
55#define XB_UNIQUE 1
56#define XB_NOT_UNIQUE 0
57
59
61
62class XBDLLEXPORT xbIndex: protected xbFile
63{
64 public:
67
68 virtual ~xbIndex();
69
70 xbShort OpenIndex ( const char * );
72 virtual xbShort CreateIndex( const char *, const char *, xbShort, xbShort ) = 0;
73 virtual xbLong GetTotalNodes() = 0;
74 virtual xbULong GetCurDbfRec() = 0;
76 virtual xbShort GetCurrentKey(char *key) = 0;
77 virtual xbShort AddKey( xbLong ) = 0;
78 virtual xbShort UniqueIndex() = 0;
79 virtual xbShort DeleteKey( xbLong ) = 0;
80 virtual xbShort KeyWasChanged() = 0;
81 virtual xbShort FindKey( const char * ) = 0;
82 virtual xbShort FindKey() = 0;
83 virtual xbShort FindKey( xbDouble ) = 0;
84 virtual xbShort GetNextKey() = 0;
85 virtual xbShort GetLastKey() = 0;
86 virtual xbShort GetFirstKey() = 0;
87 virtual xbShort GetPrevKey() = 0;
88 virtual xbShort ReIndex(void (*statusFunc)(xbLong itemNum, xbLong numItems) = 0) = 0;
89// virtual xbShort KeyExists( char * Key ) { return FindKey( Key, strlen( Key ), 0 ); }
90 virtual xbShort KeyExists( xbDouble ) = 0;
91 virtual xbShort TouchIndex() { return XB_NO_ERROR; }
92 virtual void SetNodeSize(xbShort size) {}
93 virtual xbShort GetNodeSize() { return NodeSize; }
94 virtual void GetExpression(char *buf, int len) = 0;
95 virtual void Flush();
96 virtual const char * GetIxName() {return GetFileName().getData();}
98 xbBool IsOpen() {return indexfp!=NULL;}
99
100#ifdef XBASE_DEBUG
101 virtual void DumpHdrNode( xbShort Option ) = 0;
102 virtual void DumpNodeRec( xbLong ) = 0;
103 virtual void DumpNodeChain() = 0;
104 virtual xbShort CheckIndexIntegrity( xbShort ) = 0;
105#endif
106
107#ifdef XB_LOCKING_ON
108// xbShort LockIndex( xbShort LockType );
109// virtual xbShort LockIndex( const xbShort, const xbShort );
110#else
111// virtual xbShort LockIndex( const xbShort, const xbShort ) const { return XB_NO_ERROR; }
112#endif
113
114 protected:
115 virtual xbShort GetHeadNode()=0;
116 virtual xbUShort GetKeyLen()=0;
117 virtual const char* GetKeyExpression()=0;
118 virtual void FreeNodesMemory()=0;
119
122 xbExpn *IxExp; /* index expression defines keys */
123 FILE *indexfp;
124 /* NULL = closed, other = open */
125// int IndexStatus; /* old - 0 = closed, 1 = open */
126 xbULong CurDbfRec; /* current Dbf record number */
127 char *KeyBuf; /* work area key buffer */
128 char *KeyBuf2; /* work area key buffer */
130
131#ifdef XB_LOCKING_ON
132 int LockCnt; /* current index lock count */
133 int CurLockCount; /* old locking field */
134 int CurLockType; /* old locking field */
135#endif
136};
137
138
139#endif /* __XB_INDEX_H__ */
xbMH struct
Definition xbdbf.h:190
const xbString & GetFileName()
Definition xbfile.h:57
xbFile()
Definition xbfile.h:55
char * KeyBuf2
Definition xbindex.h:128
virtual xbShort KeyWasChanged()=0
xbIndex()
Definition xbindex.h:65
xbShort AllocKeyBufs()
virtual xbShort GetNodeSize()
Definition xbindex.h:93
virtual xbShort FindKey()=0
xbIndex * index
Definition xbindex.h:120
xbExpn * IxExp
Definition xbindex.h:122
virtual xbShort GetNextKey()=0
virtual xbShort FindKey(xbDouble)=0
virtual xbShort DeleteKey(xbLong)=0
virtual ~xbIndex()
virtual xbShort CreateIndex(const char *, const char *, xbShort, xbShort)=0
virtual void FreeNodesMemory()=0
virtual xbShort FindKey(const char *)=0
char * KeyBuf
Definition xbindex.h:127
xbIndex(xbDbf *)
FILE * indexfp
Definition xbindex.h:123
virtual void SetNodeSize(xbShort size)
Definition xbindex.h:92
virtual xbShort GetCurrentKey(char *key)=0
virtual xbShort ReIndex(void(*statusFunc)(xbLong itemNum, xbLong numItems)=0)=0
virtual xbShort GetFirstKey()=0
virtual xbShort CreateKey(xbShort, xbShort)=0
xbShort CloseIndex()
virtual xbShort GetHeadNode()=0
virtual xbShort GetPrevKey()=0
xbShort OpenIndex(const char *)
virtual xbShort UniqueIndex()=0
virtual const char * GetKeyExpression()=0
xbULong CurDbfRec
Definition xbindex.h:126
virtual xbLong GetTotalNodes()=0
virtual xbUShort GetKeyLen()=0
virtual xbULong GetCurDbfRec()=0
xbBool IsOpen()
Definition xbindex.h:98
virtual void Flush()
xbShort NodeSize
Definition xbindex.h:129
virtual xbShort TouchIndex()
Definition xbindex.h:91
virtual xbShort GetLastKey()=0
virtual xbShort KeyExists(xbDouble)=0
virtual const char * GetIxName()
Definition xbindex.h:96
xbDbf * dbf
Definition xbindex.h:121
virtual void GetExpression(char *buf, int len)=0
virtual xbShort AddKey(xbLong)=0
const char * getData() const
Short description.
Definition xbstring.cpp:387
#define XBDLLEXPORT
Definition xbase64.h:87
#define XB_NO_ERROR
Definition xbretcod.h:50
long xbLong
Definition xbtypes.h:61
short int xbBool
xbBool type
Definition xbtypes.h:78
short int xbShort
xbShort type
Definition xbtypes.h:60
unsigned short int xbUShort
xbUShort type
Definition xbtypes.h:55
double xbDouble
xbDouble type
Definition xbtypes.h:73
unsigned long int xbULong
xbULong type
Definition xbtypes.h:50