CLP Class Reference

#include <CLP.h>

List of all members.

Public Member Functions

 CLP (std::string name, std::string version, std::string copyright, std::string url, std::string usage)
void addUsage (const std::string usage)
void addSwitch (std::string name, std::string shortName, std::string description, unsigned numberOfArguments=0)
std::string getSwitchArgument (std::string name, unsigned index)
bool parse (unsigned int argc, const char *argv[])
bool hasSwitchSet (std::string name)
const std::vector< std::string > & getArguments ()
const std::vector< std::string > & getNetworkArguments ()
const std::vector< std::string > & getMysqlArguments ()
bool hasMysqlArguments ()
void printCopyrightNotice () const
void printHelp () const
void printArguments () const

Private Member Functions

void _setSwitchArguments (std::string currentSwitch, unsigned int argc, const char *argv[], unsigned int &currentIndex, CLS &cls)
void _processMysqlArguments (std::string argument)
std::string _getShortSwitchNameMapping (const std::string &shortName)
bool _shortNameExists (const std::string &shortName)

Private Attributes

std::string _name
std::string _version
std::string _copyright
std::string _url
std::string _usage
std::map< std::string,
std::string > 
_shortSwitchMapping
std::map< std::string, CLS_switches
std::vector< std::string > _arguments
std::vector< std::string > _networkArguments
std::vector< std::string > _mysqlArguments

Static Private Attributes

static const std::string _NETWORK_TYPE = "http://"
static const std::string _NETWORK_TYPE_SECURE = "https://"
static const std::string _MYSQL_TYPE = "mysql://"

Constructor & Destructor Documentation

CLP::CLP ( std::string  name = "",
std::string  version = "",
std::string  copyright = "",
std::string  url = "",
std::string  usage = "" 
)

References _copyright, _name, _url, _usage, and _version.


Member Function Documentation

std::string CLP::_getShortSwitchNameMapping ( const std::string &  shortName  )  [private]
void CLP::_processMysqlArguments ( std::string  argument  )  [private]

References _mysqlArguments.

Referenced by parse().

void CLP::_setSwitchArguments ( std::string  currentSwitch,
unsigned int  argc,
const char *  argv[],
unsigned int &  currentIndex,
CLS cls 
) [private]

_setSwitchArguments: Some of the switches require arguments. This method saves the arguments passed to a switch in a map.

References CLS::addSwitchArgument(), CLS::getNumberOfSwitchArguments(), CLS::resetSwitch(), and CLS::setSwitch().

Referenced by parse().

bool CLP::_shortNameExists ( const std::string &  shortName  )  [private]

References _shortSwitchMapping.

Referenced by addSwitch().

void CLP::addSwitch ( std::string  name,
std::string  shortName,
std::string  description,
unsigned  numberOfArguments = 0 
)

References _shortNameExists(), _shortSwitchMapping, and _switches.

Referenced by main().

void CLP::addUsage ( const std::string  usage  ) 
const std::vector< std::string > & CLP::getArguments (  ) 

References _arguments.

Referenced by main().

const std::vector< std::string > & CLP::getMysqlArguments (  ) 

References _mysqlArguments.

const std::vector< std::string > & CLP::getNetworkArguments (  ) 

References _networkArguments.

std::string CLP::getSwitchArgument ( std::string  name,
unsigned  index 
)

getSwitchArgument: Some of the command line switches require arguments. This method returns the index'th argument specified by the user for a switch.

References _getShortSwitchNameMapping(), and _switches.

bool CLP::hasMysqlArguments (  )  [inline]

References _mysqlArguments.

bool CLP::hasSwitchSet ( std::string  name  ) 

References _getShortSwitchNameMapping(), and _switches.

Referenced by main().

bool CLP::parse ( unsigned int  argc,
const char *  argv[] 
)

parse: Parses the command line arguments. Returns false if there was an error encountered.

References _arguments, _getShortSwitchNameMapping(), _MYSQL_TYPE, _NETWORK_TYPE, _NETWORK_TYPE_SECURE, _networkArguments, _processMysqlArguments(), _setSwitchArguments(), _switches, and printHelp().

Referenced by main().

void CLP::printArguments ( void   )  const

References _arguments.

void CLP::printCopyrightNotice (  )  const

References _copyright, _name, _url, and _version.

Referenced by main(), and printHelp().

void CLP::printHelp (  )  const

References _switches, _usage, and printCopyrightNotice().

Referenced by main(), and parse().


Member Data Documentation

std::vector<std::string> CLP::_arguments [private]

Referenced by getArguments(), parse(), and printArguments().

std::string CLP::_copyright [private]

Referenced by CLP(), and printCopyrightNotice().

const std::string CLP::_MYSQL_TYPE = "mysql://" [static, private]

Referenced by parse().

std::vector<std::string> CLP::_mysqlArguments [private]
std::string CLP::_name [private]

Referenced by CLP(), and printCopyrightNotice().

const std::string CLP::_NETWORK_TYPE = "http://" [static, private]

Referenced by parse().

const std::string CLP::_NETWORK_TYPE_SECURE = "https://" [static, private]

Referenced by parse().

std::vector<std::string> CLP::_networkArguments [private]

Referenced by getNetworkArguments(), and parse().

std::map<std::string,std::string> CLP::_shortSwitchMapping [private]
std::map<std::string, CLS> CLP::_switches [private]
std::string CLP::_url [private]

Referenced by CLP(), and printCopyrightNotice().

std::string CLP::_usage [private]

Referenced by CLP(), and printHelp().

std::string CLP::_version [private]

Referenced by CLP(), and printCopyrightNotice().


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

Generated on 1 Apr 2010 for FONTAINE by  doxygen 1.6.1