LLDB mainline
|
A pair of an option list with a 'raw' string as a suffix. More...
#include "lldb/Utility/Args.h"
Public Member Functions | |
OptionsWithRaw (llvm::StringRef argument_string) | |
Parse the given string as a list of optional arguments with a raw suffix. | |
bool | HasArgs () const |
Returns true if there are any arguments before the raw suffix. | |
Args & | GetArgs () |
Returns the list of arguments. | |
const Args & | GetArgs () const |
Returns the list of arguments. | |
llvm::StringRef | GetArgStringWithDelimiter () const |
Returns the part of the input string that was used for parsing the argument list. | |
llvm::StringRef | GetArgString () const |
Returns the part of the input string that was used for parsing the argument list. | |
const std::string & | GetRawPart () const |
Returns the raw suffix part of the parsed string. | |
Private Member Functions | |
void | SetFromString (llvm::StringRef arg_string) |
Private Attributes | |
bool | m_has_args = false |
Keeps track if we have parsed and stored any arguments. | |
Args | m_args |
llvm::StringRef | m_arg_string |
llvm::StringRef | m_arg_string_with_delimiter |
std::string | m_suffix |
A pair of an option list with a 'raw' string as a suffix.
This class works similar to Args, but handles the case where we have a trailing string that shouldn't be interpreted as a list of arguments but preserved as is. It is also only useful for handling command line options (e.g. '-foo bar -i0') that start with a dash.
The leading option list is optional. If the first non-space character in the string starts with a dash, and the string contains an argument that is an unquoted double dash (' – '), then everything up to the double dash is parsed as a list of arguments. Everything after the double dash is interpreted as the raw suffix string. Note that the space behind the double dash is not part of the raw suffix.
All strings not matching the above format as considered to be just a raw string without any options.
|
explicit |
Parse the given string as a list of optional arguments with a raw suffix.
See the class description for a description of the input format.
[in] | argument_string | The string that should be parsed. |
Definition at line 631 of file Args.cpp.
References SetFromString().
|
inline |
Returns the list of arguments.
You can only call this method if HasArgs returns true.
Definition at line 331 of file Args.h.
References m_args, and m_has_args.
Referenced by CommandObjectScriptingRun::DoExecute(), and CommandObjectPlatformShell::DoExecute().
|
inline |
Returns the list of arguments.
You can only call this method if HasArgs returns true.
Definition at line 339 of file Args.h.
References m_args, and m_has_args.
|
inline |
Returns the part of the input string that was used for parsing the argument list.
You can only call this method if HasArgs returns true.
Definition at line 358 of file Args.h.
References m_arg_string, and m_has_args.
|
inline |
Returns the part of the input string that was used for parsing the argument list.
This string also includes the double dash that is used for separating the argument list from the suffix.
You can only call this method if HasArgs returns true.
Definition at line 349 of file Args.h.
References m_arg_string_with_delimiter, and m_has_args.
|
inline |
Returns the raw suffix part of the parsed string.
Definition at line 364 of file Args.h.
References m_suffix.
Referenced by lldb_private::CommandObjectDWIMPrint::DoExecute(), CommandObjectScriptingRun::DoExecute(), and CommandObjectPlatformShell::DoExecute().
|
inline |
Returns true if there are any arguments before the raw suffix.
Definition at line 326 of file Args.h.
References m_has_args.
Referenced by CommandObjectScriptingRun::DoExecute(), and CommandObjectPlatformShell::DoExecute().
|
private |
Definition at line 635 of file Args.cpp.
References lldb_private::Args::ArgEntry::IsQuoted(), ltrimForArgs(), m_arg_string, m_arg_string_with_delimiter, m_args, m_has_args, m_suffix, and ParseSingleArgument().
Referenced by OptionsWithRaw().
|
private |
Definition at line 372 of file Args.h.
Referenced by GetArgString(), and SetFromString().
|
private |
Definition at line 373 of file Args.h.
Referenced by GetArgStringWithDelimiter(), and SetFromString().
|
private |
Definition at line 371 of file Args.h.
Referenced by GetArgs(), and SetFromString().
|
private |
Keeps track if we have parsed and stored any arguments.
Definition at line 370 of file Args.h.
Referenced by GetArgs(), GetArgString(), GetArgStringWithDelimiter(), HasArgs(), and SetFromString().
|
private |
Definition at line 377 of file Args.h.
Referenced by GetRawPart(), and SetFromString().