EgtGeneral 1.4a4 : Aggiunte funzioni GetModule*. Si usano solo string.

This commit is contained in:
Dario Sassi
2013-12-11 18:29:32 +00:00
parent 4903e8f3fd
commit 07cfdd76f3
10 changed files with 130 additions and 52 deletions
+14 -7
View File
@@ -13,9 +13,9 @@
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include <iostream>
#include "/EgtDev/Include/EgnStringUtils.h"
#include "CmdParser.h"
#include "/EgtDev/Include/EgnStringUtils.h"
#include <iostream>
using namespace std ;
@@ -30,6 +30,7 @@ CreateCmdParser( void)
CmdParser::CmdParser( void)
{
m_pTheExecutor = nullptr ;
m_pLogger = nullptr ;
}
//----------------------------------------------------------------------------
@@ -39,10 +40,10 @@ CmdParser::~CmdParser( void)
//----------------------------------------------------------------------------
bool
CmdParser::Initialize( wstring sCmdFile, ICmdExecutor* pCmdExec)
CmdParser::Init( string sCmdFile, ICmdExecutor* pCmdExec, ILogger* pLogger)
{
// inizializzo lo scanner
if ( ! m_TheScanner.Initialize( sCmdFile))
if ( ! m_TheScanner.Init( sCmdFile))
return false ;
// verifico la validità dell'esecutore
@@ -52,6 +53,9 @@ CmdParser::Initialize( wstring sCmdFile, ICmdExecutor* pCmdExec)
// salvo il riferimento al documento
m_pTheExecutor = pCmdExec ;
// salvo il gestore di log
m_pLogger = pLogger ;
return true ;
}
@@ -60,6 +64,7 @@ bool
CmdParser::Run( void)
{
bool bOk ;
string sOut ;
string sLine ;
string sCmd ;
string sParams ;
@@ -67,7 +72,8 @@ CmdParser::Run( void)
// log di inizio file
cout << "--- Start : " << m_TheScanner.GetFilePath() << endl ;
sOut = "--- Start : " + m_TheScanner.GetFilePath() ;
LOG_INFO( m_pLogger, sOut.c_str()) ;
// interpretazione dei comandi del file
bOk = true ;
@@ -81,13 +87,14 @@ CmdParser::Run( void)
// deve esserci un comando e deve essere eseguito correttamente
if ( sCmd.empty() || ! ExecCommand( sCmd, sParams)) {
bOk = false ;
cout << "Error on line (" << m_TheScanner.GetCurrLineNbr() << ") : " << sLine << endl ;
sOut = "Error on line (" + ToString( m_TheScanner.GetCurrLineNbr()) + ") : " + sLine ;
LOG_INFO( m_pLogger, sOut.c_str()) ;
}
}
// log di fine file
if ( bOk)
cout << "--- End" << endl ;
LOG_INFO( m_pLogger, "--- End") ;
return bOk ;
}