iRoCS Toolbox  1.1.0
Public Member Functions
ArgvIter Class Reference

The ArgvIter class fetches arguments from a c-style char* array. More...

#include <ArgvIter.hh>

Inheritance diagram for ArgvIter:
Collaboration diagram for ArgvIter:

Public Member Functions

 ArgvIter (int argc, const char *const *argv)
 Constructor. More...
 
const char * fetch ()
 Returns the current argument, advances to the next argument and returns NULL is there are no arguments anymore. More...
 
void reset (int argc, const char *const *argv)
 Specify new array of strings to be parsed. More...
 

Detailed Description

The ArgvIter class fetches arguments from a c-style char* array.

The ArgvIter class fetches arguments from a c-style array. If you want to parse arguments that were delivered to your program on the command line, you use this class for iterating through them.

Example:
int main(int argc, char** argv)
{
// read arguments from the command line
ArgvIter iter(argc, argv);
...
CmdLine cline("testprog", "this is just a test program");
cline.parse(iter);
...
}

Definition at line 86 of file ArgvIter.hh.

Constructor & Destructor Documentation

◆ ArgvIter()

ArgvIter::ArgvIter ( int  argc,
const char *const *  argv 
)
inline

Constructor.

Parameters
argcnumber of elements in argv
argvarray of strings containing the arguments

Definition at line 97 of file ArgvIter.hh.

Member Function Documentation

◆ fetch()

const char* ArgvIter::fetch ( )
inlinevirtual

Returns the current argument, advances to the next argument and returns NULL is there are no arguments anymore.

Returns
current argument, NULL if no arguments

Implements ArgIter.

Definition at line 114 of file ArgvIter.hh.

◆ reset()

void ArgvIter::reset ( int  argc,
const char *const *  argv 
)
inline

Specify new array of strings to be parsed.

Parameters
argcnumber of elements in argv
argvarray of strings containing the arguments

Definition at line 136 of file ArgvIter.hh.


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