Files
EgtGeneral/CmdParser.h
T
Dario Sassi f988de2250 EgtGeneral 1.5e1 :
- in CmdParser aggiunta gestione DirReplace
- in Scanner se RemInit è nullptr non si gestiscono i commenti.
2014-05-12 08:55:50 +00:00

78 lines
3.4 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/EgtPerfCounter.h"
#include "/EgtDev/Include/EgnStringBase.h"
#include "/EgtDev/Include/EgnCmdParser.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 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 ExecuteCounter( const std::string& sCmd2, const STRVECTOR& vsParams) ;
bool ExecuteDir( 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 ExecuteDirReplace( 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_nCurrLine ;
PerformanceCounter m_Counter ;
StrStrVector m_DirReplace ;
} ;