Pin
Public Member Functions | List of all members
LEVEL_BASE::COMMAND_LINE_ARGUMENTS Class Reference

Public Member Functions

 COMMAND_LINE_ARGUMENTS ()
 
 COMMAND_LINE_ARGUMENTS (INT argc, const CHAR *const *argv, const CHAR *delimiter=NULL)
 
 COMMAND_LINE_ARGUMENTS (const std::string &commandLine)
 
 COMMAND_LINE_ARGUMENTS (const COMMAND_LINE_ARGUMENTS &source)
 
COMMAND_LINE_ARGUMENTSoperator= (const COMMAND_LINE_ARGUMENTS &source)
 
COMMAND_LINE_ARGUMENTSInsert (const COMMAND_LINE_ARGUMENTS &right, INT pos=-1)
 
COMMAND_LINE_ARGUMENTSInsert (const std::string &arg, INT pos=-1)
 
COMMAND_LINE_ARGUMENTSInsertAsOneToken (const std::string &arg, INT pos=-1)
 
INT FindArgument (const std::string &argStr) const
 
BOOL RemoveArguments (const std::string &argStr, INT numOfArgs)
 
INT Argc () const
 
const CHAR *const * Argv () const
 
std::string String () const
 
 ~COMMAND_LINE_ARGUMENTS ()
 

Detailed Description

class that represents command line arguments

Constructor & Destructor Documentation

◆ COMMAND_LINE_ARGUMENTS() [1/4]

LEVEL_BASE::COMMAND_LINE_ARGUMENTS::COMMAND_LINE_ARGUMENTS ( )
inline

Empty Constructor

◆ COMMAND_LINE_ARGUMENTS() [2/4]

LEVEL_BASE::COMMAND_LINE_ARGUMENTS::COMMAND_LINE_ARGUMENTS ( INT  argc,
const CHAR *const *  argv,
const CHAR *  delimiter = NULL 
)
inline

Constructor. Construct an object from argc, argv and delimiter Example1: argc = 6, argv = {ab bc cd de ef de}, delimiter = "de" => the object will contain: argc = 4, argv = {ab bc cd de} Example2: argc = 6, argv = {ab bc cd de ef de}, delimiter = NULL => the object will contain: argc = 6, argv = {ab bc cd de ef de} Example3: argc = 6, argv = {ab bc cd de ef de}, delimiter = "fg" => the object will contain: argc = 6, argv = {ab bc cd de ef de}

Parameters
[in]argcargc for the command line arguments object
[in]argvargv for the command line arguments object
[in]delimiterremove any argv argument AFTER the delimiter. If it was not found, nothing will be removed

◆ COMMAND_LINE_ARGUMENTS() [3/4]

LEVEL_BASE::COMMAND_LINE_ARGUMENTS::COMMAND_LINE_ARGUMENTS ( const std::string &  commandLine)
inline

Constructor. Construct an object from a string using MS CRT Parsing rules (For more details see GetCmdArg() documentation)

NOTE: Use this function only for original application's command line

Parameters
[in]commandLineoriginal application's command line represented as string

◆ COMMAND_LINE_ARGUMENTS() [4/4]

LEVEL_BASE::COMMAND_LINE_ARGUMENTS::COMMAND_LINE_ARGUMENTS ( const COMMAND_LINE_ARGUMENTS source)
inline

Copy Constructor. Construct an object from another object

Parameters
[in]sourcesource object

◆ ~COMMAND_LINE_ARGUMENTS()

LEVEL_BASE::COMMAND_LINE_ARGUMENTS::~COMMAND_LINE_ARGUMENTS ( )
inline

Destructor

Member Function Documentation

◆ Argc()

INT LEVEL_BASE::COMMAND_LINE_ARGUMENTS::Argc ( ) const
inline
Returns
Argc of current object the value life time is as long as the object was not changed (using operator=(), Insert() or ~COMMAND_LINE_ARGUMENTS() will invalidate this data)

◆ Argv()

const CHAR* const* LEVEL_BASE::COMMAND_LINE_ARGUMENTS::Argv ( ) const
inline
Returns
Argv of current object, the pointer life time is as long as the object was not changed (using operator=(), Insert() or ~COMMAND_LINE_ARGUMENTS() will invalidate this data)

◆ FindArgument()

INT LEVEL_BASE::COMMAND_LINE_ARGUMENTS::FindArgument ( const std::string &  argStr) const

Find an argument by name

Parameters
[in]argStr- argument to be found
Returns
index of argument or -1 if not found

◆ Insert() [1/2]

COMMAND_LINE_ARGUMENTS & LEVEL_BASE::COMMAND_LINE_ARGUMENTS::Insert ( const COMMAND_LINE_ARGUMENTS right,
INT  pos = -1 
)

Insert a set of command line arguments into this set of arguments.

Parameters
[in]argsArguments to be inserted.
[in]posArguments are inserted before the argument with this position. If pos is -1, they are appended to the end.
Returns
reference to current object

◆ Insert() [2/2]

COMMAND_LINE_ARGUMENTS & LEVEL_BASE::COMMAND_LINE_ARGUMENTS::Insert ( const std::string &  arg,
INT  pos = -1 
)

Insert a single argument into this set of arguments.

Parameters
[in]argArgument to be inserted.
[in]posThe argument is inserted before the argument with this position. If pos is -1, it is appended to the end.
Returns
reference to current object

◆ InsertAsOneToken()

COMMAND_LINE_ARGUMENTS & LEVEL_BASE::COMMAND_LINE_ARGUMENTS::InsertAsOneToken ( const std::string &  arg,
INT  pos = -1 
)

Insert a single argument into this set of arguments. Don't try to tokenize (split) the added argument to several arguments.

Parameters
[in]argArgument to be inserted.
[in]posThe argument is inserted before the argument with this position. If pos is -1, it is appended to the end.
Returns
reference to current object

◆ operator=()

COMMAND_LINE_ARGUMENTS& LEVEL_BASE::COMMAND_LINE_ARGUMENTS::operator= ( const COMMAND_LINE_ARGUMENTS source)
inline

Assignment operator

Parameters
[in]sourcesource object
Returns
reference to current object

◆ RemoveArguments()

BOOL LEVEL_BASE::COMMAND_LINE_ARGUMENTS::RemoveArguments ( const std::string &  argStr,
INT  numOfArgs 
)

Looks for argument equal to argStr; remove "numOfArgs" arguments starting from the found argument

Parameters
[in]argStr- argument to be found,
[in]numOfArgs- numer of arguments that should be removed starting from the found argument
Returns
TRUE if numOfArgs were removed from the list

◆ String()

std::string LEVEL_BASE::COMMAND_LINE_ARGUMENTS::String ( ) const
Returns
string with all command line arguments separated with " "

The documentation for this class was generated from the following file: