// CodeGear C++Builder
// Copyright (c) 1995, 2020 by Embarcadero Technologies, Inc.
// All rights reserved

// (DO NOT EDIT: machine generated header) 'QImport3DBFFile.pas' rev: 34.00 (Windows)

#ifndef Qimport3dbffileHPP
#define Qimport3dbffileHPP

#pragma delphiheader begin
#pragma option push
#pragma option -w-      // All warnings off
#pragma option -Vx      // Zero-length empty class member 
#pragma pack(push,8)
#include <System.hpp>
#include <SysInit.hpp>
#include <System.SysUtils.hpp>
#include <System.Classes.hpp>
#include <Winapi.Windows.hpp>
#include <QImport3Common.hpp>

//-- user supplied -----------------------------------------------------------

namespace Qimport3dbffile
{
//-- forward type declarations -----------------------------------------------
struct RFileHeader;
struct RMemoHeader;
struct RFPTMemoHeader;
struct RFPTMemoBlockHeader;
struct RDescriptor;
class DELPHICLASS TDescriptor;
class DELPHICLASS TBaseElem;
class DELPHICLASS TBaseList;
class DELPHICLASS TDBFRead;
//-- type declarations -------------------------------------------------------
#pragma pack(push,1)
struct DECLSPEC_DRECORD RFileHeader
{
public:
	System::Byte DBType;
	System::Byte Year;
	System::Byte Month;
	System::Byte Day;
	int RecCount;
	System::Word HeaderSize;
	int RecordSize;
	System::Byte FDelayTrans;
	System::StaticArray<System::Byte, 13> Reserve2;
	System::Byte FlagMDX;
	System::StaticArray<System::Byte, 3> Reserve3;
};
#pragma pack(pop)


#pragma pack(push,1)
struct DECLSPEC_DRECORD RMemoHeader
{
public:
	unsigned NextBlock;
	unsigned BlockSize;
	System::StaticArray<System::Byte, 504> Reserve;
};
#pragma pack(pop)


#pragma pack(push,1)
struct DECLSPEC_DRECORD RFPTMemoHeader
{
public:
	unsigned NextBlock;
	System::Word Unused;
	System::Word BlockSize;
	System::StaticArray<System::Byte, 504> Reserve;
};
#pragma pack(pop)


#pragma pack(push,1)
struct DECLSPEC_DRECORD RFPTMemoBlockHeader
{
public:
	unsigned BlockSignature;
	unsigned MemoLength;
};
#pragma pack(pop)


typedef System::StaticArray<char, 10> TFieldName;

#pragma pack(push,1)
struct DECLSPEC_DRECORD RDescriptor
{
public:
	TFieldName FieldName;
	char FieldEnd;
	char FieldType;
	int FieldDisp;
	System::Byte FieldLen;
	System::Byte FieldDec;
	System::StaticArray<System::Byte, 13> A1;
	System::Byte FlagTagMDX;
};
#pragma pack(pop)


#pragma pack(push,4)
class PASCALIMPLEMENTATION TDescriptor : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	TFieldName FieldName;
	char FieldType;
	int FieldDisp;
	System::Byte FieldLen;
	System::Byte FieldDec;
	System::Byte FlagTagMDX;
	
public:
	__fastcall TDescriptor(const RDescriptor &DRec);
	void __fastcall GetData(RDescriptor &DRec);
	System::AnsiString __fastcall GetName();
	char __fastcall GetType();
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TDescriptor() { }
	
};

#pragma pack(pop)

#pragma pack(push,4)
class PASCALIMPLEMENTATION TBaseElem : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	System::SmallString<12> ElName;
	char ElType;
	int ElLen;
	int ElDec;
	
public:
	__fastcall TBaseElem(const System::AnsiString AName, char AType, int ALen, int ADec);
	__fastcall virtual ~TBaseElem();
};

#pragma pack(pop)

#pragma pack(push,4)
class PASCALIMPLEMENTATION TBaseList : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	bool InitF;
	int cbResult;
	System::Classes::TList* List;
	TBaseElem* __fastcall GetElem(int Index);
	int __fastcall GetCount();
	
public:
	__fastcall TBaseList();
	__fastcall virtual ~TBaseList();
	void __fastcall Add(TBaseElem* ABaseElem);
	__property int Count = {read=GetCount, nodefault};
	__property TBaseElem* Elems[int Index] = {read=GetElem};
};

#pragma pack(pop)

enum DECLSPEC_DENUM TMemoType : unsigned char { mtNone, mtDBT, mtFPT };

#pragma pack(push,4)
class PASCALIMPLEMENTATION TDBFRead : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	System::Byte FlagInit;
	System::UnicodeString DBFName;
	int Res;
	System::Classes::TFileStream* MemoFile;
	RMemoHeader MemoHeader;
	RFPTMemoHeader FPTMemoHeader;
	int DBFHandle;
	RFileHeader DBFHeader;
	RDescriptor Descriptor;
	System::Classes::TList* DList;
	int FRecNo;
	bool FDeleted;
	TMemoType FMemoType;
	System::AnsiString __fastcall GetMemoData(int BlockNo);
	int __fastcall StrBuffToNum(const System::AnsiString ABuff);
	
