gramods
Public Member Functions | List of all members
gramods::gmCore::CommandLineParser Class Reference

Simple parser for consuming command line arguments. More...

#include <CommandLineParser.hh>

Public Member Functions

 CommandLineParser (int &argc, char **&argv)
 Creates a new command line parser reading off arguments from the specified command line variables. More...
 
std::string getNextArgument ()
 Returns the next argument and increments the argument pointer. More...
 
bool hasMoreArguments ()
 Returns true if there are more arguments to extract, false otherwise. More...
 
bool consumeLast (int count)
 Removes the last arguments from the associnated command line variables. More...
 

Detailed Description

Simple parser for consuming command line arguments.

For example, the command line "-abc file.xml --config file.xml" will be parsed as "-abc", "file.xml", "--config", "file.xml".

Constructor & Destructor Documentation

◆ CommandLineParser()

gramods::gmCore::CommandLineParser::CommandLineParser ( int &  argc,
char **&  argv 
)

Creates a new command line parser reading off arguments from the specified command line variables.

Member Function Documentation

◆ consumeLast()

bool gramods::gmCore::CommandLineParser::consumeLast ( int  count)

Removes the last arguments from the associnated command line variables.

◆ getNextArgument()

std::string gramods::gmCore::CommandLineParser::getNextArgument ( )

Returns the next argument and increments the argument pointer.

Throws exception if there are no more arguments.

◆ hasMoreArguments()

bool gramods::gmCore::CommandLineParser::hasMoreArguments ( )

Returns true if there are more arguments to extract, false otherwise.


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