コード例 #1
0
ファイル: MICmdCmdBreak.cpp プロジェクト: Jean-Daniel/lldb
//++ ------------------------------------------------------------------------------------
// Details:	A breakpoint expression can be passed to *this command as:
//				a single string i.e. '2' -> ok.
//				a quoted string i.e. "a > 100" -> ok
//				a non quoted string i.e. 'a > 100' -> not ok 
//			CMICmdArgValString only extracts the first space seperated string, the "a".
//			This function using the optional argument type CMICmdArgValListOfN collects 
//			the rest of the expression so that is may be added to the 'a' part to form a
//			complete expression string i.e. "a > 100".
//			If the expression value was guaranteed to be surrounded by quotes them this 
//			function would not be necessary.
// Type:	Method.
// Args:	None.
// Return:	CMIUtilString - Rest of the breakpoint expression.
// Throws:	None.
//--
CMIUtilString CMICmdCmdBreakCondition::GetRestOfExpressionNotSurroundedInQuotes( void )
{
	CMIUtilString strExpression;
		
	CMICmdArgValListOfN * pArgExprNoQuotes = CMICmdBase::GetOption< CMICmdArgValListOfN >( m_constStrArgNamedExprNoQuotes );
	if( pArgExprNoQuotes != nullptr )
	{
		CMIUtilString strExpression;
		const CMICmdArgValListBase::VecArgObjPtr_t & rVecExprParts( pArgExprNoQuotes->GetExpectedOptions() );
		if( !rVecExprParts.empty() )
		{
			CMICmdArgValListBase::VecArgObjPtr_t::const_iterator it = rVecExprParts.begin();
			while( it != rVecExprParts.end() )
			{
				const CMICmdArgValString * pPartExpr = static_cast< CMICmdArgValString * >( *it );
				const CMIUtilString & rPartExpr = pPartExpr->GetValue();
				strExpression += " ";
				strExpression += rPartExpr;

				// Next
				++it;
			}
			strExpression = strExpression.Trim();
		}
	}

	return strExpression;
}