//++ ------------------------------------------------------------------------------------ // Details: Create list of argument objects each holding a value extract from the command // options line. // Type: Method. // Args: vrTxt - (R) Some options text. // Return: bool - True = yes valid arg, false = no. // Throws: None. //-- bool CMICmdArgValListOfN::CreateList(const CMIUtilString &vrTxt) { CMIUtilString::VecString_t vecOptions; if ((m_eArgType == eArgValType_StringQuoted) || (m_eArgType == eArgValType_StringQuotedNumber) || (m_eArgType == eArgValType_StringQuotedNumberPath) || (m_eArgType == eArgValType_StringAnything)) { if (vrTxt.SplitConsiderQuotes(" ", vecOptions) == 0) return MIstatus::failure; } else if (vrTxt.Split(" ", vecOptions) == 0) return MIstatus::failure; CMIUtilString::VecString_t::const_iterator it = vecOptions.begin(); while (it != vecOptions.end()) { const CMIUtilString &rOption = *it; CMICmdArgValBase *pOption = CreationObj(rOption, m_eArgType); if (pOption != nullptr) m_argValue.push_back(pOption); else return MIstatus::failure; // Next ++it; } return MIstatus::success; }
//++ ------------------------------------------------------------------------------------ // 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 CMICmdArgValListOfN::IsListOfN(const CMIUtilString &vrTxt) const { CMIUtilString::VecString_t vecOptions; if ((m_eArgType == eArgValType_StringQuoted) || (m_eArgType == eArgValType_StringQuotedNumber) || (m_eArgType == eArgValType_StringQuotedNumberPath) || (m_eArgType == eArgValType_StringAnything)) { if (vrTxt.SplitConsiderQuotes(" ", vecOptions) == 0) return false; } else if (vrTxt.Split(" ", vecOptions) == 0) return false; CMIUtilString::VecString_t::const_iterator it = vecOptions.begin(); while (it != vecOptions.end()) { const CMIUtilString &rOption = *it; if (!IsExpectedCorrectType(rOption, m_eArgType)) break; // Next ++it; } return true; }