protected:
	System::Byte __fastcall GetVersion();
	int __fastcall GetRCount();
	int __fastcall GetFCount();
	bool __fastcall GetEof();
	System::AnsiString __fastcall GetFieldName(int Index);
	char __fastcall GetFieldType(int Index);
	int __fastcall GetFieldLength(int Index);
	int __fastcall GetFieldDec(int Index);
	int __fastcall GetFieldDisp(int Index);
	
public:
	__fastcall TDBFRead(const System::UnicodeString DBName);
	__fastcall virtual ~TDBFRead();
	virtual void __fastcall ErrorHandle(int Error);
	int __fastcall GetNumField(const System::AnsiString Name);
	char __fastcall GetType(const System::AnsiString Name);
	int __fastcall GetLength(const System::AnsiString Name);
	int __fastcall GetDecName(const System::AnsiString Name);
	int __fastcall GetDisp(const System::AnsiString Name);
	System::AnsiString __fastcall GetData(int FieldNum);
	__property System::Byte Version = {read=GetVersion, nodefault};
	__property int RecordCount = {read=GetRCount, nodefault};
	__property int FieldCount = {read=GetFCount, nodefault};
	__property int RecNo = {read=FRecNo, nodefault};
	__property bool Deleted = {read=FDeleted, nodefault};
	__property bool Eof = {read=GetEof, nodefault};
	__property System::UnicodeString FileName = {read=DBFName};
	__property System::AnsiString FieldName[int Index] = {read=GetFieldName};
	__property char FieldType[int Index] = {read=GetFieldType};
	__property int FieldLength[int Index] = {read=GetFieldLength};
	__property int FieldDec[int Index] = {read=GetFieldDec};
	__property int FieldDisp[int Index] = {read=GetFieldDisp};
	__property TMemoType MemoType = {read=FMemoType, write=FMemoType, nodefault};
};

#pragma pack(pop)

//-- var, const, procedure ---------------------------------------------------
static const System::Int8 dBaseIII = System::Int8(0x3);
static const System::Byte dBaseIIIMemo = System::Byte(0x83);
static const System::Byte dBaseIVMemo = System::Byte(0x8b);
static const System::Int8 dBaseIVSQL = System::Int8(0x63);
static const System::Int8 FoxPro = System::Int8(0x5);
static const System::Byte FoxProMemo = System::Byte(0xf5);
static const System::Int8 VisualFoxPro = System::Int8(0x30);
static const System::WideChar dftString = (System::WideChar)(0x43);
static const System::WideChar dftBoolean = (System::WideChar)(0x4c);
static const System::WideChar dftNumber = (System::WideChar)(0x4e);
static const System::WideChar dftMemo = (System::WideChar)(0x4d);
static const System::WideChar dftFloat = (System::WideChar)(0x46);
static const System::WideChar dftDate = (System::WideChar)(0x44);
static const System::WideChar dftInteger = (System::WideChar)(0x49);
static const System::Int8 dbfFileEmpty = System::Int8(0x64);
static const System::Int8 dbfENoFileName = System::Int8(0x65);
static const System::Int8 dbfEFileNotFound = System::Int8(0x66);
static const System::Int8 dbfECreate = System::Int8(0x67);
static const System::Int8 dbfEOpen = System::Int8(0x68);
static const System::Int8 dbfESeek = System::Int8(0x69);
static const System::Int8 dbfERead = System::Int8(0x6a);
static const System::Int8 dbfEWrite = System::Int8(0x6b);
static const System::Int8 dbfEOutOfMemory = System::Int8(0x6c);
static const System::Int8 dbfEDestruct = System::Int8(0x6d);
static const System::Int8 dbfECreateList = System::Int8(0x6e);
static const System::Int8 dbfEOutOfNumber = System::Int8(0x6f);
static const System::Byte crEFileNotFound = System::Byte(0xc8);
static const System::Byte crEOutOfMemory = System::Byte(0xc9);
static const System::Int8 erInvalidHandle = System::Int8(0x6);
static const System::Int8 erSharedViolation = System::Int8(0x20);
static const System::Int8 erLockingViolation = System::Int8(0x21);
static const System::Int8 erSharingBufferOverflov = System::Int8(0x24);
extern DELPHI_PACKAGE System::UnicodeString __fastcall DBFTypeToStr(System::WideChar DBFType);
}	/* namespace Qimport3dbffile */
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_QIMPORT3DBFFILE)
using namespace Qimport3dbffile;
#endif
#pragma pack(pop)
#pragma option pop

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif	// Qimport3dbffileHPP
