Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
tools/lldb-mi/MICmdArgValListOfN.h
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
// Methods: | // Methods: | ||||
public: | public: | ||||
/* ctor */ CMICmdArgValListOfN(void); | /* ctor */ CMICmdArgValListOfN(void); | ||||
/* ctor */ CMICmdArgValListOfN(const CMIUtilString &vrArgName, const bool vbMandatory, const bool vbHandleByCmd, | /* ctor */ CMICmdArgValListOfN(const CMIUtilString &vrArgName, const bool vbMandatory, const bool vbHandleByCmd, | ||||
const ArgValType_e veType); | const ArgValType_e veType); | ||||
// | // | ||||
const VecArgObjPtr_t &GetExpectedOptions(void) const; | const VecArgObjPtr_t &GetExpectedOptions(void) const; | ||||
template <class T1, typename T2> bool GetExpectedOption(T2 &vrwValue) const; | template <class T1, typename T2> bool GetExpectedOption(T2 &vrwValue, const VecArgObjPtr_t::size_type vnAt = 0) const; | ||||
// Overridden: | // Overridden: | ||||
public: | public: | ||||
// From CMICmdArgValBase | // From CMICmdArgValBase | ||||
/* dtor */ virtual ~CMICmdArgValListOfN(void); | /* dtor */ virtual ~CMICmdArgValListOfN(void); | ||||
// From CMICmdArgSet::IArg | // From CMICmdArgSet::IArg | ||||
virtual bool Validate(CMICmdArgContext &vArgContext); | virtual bool Validate(CMICmdArgContext &vArgContext); | ||||
// Methods: | // Methods: | ||||
private: | private: | ||||
bool IsListOfN(const CMIUtilString &vrTxt) const; | bool IsListOfN(const CMIUtilString &vrTxt) const; | ||||
bool CreateList(const CMIUtilString &vrTxt); | bool CreateList(const CMIUtilString &vrTxt); | ||||
}; | }; | ||||
//++ ------------------------------------------------------------------------------------ | //++ ------------------------------------------------------------------------------------ | ||||
// Details: Retrieve the first argument or option value from the list of 1 or more options | // Details: Retrieve the first argument or option value from the list of 1 or more options | ||||
// parsed from the command's options string. | // parsed from the command's options string. | ||||
// Type: Template method. | // Type: Template method. | ||||
// Args: vrwValue - (W) Templated type return value. | // Args: vrwValue - (W) Templated type return value. | ||||
// vnAt - (R) Value at the specific position. | |||||
// T1 - The argument value's class type of the data hold in the list of options. | // T1 - The argument value's class type of the data hold in the list of options. | ||||
// T2 - The type pf the variable which holds the value wanted. | // T2 - The type pf the variable which holds the value wanted. | ||||
// Return: MIstatus::success - Functional succeeded. | // Return: MIstatus::success - Functional succeeded. | ||||
// MIstatus::failure - Functional failed. List of object was empty. | // MIstatus::failure - Functional failed. List of object was empty. | ||||
// Throws: None. | // Throws: None. | ||||
//-- | //-- | ||||
template <class T1, typename T2> | template <class T1, typename T2> | ||||
bool | bool | ||||
CMICmdArgValListOfN::GetExpectedOption(T2 &vrwValue) const | CMICmdArgValListOfN::GetExpectedOption(T2 &vrwValue, const VecArgObjPtr_t::size_type vnAt) const | ||||
{ | { | ||||
const VecArgObjPtr_t &rVecOptions(GetExpectedOptions()); | const VecArgObjPtr_t &rVecOptions(GetExpectedOptions()); | ||||
VecArgObjPtr_t::const_iterator it2 = rVecOptions.begin(); | if (rVecOptions.size() <= vnAt) | ||||
return MIstatus::failure; | |||||
VecArgObjPtr_t::const_iterator it2 = rVecOptions.begin() + vnAt; | |||||
if (it2 != rVecOptions.end()) | if (it2 != rVecOptions.end()) | ||||
{ | { | ||||
const T1 *pOption = static_cast<T1 *>(*it2); | const T1 *pOption = static_cast<T1 *>(*it2); | ||||
vrwValue = pOption->GetValue(); | vrwValue = pOption->GetValue(); | ||||
return MIstatus::success; | return MIstatus::success; | ||||
} | } | ||||
return MIstatus::failure; | return MIstatus::failure; | ||||
} | } |