//++ ------------------------------------------------------------------------------------ // 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; }
//++ ------------------------------------------------------------------------------------ // 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: Return the resolved file's path for the given file. // Type: Method. // Args: vstrUnknown - (R) String assigned to path when resolved path is empty. // vwrResolvedPath - (RW) The original path overwritten with resolved path. // Return: MIstatus::success - Functional succeeded. // MIstatus::failure - Functional failed. // Throws: None. //-- bool CMICmnLLDBDebugSessionInfo::ResolvePath(const CMIUtilString &vstrUnknown, CMIUtilString &vwrResolvedPath) { if (vwrResolvedPath.size() < 1) { vwrResolvedPath = vstrUnknown; return MIstatus::success; } bool bOk = MIstatus::success; CMIUtilString::VecString_t vecPathFolders; const MIuint nSplits = vwrResolvedPath.Split("/", vecPathFolders); MIunused(nSplits); MIuint nFoldersBack = 1; // 1 is just the file (last element of vector) while (bOk && (vecPathFolders.size() >= nFoldersBack)) { CMIUtilString strTestPath; MIuint nFoldersToAdd = nFoldersBack; while (nFoldersToAdd > 0) { strTestPath += "/"; strTestPath += vecPathFolders[vecPathFolders.size() - nFoldersToAdd]; nFoldersToAdd--; } bool bYesAccessible = false; bOk = AccessPath(strTestPath, bYesAccessible); if (bYesAccessible) { vwrResolvedPath = strTestPath; return MIstatus::success; } else nFoldersBack++; } // No files exist in the union of working directory and debuginfo path // Simply use the debuginfo path and let the IDE handle it. return bOk; }