Merge branch 'master' of http://desa.narvaling.com/Bonobo.Git.Server/utiles_v2017
commit
baa2dabdf6
|
|
@ -327,7 +327,9 @@ void GdataTable::removeColm(int i)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
colm.remove(i);
|
||||
buf.remove(i);
|
||||
colmName.borra(i);
|
||||
|
||||
}
|
||||
//***************************************************************************
|
||||
|
|
@ -467,6 +469,13 @@ char* GdataTable::getName( int icol )
|
|||
return colmName.get(icol);
|
||||
}
|
||||
//***************************************************************************
|
||||
bool GdataTable::rename(int icol, char *nomb)
|
||||
{
|
||||
if (icol<0 || icol>colm.n)
|
||||
return 0;
|
||||
return colmName.replace(icol,nomb);
|
||||
}
|
||||
//***************************************************************************
|
||||
bool GdataTable::addMemRow( int nrow )
|
||||
{
|
||||
for(int i =0; i<buf.n; i++)
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ public:
|
|||
int getSizeASCII(int icol);
|
||||
|
||||
char* getName(int icol);
|
||||
bool rename(int icol, char* nomb);
|
||||
int* getI(int row, int colm);
|
||||
__int64* getI64(int row, int colm);
|
||||
double* getD(int row, int colm);
|
||||
|
|
|
|||
|
|
@ -22,31 +22,78 @@ bool ManagerDbfGdataTable::DbfSet( int nrow, int ncolm )
|
|||
return true;
|
||||
}
|
||||
//***************************************************************************
|
||||
bool ManagerDbfGdataTable::DelCol(char* path, char* name)
|
||||
{
|
||||
GdataTable tb;
|
||||
|
||||
if (path)
|
||||
{
|
||||
if (!LeeDbf(path, &tb))
|
||||
return false;
|
||||
|
||||
_dt = &tb;
|
||||
}
|
||||
else if (!_dt)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int ic = _dt->getInd(name);
|
||||
|
||||
if (ic < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_dt->removeColm(ic);
|
||||
|
||||
if (path)
|
||||
{
|
||||
if (!grabaDbf(path, _dt))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
//***************************************************************************
|
||||
bool ManagerDbfGdataTable::AddCol( char* path, char* name, BYTE type,IAddColDbf *dt, int size)
|
||||
{
|
||||
GdataTable tb;
|
||||
|
||||
if(!LeeDbf(path, &tb))
|
||||
if (path)
|
||||
{
|
||||
if (!LeeDbf(path, &tb))
|
||||
return false;
|
||||
int ic=tb.getInd(name);
|
||||
|
||||
_dt = &tb;
|
||||
}
|
||||
else if(!_dt)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int ic= _dt->getInd(name);
|
||||
|
||||
if(ic<0)
|
||||
{
|
||||
//la crea
|
||||
if(!tb.addColm(name,type,size))
|
||||
if(!_dt->addColm(name,type,size))
|
||||
return false;
|
||||
ic=tb.nColm()-1;
|
||||
ic= _dt->nColm()-1;
|
||||
}
|
||||
|
||||
dt->size = tb.getSize(ic);
|
||||
dt->size = _dt->getSize(ic);
|
||||
|
||||
for(int i=0;i<tb.nRow();i++)
|
||||
for(int i=0;i< _dt->nRow();i++)
|
||||
{
|
||||
dt->setData(i, tb.get(i,ic));
|
||||
dt->setData(i, _dt->get(i,ic));
|
||||
}
|
||||
|
||||
if(!grabaDbf(path,&tb))
|
||||
if (path)
|
||||
{
|
||||
if (!grabaDbf(path, _dt))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ class UTILES_EXPORT ManagerDbfGdataTable: public ListenerDbf_W, public ListenerD
|
|||
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-------------------------------------------------
|
||||
|
|
|
|||
55
StrArray.cpp
55
StrArray.cpp
|
|
@ -164,4 +164,59 @@ StrArray* StrArray::filtra( StrArray*buf, char *filter )
|
|||
}
|
||||
return buf;
|
||||
}
|
||||
//***********************************************************************
|
||||
BOOL StrArray::replace(int i, char* cadena)
|
||||
{
|
||||
if (i < 0 || i >= n_i)
|
||||
return FALSE;
|
||||
int dif = strlen(cadena) - strlen(get(i));
|
||||
int aux = 1024;
|
||||
int ult;
|
||||
int i_i;
|
||||
if (dif > 0)
|
||||
{
|
||||
//comprueba memo-------------------
|
||||
if (n_str + dif >= m_str)
|
||||
{
|
||||
if (aux < dif)
|
||||
aux += dif;
|
||||
//pedir-----------------------
|
||||
m_str = m_str + aux;
|
||||
str = (char*)realloc(str, m_str);
|
||||
memset(&str[m_str - aux], 0, aux);
|
||||
}
|
||||
//desplazar-----------------------
|
||||
//ult=(*ind)[n_i-1]+strlen(dame_str(n_i-1))+1;
|
||||
ult = n_str - 1;
|
||||
if (i + 1 < n_i)
|
||||
i_i = (*ind)[i + 1] - 1;
|
||||
else
|
||||
i_i = ult;
|
||||
//i_i=(*ind)[i]+strlen(dame_str(i))+1;
|
||||
//ult=strlen(&str[ult])+1;
|
||||
for (int k = ult; k >= i_i; k--)
|
||||
str[k + dif] = str[k];
|
||||
//copiamos-----------------------
|
||||
strcpy(get(i), cadena);
|
||||
//aumentamos indices-------------
|
||||
for (int k = i + 1; k < n_i; k++)
|
||||
(*ind)[k] += dif;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(get(i), cadena);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//***********************************************************************
|
||||
int StrArray::find(char* st)
|
||||
{
|
||||
for (int i = 0; i < n_i; i++)
|
||||
{
|
||||
if (!strcmp(&str[(*ind)[i]], st))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
//**************************************************************************
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ public:
|
|||
void borra();//borra todo
|
||||
void compacta();//reduce al minimo la memoria necesaria para comtener la informacion
|
||||
StrArray* filtra(StrArray*buf, char *filter);
|
||||
BOOL replace(int i, char* cadena);
|
||||
int find(char* st);
|
||||
//funciones aux-------------------------
|
||||
private:
|
||||
void cuida_memoria(int n,int ni=1);//asegura tener memoria para un str mas
|
||||
|
|
|
|||
20
utiles.rc
20
utiles.rc
|
|
@ -16,13 +16,11 @@
|
|||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
// Inglés (Estados Unidos) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
|
@ -30,8 +28,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,8
|
||||
PRODUCTVERSION 1,0,0,8
|
||||
FILEVERSION 1,0,0,9
|
||||
PRODUCTVERSION 1,0,0,9
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
|
@ -48,11 +46,11 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "Narvaling"
|
||||
VALUE "FileDescription", "Librería de utilidades"
|
||||
VALUE "FileVersion", "1.0.0.8"
|
||||
VALUE "FileVersion", "1.0.0.9"
|
||||
VALUE "InternalName", "utiles.dll"
|
||||
VALUE "OriginalFilename", "utiles.dll"
|
||||
VALUE "ProductName", "Utiles"
|
||||
VALUE "ProductVersion", "1.0.0.8"
|
||||
VALUE "ProductVersion", "1.0.0.9"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
@ -61,18 +59,16 @@ BEGIN
|
|||
END
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
#endif // Inglés (Estados Unidos) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Spanish resources
|
||||
// Español (España, alfabetización internacional) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ESN)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_MODERN
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -112,7 +108,7 @@ END
|
|||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // Spanish resources
|
||||
#endif // Español (España, alfabetización internacional) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue