Tree Compression with Top Trees Revisited
Public Member Functions | List of all members
ArgParser Class Reference

Parse command-line arguments. More...

#include <ArgParser.h>

Public Member Functions

 ArgParser (int argc, char **argv)
 Parse command-line arguments. More...
 
template<typename T >
get (const string &key, const T defaultValue=T())
 
bool isSet (const string &arg) const
 check whether an argument was set More...
 
uint numDataArgs () const
 the number of unnamed data arguments More...
 
string getDataArg (const int index) const
 get a data argument by its index (among the data arguments) More...
 

Detailed Description

Parse command-line arguments.

A simple command-line parser.

Supports named arguments and switches as well as unnamed data arguments

Example: ./foo -v -o outfolder in1.xml in2.xml

Definition at line 21 of file ArgParser.h.

Constructor & Destructor Documentation

ArgParser::ArgParser ( int  argc,
char **  argv 
)
inline

Parse command-line arguments.

Definition at line 24 of file ArgParser.h.

Member Function Documentation

template<typename T >
T ArgParser::get ( const string &  key,
const T  defaultValue = T() 
)
inline

Get a named argument's value

Parameters
keythe argument name
defaultValuethe value to return if the argument wasn't set

Definition at line 44 of file ArgParser.h.

string ArgParser::getDataArg ( const int  index) const
inline

get a data argument by its index (among the data arguments)

Definition at line 68 of file ArgParser.h.

bool ArgParser::isSet ( const string &  arg) const
inline

check whether an argument was set

Definition at line 58 of file ArgParser.h.

uint ArgParser::numDataArgs ( ) const
inline

the number of unnamed data arguments

Definition at line 63 of file ArgParser.h.


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