2042d2b4ee
- aggiustate maiuscole/minuscole per inclusione file.
82 lines
3.7 KiB
C++
82 lines
3.7 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2013-2013
|
|
//----------------------------------------------------------------------------
|
|
// File : CmdParser.h Data : 25.11.13 Versione : 1.3a1
|
|
// Contenuto : Dichiarazione della classe CmdParser.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 19.01.13 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "CmdScanner.h"
|
|
#include "/EgtDev/Include/EGnCmdParser.h"
|
|
#include "/EgtDev/Include/EgtPerfCounter.h"
|
|
#include "/EgtDev/Include/EgtStringBase.h"
|
|
#include "/EgtDev/Include/EgtExecMgr.h"
|
|
|
|
//----------------------------------------------------------------------------
|
|
class CmdParser : public ICmdParser
|
|
{
|
|
public : // ICmdParser
|
|
virtual ~CmdParser( void) ;
|
|
virtual bool Init( void) ;
|
|
virtual bool SetExecutor( ICmdExecutor* pCmdExec) ;
|
|
virtual bool AddExecutor( ICmdExecutor* pCmdExec) ;
|
|
virtual bool AddVariable( const std::string& sName, int nVal) ;
|
|
virtual bool SetVariable( const std::string& sName, int nVal) ;
|
|
virtual bool GetVariable( const std::string& sName, int& nVal) ;
|
|
virtual bool RemoveVariable( const std::string& sName) ;
|
|
virtual void ResetDirReplace( void) ;
|
|
virtual bool SetDirReplace( const std::string& sToken, const std::string& sReplace) ;
|
|
virtual int DirReplace( std::string& sPath) ;
|
|
virtual int DirInvReplace( std::string& sPath) ;
|
|
virtual int GetIdParam( const std::string& sParam, bool bNewAllowed = false) ;
|
|
virtual bool GetStringParam( const std::string& sParam, std::string& sString) ;
|
|
virtual bool Run( const std::string& sCmdFile, bool bIsolated = true) ;
|
|
virtual bool ExecLine( const std::string& sCmdLine, bool bIsolated = false) ;
|
|
|
|
public :
|
|
CmdParser( void) ;
|
|
|
|
private :
|
|
bool ResetAllVariables( void) ;
|
|
std::string GetInitSpaces( void) ;
|
|
bool ExecCommand( const std::string& sCmd, const std::string& sParams) ;
|
|
bool ExecuteAssert( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
|
bool ExecuteCounter( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
|
bool ExecuteDir( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
|
bool ExecuteDirReplace( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
|
bool ExecuteExec( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
|
bool ExecuteFile( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
|
bool ExecuteOutLog( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
|
bool ExecutePause( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
|
bool ExecuteReset( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
|
bool ExecuteRun( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
|
bool ExecuteSet( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
|
bool GetNamesParam( const std::string& sParam, STRVECTOR& vsNames) ;
|
|
|
|
private :
|
|
typedef std::list<ICmdExecutor*> PCmdExecList ;
|
|
typedef std::unordered_map<std::string, int> NameMap ;
|
|
typedef std::vector<std::pair<std::string, std::string>> StrStrVector ;
|
|
|
|
private :
|
|
enum Exec{ SKIP = 1, DO = 2, STOP = 3} ;
|
|
|
|
private :
|
|
PCmdExecList m_CmdExecList ;
|
|
NameMap m_NameMap ;
|
|
ExecManager<CmdParser> m_ExecMgr ;
|
|
int m_nLev ;
|
|
Exec m_nExec ;
|
|
int m_nAssertNextError ;
|
|
int m_nCurrLine ;
|
|
PerformanceCounter m_Counter ;
|
|
StrStrVector m_DirReplace ;
|
|
} ;
|