iRoCS Toolbox  1.1.0
Public Member Functions
IStreamIter Class Reference

The IStreamIter class fetches arguments from an input stream. More...

#include "libcmdline/IStreamIter.hh"

Inheritance diagram for IStreamIter:
Collaboration diagram for IStreamIter:

Public Member Functions

 IStreamIter (std::istream &is, const std::string &separator="---")
 Constructor. More...
 
const char * fetch ()
 Returns the current argument, advances to the next argument and returns NULL is there are no arguments anymore or if the specified separator string occured. More...
 

Detailed Description

The IStreamIter class fetches arguments from an input stream.

The ArgvIter class fetches arguments from an input stream. If you want to parse arguments from an input stream like a file input stream or std::cin, etc., you use this class for iterating through them.

Example:
int main(int argc, char** argv)
{
// read arguments from stdin
IStreamIter iter(std::cin);
...
CmdLine cline("testprog", "this is just a test program");
cline.parse(iter);
...
}

Definition at line 97 of file IStreamIter.hh.

Constructor & Destructor Documentation

◆ IStreamIter()

IStreamIter::IStreamIter ( std::istream &  is,
const std::string &  separator = "---" 
)
inline

Constructor.

Parameters
isinput stream to read arguments from
separatorstring that marks the eof

Definition at line 108 of file IStreamIter.hh.

Member Function Documentation

◆ fetch()

const char* IStreamIter::fetch ( )
inlinevirtual

Returns the current argument, advances to the next argument and returns NULL is there are no arguments anymore or if the specified separator string occured.

Returns
current argument, NULL if no arguments

Implements ArgIter.

Definition at line 125 of file IStreamIter.hh.


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