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

// (DO NOT EDIT: machine generated header) 'SMDBF.pas' rev: 23.00 (Win32)

#ifndef SmdbfHPP
#define SmdbfHPP

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

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

namespace Smdbf
{
//-- type declarations -------------------------------------------------------
#pragma pack(push,1)
struct DECLSPEC_DRECORD TDBFField
{
	
public:
	System::StaticArray<char, 11> FieldName;
	char FieldType;
	int Address;
	System::Byte Length;
	System::Byte Decimals;
	System::StaticArray<System::Byte, 2> Reserved1;
	System::Byte WordAreaID;
	System::Word MultiUserDBase;
	System::Byte SetFields;
	System::StaticArray<System::Byte, 8> Reserved2;
	System::Byte MDXFlag;
};
#pragma pack(pop)


#pragma pack(push,1)
struct DECLSPEC_DRECORD TDBFField7
{
	
public:
	System::StaticArray<char, 32> FieldName;
	char FieldType;
	System::Byte Length;
	System::Byte Decimals;
	System::StaticArray<System::Byte, 2> Reserved1;
	System::Byte MDXFlag;
	unsigned Reserved2;
	unsigned NextAutoInc;
	System::Word Reserved3;
};
#pragma pack(pop)


typedef System::StaticArray<TDBFField, 4096> TDBFFields;

#pragma option push -b-
enum TDBFVersion : unsigned char { dBase3, dBase3Memo, dBase3Plus, dBase3PlusMemo, FoxPro, FoxProMemo, dBase4, dBase4Memo, VFP3, dBase5, dBase7, dBase7Memo, FoxBASE1, FoxBASE2, VFP3AutoIncrement, HyperSix, VFP3Binary, dBase4SQL, dBase4SQLSys, FoxPro2 };
#pragma option pop

#pragma option push -b-
enum TDBFMemoType : unsigned char { dmDBT, dmFPT, dmSMT };
#pragma option pop

#pragma pack(push,1)
struct DECLSPEC_DRECORD TDBFHeader
{
	
public:
	System::Byte VersionNumber;
	System::Byte LastUpdateYear;
	System::Byte LastUpdateMonth;
	System::Byte LastUpdateDay;
	int NumberOfRecords;
	System::Word HeaderSize;
	System::Word RecordSize;
	System::StaticArray<char, 2> Reserve1;
	System::Byte IncompleteTransaction;
	System::Byte Encrypted;
	System::StaticArray<char, 12> Reserved;
	System::Byte MDXIsExist;
	System::Byte LanguageID;
	System::StaticArray<char, 2> Reserved2;
	int NumberOfFields;
};
#pragma pack(pop)


#pragma pack(push,1)
struct DECLSPEC_DRECORD TSMIDBTHeader
{
	
public:
	int NextBlock;
	System::StaticArray<System::Byte, 4> Dummy;
	System::StaticArray<System::Byte, 8> DbfFile;
	System::Byte Version;
	System::StaticArray<System::Byte, 3> Dummy2;
	System::Word BlockLen;
	System::StaticArray<System::Byte, 490> Dummy3;
};
#pragma pack(pop)


#pragma pack(push,1)
struct DECLSPEC_DRECORD TSMIFPTHeader
{
	
public:
	int NextBlock;
	System::StaticArray<System::Byte, 2> Dummy;
	System::Word BlockLen;
	System::StaticArray<System::Byte, 504> Dummy3;
};
#pragma pack(pop)


#pragma pack(push,1)
struct DECLSPEC_DRECORD TSMIBlockHeader
{
	
public:
	int MemoType;
	int MemoSize;
};
#pragma pack(pop)


class DELPHICLASS TDBF;
class PASCALIMPLEMENTATION TDBF : public Smcells::TSpreadSheetFile
{
	typedef Smcells::TSpreadSheetFile inherited;
	
private:
	TDBFVersion FDBFVersion;
	TDBFMemoType FDBFMemoType;
	System::Classes::TStream* BLOBStream;
	
protected:
	System::Classes::TStream* FCurrentStream;
	virtual void __fastcall ReadBLOBValue(unsigned BlockNo, unsigned ASize, System::UnicodeString &s);
	System::UnicodeString __fastcall TranslateString(const System::UnicodeString s);
	
public:
	TDBFHeader DBHeader;
	TSMIDBTHeader DBTHeader;
	TSMIFPTHeader FPTHeader;
	TDBFFields Fields;
	__fastcall virtual TDBF(System::Classes::TComponent* AOwner);
	__fastcall virtual ~TDBF(void);
	virtual void __fastcall LoadFromStream(System::Classes::TStream* AStream);
	virtual void __fastcall LoadFromFile(const System::WideString FileName);
	virtual void __fastcall BeforeLoad(void);
	virtual void __fastcall AfterLoad(void);
	virtual bool __fastcall LoadRecord(int RecNo);
	virtual int __fastcall FindColumn(const System::UnicodeString AFieldName);
	virtual void __fastcall FillColumnList(System::Classes::TStrings* lst, const System::UnicodeString strFieldList);
	System::UnicodeString __fastcall GetStrFieldType(char AType);
	System::UnicodeString __fastcall GetStrFileType(System::Byte FileType);
	virtual bool __fastcall IsEncrypted(void);
	
__published:
	__property TDBFVersion DBFVersion = {read=FDBFVersion, write=FDBFVersion, default=0};
	__property TDBFMemoType DBFMemoType = {read=FDBFMemoType, write=FDBFMemoType, default=0};
};


//-- var, const, procedure ---------------------------------------------------
extern PACKAGE System::StaticArray<System::Byte, 20> arrDBFVersion;

}	/* namespace Smdbf */
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_SMDBF)
using namespace Smdbf;
#endif
#pragma pack(pop)
#pragma option pop

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