Exemplo n.º 1
0
//++ ------------------------------------------------------------------------------------
// Details:	Examine the string and determine if it is a valid string type argument.
// Type:	Method.
// Args:	vrTxt	- (R) Some text.
// Return:	bool -	True = yes valid arg, false = no.
// Throws:	None.
//--
bool CMICmdArgValString::IsStringArg( const CMIUtilString & vrTxt ) const
{
	if( m_bHandleQuotedString )
		return (IsStringArgQuotedText( vrTxt ) || 
				IsStringArgQuotedTextEmbedded( vrTxt ) || 
				IsStringArgQuotedQuotedTextEmbedded( vrTxt ) ||
				IsStringArgSingleText( vrTxt ) ); // Still test for this as could just be one word still
	
	return IsStringArgSingleText( vrTxt );
}
Exemplo n.º 2
0
//++ ------------------------------------------------------------------------------------
// Details:	Examine the string and determine if it is a valid string type argument.
// Type:	Method.
// Args:	vrTxt	- (R) Some text.
// Return:	bool -	True = yes valid arg, false = no.
// Throws:	None.
//--
bool CMICmdArgValString::IsStringArg( const CMIUtilString & vrTxt ) const
{
	if( m_bHandleQuotedString )
		return IsStringArgQuotedText( vrTxt );
	
	return IsStringArgSingleText( vrTxt );
}
Exemplo n.º 3
0
//++ ------------------------------------------------------------------------------------
// Details:	Examine the string and determine if it is a valid string type argument.
// Type:	Method.
// Args:	vrTxt	- (R) Some text.
// Return:	bool -	True = yes valid arg, false = no.
// Throws:	None.
//--
bool CMICmdArgValString::IsStringArgQuotedText( const CMIUtilString & vrTxt ) const
{
	// CODETAG_QUOTEDTEXT_SIMILAR_CODE
	const MIchar cQuote = '"';
	const MIint nPos = vrTxt.find( cQuote );
	if( nPos == (MIint) std::string::npos )
		return IsStringArgSingleText( vrTxt );

	// Is one and only quote at end of the string
	if( nPos == (MIint)(vrTxt.length() - 1) )
		return false;

	// Quote must be the first character in the string or be preceeded by a space
	if( (nPos > 0) && (vrTxt[ nPos - 1 ] != ' ' ) )
		return false;
	
	// Need to find the other quote
	const MIint nPos2 = vrTxt.find( cQuote, nPos + 1 );
	if( nPos2 == (MIint) std::string::npos )
		return false;

	return true;
}