CLI for C++ Project Page CLI for C++ Home Page

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

CLI::CommandLine Class Reference

A class to represent the parsed result of a command line, included detected options and remaining arguments (non-options). More...

#include <CommandLine.h>

List of all members.

Public Member Functions

 CommandLine ()
 CommandLine (const CommandLine &other)
 Copy-constructor with deep-copy semantics.
 ~CommandLine ()
CommandLineoperator= (const CommandLine &other)
 Assignment operator with deep-copy semantics.
std::vector< std::string > getArgs () const
 Return the standard arguments of the parsed command line.
bool hasOption (const char option) const
 Report if a given option was detected during parsing.
std::string getOptionValue (const char *const option) const
 Report if a given option was detected during parsing.
const Options::Vectoroperator() () const
 Return a vector of all detected options.
void addOption (const Option &sourceOption, int &index, const int argc, const char *argv[])
void addArg (const char *const arg)
void addOption (const Option &sourceOption, Tokens::const_iterator &token, const Tokens::const_iterator &end)
void addArg (const std::string &arg)


Detailed Description

A class to represent the parsed result of a command line, included detected options and remaining arguments (non-options).

Author:
John Poplett
See also:
BasicParser


Constructor & Destructor Documentation

CLI::CommandLine::CommandLine  ) 
 

CLI::CommandLine::CommandLine const CommandLine other  ) 
 

Copy-constructor with deep-copy semantics.

CLI::CommandLine::~CommandLine  ) 
 


Member Function Documentation

void CLI::CommandLine::addArg const std::string &  arg  ) 
 

void CLI::CommandLine::addArg const char *const   arg  ) 
 

void CLI::CommandLine::addOption const Option sourceOption,
Tokens::const_iterator &  token,
const Tokens::const_iterator &  end
 

void CLI::CommandLine::addOption const Option sourceOption,
int &  index,
const int  argc,
const char *  argv[]
 

std::vector<std::string> CLI::CommandLine::getArgs  )  const
 

Return the standard arguments of the parsed command line.

std::string CLI::CommandLine::getOptionValue const char *const   option  )  const
 

Report if a given option was detected during parsing.

Parameters:
option specifies either the short or long option format that we're searching for

bool CLI::CommandLine::hasOption const char  option  )  const
 

Report if a given option was detected during parsing.

Parameters:
option single-character value of the short option.

const Options::Vector& CLI::CommandLine::operator()  )  const
 

Return a vector of all detected options.

CommandLine& CLI::CommandLine::operator= const CommandLine other  ) 
 

Assignment operator with deep-copy semantics.


The documentation for this class was generated from the following file:
SourceForge Logo hosts this site. Send comments to:
John Poplett