#pragma once

#ifndef ManagerDbfGdataTable_H
#define ManagerDbfGdataTable_H

#include "base_head.h"
#include "Fdbf.h"

class IAddColDbf
{
public:
	int size = 0;
	virtual void setData(int i, void *data)=0;
};
class GdataTable;
class UTILES_EXPORT ManagerDbfGdataTable: public ListenerDbf_W, public ListenerDbf_R
{

	GdataTable *_dt;
	int _nrow;
	int _ncolm;
	public:
	ManagerDbfGdataTable(void);
	~ManagerDbfGdataTable(void);

	bool LeeDbf(char* path, GdataTable *dt);
	bool grabaDbf(char* path, GdataTable *dt);
	bool AddCol( char* path, char* name, BYTE type,IAddColDbf *dt, int size=0);
	bool DelCol(char* path, char* name);

	//funciones de herencia----------------------------------------
	//LisenerDbf_R-------------------------------------------------
	virtual bool DbfSet( int nrow, int ncolm );	
	virtual bool DbfSetColm( char* name, BYTE type, int size );
	virtual bool DbfaddVal( int icol, int v );
	virtual bool DbfaddVal( int icol, double v );
	virtual bool DbfaddVal( int icol, __int64 v );
	virtual bool DbfaddVal( int icol, char* v );
	virtual bool DbfaddVal( int icol, void* v );
	virtual bool DbfFinRow();
	virtual bool DbfFinR();
	//LisenerDbf_W----------------------------------------------------
	virtual bool DbfGet( int *nrow, int *ncolm );
	virtual bool DbfGetColm(int icol,  char* name, BYTE *type, int *size, int*ndecimal );
	virtual bool DbfGetVal(int irow,  int icol, int* v );
	virtual bool DbfGetVal(int irow,  int icol, double* v );
	virtual bool DbfGetVal(int irow,  int icol, __int64* v );
	virtual bool DbfGetVal(int irow,  int icol, char** v );
	virtual bool DbfGetVal(int irow,  int icol, void** v );
	virtual bool DbfFinW();
};
#endif