EgtGeneral :

- aggiunta a CmdParser GetIdParam.
This commit is contained in:
Dario Sassi
2014-04-10 17:34:55 +00:00
parent 056edcd1ed
commit e8a7eaa2ac
2 changed files with 27 additions and 0 deletions
+26
View File
@@ -254,6 +254,32 @@ CmdParser::ResetAllVariables( void)
return true ;
}
//----------------------------------------------------------------------------
int
CmdParser::GetIdParam( const std::string& sParam, bool bNewAllowed)
{
int nVal ;
// se nome di identificatore numerico
if ( sParam[0] == '$') {
// se variabile già definita, ne restituisco il valore
if ( GetVariable( sParam, nVal))
return nVal ;
// se ammessa nuova definizione, provo ad inserirlo
else if ( bNewAllowed &&
AddVariable( sParam, CMD_ID_NULL))
return CMD_ID_NULL ;
// altrimenti errore
else
return CMD_ID_ERROR ;
}
// se identificatore numerico
else if ( FromString( sParam, nVal))
return nVal ;
// altrimenti errore
else
return CMD_ID_ERROR ;
}
//----------------------------------------------------------------------------
const string
CmdParser::GetInitSpaces( void)