165 lines
4.7 KiB
C++
165 lines
4.7 KiB
C++
#include "StdAfx.h"
|
|
#include "CartoBaseDBFManager.h"
|
|
|
|
#include "ManagerDbfGdataTable.h"
|
|
//#include "CartoBaseElements.h"
|
|
//***************************************************************************
|
|
CartoBaseDBFManager::CartoBaseDBFManager(void)
|
|
{
|
|
}
|
|
//***************************************************************************
|
|
CartoBaseDBFManager::~CartoBaseDBFManager(void)
|
|
{
|
|
}
|
|
//***************************************************************************
|
|
bool CartoBaseDBFManager::DbfSet( int nrow, int ncolm )
|
|
{
|
|
_icol = 0;
|
|
_nncol = ncolm;
|
|
_oldRef = cb->getNexRef()-nrow;
|
|
return cb->iaEx->IaSet(nrow, ncolm);
|
|
}
|
|
//***************************************************************************
|
|
bool CartoBaseDBFManager::DbfSetColm( char* name, BYTE type, int size )
|
|
{
|
|
bool res =cb->iaEx->IaSetColm(_icol++,name, type, size);
|
|
if(res && _nncol<=_icol)
|
|
cb->iaEx->IaAdd(_oldRef);
|
|
return res;
|
|
}
|
|
//***************************************************************************
|
|
bool CartoBaseDBFManager::DbfaddVal( int icol, int v )
|
|
{
|
|
return cb->iaEx->IaAddVal(_oldRef, icol, v);
|
|
|
|
}
|
|
//***************************************************************************
|
|
bool CartoBaseDBFManager::DbfaddVal( int icol, double v )
|
|
{
|
|
return cb->iaEx->IaAddVal(_oldRef, icol, v);
|
|
}
|
|
//***************************************************************************
|
|
bool CartoBaseDBFManager::DbfaddVal( int icol, __int64 v )
|
|
{
|
|
return cb->iaEx->IaAddVal(_oldRef, icol, v);
|
|
}
|
|
//***************************************************************************
|
|
bool CartoBaseDBFManager::DbfaddVal( int icol, char* v )
|
|
{
|
|
return cb->iaEx->IaAddVal(_oldRef, icol, v);
|
|
}
|
|
//***************************************************************************
|
|
bool CartoBaseDBFManager::DbfaddVal( int icol, void* v )
|
|
{
|
|
return cb->iaEx->IaAddVal(_oldRef, icol, v);
|
|
}
|
|
//***************************************************************************
|
|
bool CartoBaseDBFManager::DbfFinRow()
|
|
{
|
|
bool res = cb->iaEx->IaFinRow(_oldRef);
|
|
|
|
_oldRef++;
|
|
if(cb->getNexRef()>_oldRef)
|
|
cb->iaEx->IaAdd(_oldRef);
|
|
return res;
|
|
}
|
|
//***************************************************************************
|
|
bool CartoBaseDBFManager::DbfFinR()
|
|
{
|
|
return cb->iaEx->IaFinR();
|
|
}
|
|
//***************************************************************************
|
|
bool CartoBaseDBFManager::DbfGet( int *nrow, int *ncolm )
|
|
{
|
|
rowE =-1;
|
|
_nnrow =0;
|
|
*nrow=setEnt->getNumberEntities();
|
|
return ia->IaGetSize(ncolm);
|
|
}
|
|
//***************************************************************************
|
|
bool CartoBaseDBFManager::DbfGetColm( int icol, char* name, BYTE *type, int *size, int*ndecimal )
|
|
{
|
|
return ia->IaGetColm(icol,name,type,size,ndecimal);
|
|
}
|
|
//***************************************************************************
|
|
bool CartoBaseDBFManager::DbfGetVal( int irow, int icol, int* v )
|
|
{
|
|
if(rowE!= irow)
|
|
{
|
|
e = setEnt->getEntity(irow);
|
|
rowE = irow;
|
|
}
|
|
|
|
return ia->IaGetVal(e.entity()->ref,icol, v);
|
|
}
|
|
//***************************************************************************
|
|
bool CartoBaseDBFManager::DbfGetVal( int irow, int icol, double* v )
|
|
{
|
|
if(rowE!= irow)
|
|
{
|
|
e = setEnt->getEntity(irow);
|
|
rowE = irow;
|
|
}
|
|
return ia->IaGetVal(e.entity()->ref ,icol, v);
|
|
}
|
|
//***************************************************************************
|
|
bool CartoBaseDBFManager::DbfGetVal( int irow, int icol, __int64* v )
|
|
{
|
|
if(rowE!= irow)
|
|
{
|
|
e = setEnt->getEntity(irow);
|
|
rowE = irow;
|
|
}
|
|
|
|
return ia->IaGetVal(e.entity()->ref, icol, v);
|
|
}
|
|
//***************************************************************************
|
|
bool CartoBaseDBFManager::DbfGetVal( int irow, int icol, char** v )
|
|
{
|
|
if(rowE!= irow)
|
|
{
|
|
e = setEnt->getEntity(irow);
|
|
rowE = irow;
|
|
}
|
|
return ia->IaGetVal(e.entity()->ref,icol, v);
|
|
}
|
|
//***************************************************************************
|
|
bool CartoBaseDBFManager::DbfGetVal( int irow, int icol, void** v )
|
|
{
|
|
if(rowE!= irow)
|
|
{
|
|
e = setEnt->getEntity(irow);
|
|
rowE = irow;
|
|
}
|
|
return ia->IaGetVal(e.entity()->ref,icol, v);
|
|
}
|
|
//***************************************************************************
|
|
bool CartoBaseDBFManager::DbfFinW()
|
|
{
|
|
return ia->IaFinW();
|
|
}
|
|
//***************************************************************************
|
|
bool CartoBaseDBFManager::leer( char *path, CartoBase*cartb )
|
|
{
|
|
cb = cartb;
|
|
switch(cb->getTypeIA())
|
|
{
|
|
case(CartoBase::DtIa):
|
|
case (CartoBase::ExIa):
|
|
return ManagerDbf::leer(path,this);
|
|
case(CartoBase::NIa):
|
|
case(CartoBase::IntIa):
|
|
default:
|
|
return true;
|
|
}
|
|
}
|
|
//***************************************************************************
|
|
bool CartoBaseDBFManager::grabar( char *path, DataIaCartoBase* iawx, SetEntities* s )
|
|
{
|
|
setEnt =s;
|
|
rowE =-1;
|
|
ia = iawx;
|
|
|
|
return ManagerDbf::grabar(path,this);
|
|
}
|
|
//***************************************************************************
|