//----------------------------------------------------------------------------- // Returns the argument after the one specified, or the default if not found //----------------------------------------------------------------------------- const char *CCommandLine::ParmValue( const char *psz, const char *pDefaultVal ) const { int nIndex = FindParm( psz ); if (( nIndex == 0 ) || (nIndex == m_nParmCount - 1)) return pDefaultVal; // Probably another cmdline parameter instead of a valid arg if it starts with '+' or '-' if ( m_ppParms[nIndex + 1][0] == '-' || m_ppParms[nIndex + 1][0] == '+' ) return pDefaultVal; return m_ppParms[nIndex + 1]; }
Parm* ParmLinkMgr::FindParm( vector< Geom* > & gVec, int ptrID, Stringc& group_name, Stringc& parm_name ) { Parm* pPtr = NULL; Geom* gPtr = NULL; for ( int i = 0 ; i < (int)gVec.size() ; i++ ) { if ( gVec[i]->getPtrID() == ptrID ) gPtr = gVec[i]; } //==== Check for User Geom ====// if ( gPtr == NULL ) { if ( group_name == Stringc("User") ) { gPtr = aircraftPtr->getUserGeom(); } } pPtr = FindParm( gPtr, group_name, parm_name ); return pPtr; }
//----------------------------------------------------------------------------- // Purpose: Search for the parameter in the current commandline // Input : *psz - // **ppszValue - // Output : char //----------------------------------------------------------------------------- const char *CCommandLine::CheckParm( const char *psz, const char **ppszValue ) const { if ( ppszValue ) *ppszValue = NULL; int i = FindParm( psz ); if ( i == 0 ) return NULL; if ( ppszValue ) { if ( (i+1) >= m_nParmCount ) { *ppszValue = NULL; } else { *ppszValue = m_ppParms[i+1]; } } return m_ppParms[i]; }