EgtInterface 2.3l2 :

- aggiunte interfacce per funzioni EgtMdbExport, EgtMdbToBeImported e EgtMdbImport.
This commit is contained in:
DarioS
2021-12-08 16:45:51 +01:00
parent 9da7214fac
commit f1c717c553
2 changed files with 74 additions and 1 deletions
+74 -1
View File
@@ -970,7 +970,7 @@ __stdcall EgtTdbImport( const wchar_t* wsFile, const wchar_t* wsToolsToImport, c
sImported += sName ;
}
wsImported = _wcsdup( stringtoW( sImported)) ;
return (( wsToolsNames == nullptr) ? FALSE : TRUE) ;
return (( wsImported == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
@@ -1250,6 +1250,79 @@ __stdcall EgtMdbGetMachiningDir( wchar_t*& wsMchDir)
return (( wsMchDir == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbExport( const wchar_t* wsMachiningsNames, const wchar_t* wsOutFile)
{
STRVECTOR vsMachiningsNames ;
if ( ! Tokenize( string( wstrztoA( wsMachiningsNames)), "\n", vsMachiningsNames))
return FALSE ;
return( ExeMdbExport( vsMachiningsNames, string( wstrztoA( wsOutFile))) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbToBeImported( const wchar_t* wsFile, wchar_t*& wsMachiningsNames, int*& vTypes, int* pnCount)
{
if ( &wsMachiningsNames == nullptr || &vTypes == nullptr || pnCount == nullptr)
return FALSE ;
STRVECTOR vsMachiningsNames ;
INTVECTOR vMachiningsTypes ;
if ( ! ExeMdbToBeImported( string( wstrztoA( wsFile)), vsMachiningsNames, vMachiningsTypes))
return FALSE ;
// restituzione vettore nomi
string sMachiningsNames ;
for ( const auto& sName : vsMachiningsNames) {
if ( ! sMachiningsNames.empty())
sMachiningsNames += "\n" ;
sMachiningsNames += sName ;
}
wsMachiningsNames = _wcsdup( stringtoW( sMachiningsNames)) ;
if ( wsMachiningsNames == nullptr)
return FALSE ;
// restituzione vettore tipi
int nDim = int( vMachiningsTypes.size()) ;
if ( nDim == 0) {
vTypes = nullptr ;
}
else {
vTypes = (int*) malloc( nDim * sizeof( int)) ;
if ( vTypes == nullptr) {
free( wsMachiningsNames) ;
return FALSE ;
}
for ( int i = 0 ; i < nDim ; ++ i)
vTypes[i] = vMachiningsTypes[i] ;
}
*pnCount = nDim ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtMdbImport( const wchar_t* wsFile, const wchar_t* wsMachiningsToImport, const wchar_t* wsMachiningsNames, wchar_t*& wsImported)
{
if ( &wsImported == nullptr)
return FALSE ;
STRVECTOR vsMachiningsToImport ;
if ( ! Tokenize( string( wstrztoA( wsMachiningsToImport)), "\n", vsMachiningsToImport))
return FALSE ;
STRVECTOR vsMachiningsNames ;
if ( ! Tokenize( string( wstrztoA( wsMachiningsNames)), "\n", vsMachiningsNames))
return FALSE ;
STRVECTOR vsImported ;
if ( ! ExeMdbImport( string( wstrztoA( wsFile)), vsMachiningsToImport, vsMachiningsNames, vsImported))
return FALSE ;
string sImported ;
for ( const auto& sName : vsImported) {
if ( ! sImported.empty())
sImported += "\n" ;
sImported += sName ;
}
wsImported = _wcsdup( stringtoW( sImported)) ;
return (( wsImported == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
// Operations
//-----------------------------------------------------------------------------