diff options
Diffstat (limited to 'tools/lldb-mi/MICmdArgValOptionShort.cpp')
-rw-r--r-- | tools/lldb-mi/MICmdArgValOptionShort.cpp | 152 |
1 files changed, 78 insertions, 74 deletions
diff --git a/tools/lldb-mi/MICmdArgValOptionShort.cpp b/tools/lldb-mi/MICmdArgValOptionShort.cpp index 76adb7f11493..5a2b491d3c72 100644 --- a/tools/lldb-mi/MICmdArgValOptionShort.cpp +++ b/tools/lldb-mi/MICmdArgValOptionShort.cpp @@ -8,15 +8,15 @@ //===----------------------------------------------------------------------===// //++ -// File: MICmdArgValOptionShort.cpp +// File: MICmdArgValOptionShort.cpp // -// Overview: CMICmdArgValOptionShort implementation. +// Overview: CMICmdArgValOptionShort implementation. // -// Environment: Compilers: Visual C++ 12. -// gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1 -// Libraries: See MIReadmetxt. +// Environment: Compilers: Visual C++ 12. +// gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1 +// Libraries: See MIReadmetxt. // -// Copyright: None. +// Copyright: None. //-- // In-house headers: @@ -24,105 +24,109 @@ #include "MICmdArgContext.h" //++ ------------------------------------------------------------------------------------ -// Details: CMICmdArgValOptionShort constructor. -// Type: Method. -// Args: None. -// Return: None. -// Throws: None. +// Details: CMICmdArgValOptionShort constructor. +// Type: Method. +// Args: None. +// Return: None. +// Throws: None. //-- -CMICmdArgValOptionShort::CMICmdArgValOptionShort( void ) +CMICmdArgValOptionShort::CMICmdArgValOptionShort(void) { } //++ ------------------------------------------------------------------------------------ -// Details: CMICmdArgValOptionShort constructor. -// Type: Method. -// Args: vrArgName - (R) Argument's name to search by. -// vbMandatory - (R) True = Yes must be present, false = optional argument. -// vbHandleByCmd - (R) True = Command processes *this option, false = not handled. -// Return: None. -// Throws: None. +// Details: CMICmdArgValOptionShort constructor. +// Type: Method. +// Args: vrArgName - (R) Argument's name to search by. +// vbMandatory - (R) True = Yes must be present, false = optional argument. +// vbHandleByCmd - (R) True = Command processes *this option, false = not handled. +// Return: None. +// Throws: None. //-- -CMICmdArgValOptionShort::CMICmdArgValOptionShort( const CMIUtilString & vrArgName, const bool vbMandatory, const bool vbHandleByCmd ) -: CMICmdArgValOptionLong( vrArgName, vbMandatory, vbHandleByCmd ) +CMICmdArgValOptionShort::CMICmdArgValOptionShort(const CMIUtilString &vrArgName, const bool vbMandatory, const bool vbHandleByCmd) + : CMICmdArgValOptionLong(vrArgName, vbMandatory, vbHandleByCmd) { } //++ ------------------------------------------------------------------------------------ -// Details: CMICmdArgValOptionLong constructor. -// Type: Method. -// Args: vrArgName - (R) Argument's name to search by. -// vbMandatory - (R) True = Yes must be present, false = optional argument. -// vbHandleByCmd - (R) True = Command processes *this option, false = not handled. -// veType - (R) The type of argument to look for and create argument object of a certain type. -// vnExpectingNOptions - (R) The number of options expected to read following *this argument. -// Return: None. -// Throws: None. +// Details: CMICmdArgValOptionLong constructor. +// Type: Method. +// Args: vrArgName - (R) Argument's name to search by. +// vbMandatory - (R) True = Yes must be present, false = optional argument. +// vbHandleByCmd - (R) True = Command processes *this option, false = not handled. +// veType - (R) The type of argument to look for and create argument object of a certain type. +// vnExpectingNOptions - (R) The number of options expected to read following *this argument. +// Return: None. +// Throws: None. //-- -CMICmdArgValOptionShort::CMICmdArgValOptionShort( const CMIUtilString & vrArgName, const bool vbMandatory, const bool vbHandleByCmd, const ArgValType_e veType, const MIuint vnExpectingNOptions ) -: CMICmdArgValOptionLong( vrArgName, vbMandatory, vbHandleByCmd, veType, vnExpectingNOptions ) +CMICmdArgValOptionShort::CMICmdArgValOptionShort(const CMIUtilString &vrArgName, const bool vbMandatory, const bool vbHandleByCmd, + const ArgValType_e veType, const MIuint vnExpectingNOptions) + : CMICmdArgValOptionLong(vrArgName, vbMandatory, vbHandleByCmd, veType, vnExpectingNOptions) { } //++ ------------------------------------------------------------------------------------ -// Details: CMICmdArgValOptionShort destructor. -// Type: Overridden. -// Args: None. -// Return: None. -// Throws: None. +// Details: CMICmdArgValOptionShort destructor. +// Type: Overridden. +// Args: None. +// Return: None. +// Throws: None. //-- -CMICmdArgValOptionShort::~CMICmdArgValOptionShort( void ) +CMICmdArgValOptionShort::~CMICmdArgValOptionShort(void) { } //++ ------------------------------------------------------------------------------------ -// Details: Examine the string and determine if it is a valid short type option argument. -// Type: Method. -// Args: vrTxt - (R) Some text. -// Return: bool - True = yes valid arg, false = no. -// Throws: None. +// Details: Examine the string and determine if it is a valid short type option argument. +// Type: Method. +// Args: vrTxt - (R) Some text. +// Return: bool - True = yes valid arg, false = no. +// Throws: None. //-- -bool CMICmdArgValOptionShort::IsArgShortOption( const CMIUtilString & vrTxt ) const +bool +CMICmdArgValOptionShort::IsArgShortOption(const CMIUtilString &vrTxt) const { - // Look for --someLongOption - MIint nPos = vrTxt.find( "--" ); - if( nPos == 0 ) - return false; - - // Look for -f short option - nPos = vrTxt.find( "-" ); - if( nPos != 0 ) - return false; - - if( vrTxt.length() > 2 ) - return false; + // Look for --someLongOption + MIint nPos = vrTxt.find("--"); + if (nPos == 0) + return false; - return true; + // Look for -f short option + nPos = vrTxt.find("-"); + if (nPos != 0) + return false; + + if (vrTxt.length() > 2) + return false; + + return true; } //++ ------------------------------------------------------------------------------------ -// Details: Examine the string and determine if it is a valid short type option argument. -// Long type argument looks like -f some short option. -// Type: Overridden. -// Args: vrTxt - (R) Some text. -// Return: bool - True = yes valid arg, false = no. -// Throws: None. +// Details: Examine the string and determine if it is a valid short type option argument. +// Long type argument looks like -f some short option. +// Type: Overridden. +// Args: vrTxt - (R) Some text. +// Return: bool - True = yes valid arg, false = no. +// Throws: None. //-- -bool CMICmdArgValOptionShort::IsArgOptionCorrect( const CMIUtilString & vrTxt ) const +bool +CMICmdArgValOptionShort::IsArgOptionCorrect(const CMIUtilString &vrTxt) const { - return IsArgShortOption( vrTxt ); + return IsArgShortOption(vrTxt); } //++ ------------------------------------------------------------------------------------ -// Details: Does the argument name of the argument being parsed ATM match the name of -// *this argument object. -// Type: Overridden. -// Args: vrTxt - (R) Some text. -// Return: bool - True = yes arg name matched, false = no. -// Throws: None. +// Details: Does the argument name of the argument being parsed ATM match the name of +// *this argument object. +// Type: Overridden. +// Args: vrTxt - (R) Some text. +// Return: bool - True = yes arg name matched, false = no. +// Throws: None. //-- -bool CMICmdArgValOptionShort::ArgNameMatch( const CMIUtilString & vrTxt ) const +bool +CMICmdArgValOptionShort::ArgNameMatch(const CMIUtilString &vrTxt) const { - const CMIUtilString strArg = vrTxt.substr( 1 ).c_str(); - return (strArg == GetName() ); + const CMIUtilString strArg = vrTxt.substr(1).c_str(); + return (strArg == GetName()); } |