Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
CliParser Class Reference

Quassel's own parser for command line arguments. More...

#include </tmp/quassel/src/common/cliparser.h>

Inheritance diagram for CliParser:
Collaboration diagram for CliParser:

Public Member Functions

 CliParser ()
bool init (const QStringList &arguments=QStringList())
QString value (const QString &longName)
bool isSet (const QString &longName)
void usage ()
void addSwitch (const QString &longName, const char shortName=0, const QString &help=QString())
void addOption (const QString &longName, const char shortName=0, const QString &help=QString(), const QString &valueName=QString(), const QString &def=QString())

Private Member Functions

void addArgument (const QString &longName, const CliParserArg &arg)
bool addLongArg (const CliParserArg::CliArgType type, const QString &name, const QString &value=QString())
bool addShortArg (const CliParserArg::CliArgType type, const char shortName, const QString &value=QString())
QString escapedValue (const QString &value)
QString lnameOfShortArg (const char arg)

Private Attributes

QStringList argsRaw
QMap< QString, CliParserArgargsMap

Detailed Description

Quassel's own parser for command line arguments.

Definition at line 29 of file cliparser.h.

Constructor & Destructor Documentation

CliParser ( )

Definition at line 30 of file cliparser.cpp.

Member Function Documentation

bool init ( const QStringList &  arguments = QStringList())
virtual
QString value ( const QString &  longName)
virtual

Implements AbstractCliParser.

Definition at line 205 of file cliparser.cpp.

References argsMap, and AbstractCliParser::CliParserArg::CliArgOption.

Referenced by escapedValue(), and init().

bool isSet ( const QString &  longName)
virtual

Implements AbstractCliParser.

Definition at line 220 of file cliparser.cpp.

References argsMap, and AbstractCliParser::CliParserArg::CliArgOption.

void usage ( )
virtual

Implements AbstractCliParser.

Definition at line 162 of file cliparser.cpp.

References argsMap, argsRaw, and AbstractCliParser::CliParserArg::CliArgOption.

void addArgument ( const QString &  longName,
const CliParserArg arg 
)
private
bool addLongArg ( const CliParserArg::CliArgType  type,
const QString &  name,
const QString &  value = QString() 
)
private
bool addShortArg ( const CliParserArg::CliArgType  type,
const char  shortName,
const QString &  value = QString() 
)
private
QString escapedValue ( const QString &  value)
private

Definition at line 86 of file cliparser.cpp.

References value().

Referenced by addLongArg(), and addShortArg().

QString lnameOfShortArg ( const char  arg)
private

Definition at line 233 of file cliparser.cpp.

References argsMap.

Referenced by addArgument(), and addShortArg().

void addSwitch ( const QString &  longName,
const char  shortName = 0,
const QString &  help = QString() 
)
inlineinherited
void addOption ( const QString &  longName,
const char  shortName = 0,
const QString &  help = QString(),
const QString &  valueName = QString(),
const QString &  def = QString() 
)
inlineinherited

Member Data Documentation

QStringList argsRaw
private

Definition at line 47 of file cliparser.h.

Referenced by init(), and usage().

QMap<QString, CliParserArg> argsMap
private

Definition at line 48 of file cliparser.h.

Referenced by addArgument(), addLongArg(), addShortArg(), isSet(), lnameOfShortArg(), usage(), and value().


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