args.h File Reference

Commandline arguments utility functions header. More...

#include <qmap.h>
#include <qstring.h>

Typedefs

typedef void optHandlerFn ()
typedef void optHandlerFnParam (const QString &)
typedef optHandlerFnoptHandler
typedef optHandlerFnParamoptHandlerParam

Functions

void handleHelpOptions ()
void handleStopOpt ()
void optionHandler (const QString &param, optHandler h, const QString &help="")
void optionHandlerParam (const QString &param, const QString &paramName, optHandlerParam h, const QString &help="")
QStringList handleParams (int _argc, char **_argv)
void printHeader ()
void printHeaderErr ()

Variables

QString binName

Detailed Description

Commandline arguments utility functions header.


Typedef Documentation

Option handler function pointer

typedef void optHandlerFn()

Option handler function

typedef void optHandlerFnParam(const QString &)

Option handler function (with parameter)

Option handler function pointer (with parameter)


Function Documentation

void handleHelpOptions (  ) 

Standard handler to handle --help parameter Prints all registered commandline options along with their helptext to STDOUT and exits

References util::CON, util::convertFromUnicode(), maxParamNameLen, gui::opt, optHelp, and optParamName.

Referenced by handleHelp().

QStringList handleParams ( int  _argc,
char **  _argv 
)

Function to handle commandline parameters using installed callbacks Will terminate program with error message if unknown or invalid commandline options are found

Parameters:
_argc count of parameters (standard argc)
_argv parameters (standard argv)
Returns:
List of non-option parameters;

References argc, argIndex, argv, binName, util::fatalError(), handleOption(), printHeaderErr(), setArgv0(), and stopOpt.

Referenced by main().

void handleStopOpt (  ) 

handle -- parameter (stop processing option)

References stopOpt.

Referenced by main().

void optionHandler ( const QString &  param,
optHandler  h,
const QString &  help 
)

Register function to handle option without parameter

Parameters:
param Name of option (case sensitive)
h Function to handle this option
help Brief one-line help about this option

References maxParamNameLen, optHelp, and optMap.

Referenced by main().

void optionHandlerParam ( const QString &  param,
const QString &  paramName,
optHandlerParam  h,
const QString &  help 
)

Register function to handle option with parameter Parameters can be accepted as: -opt[n], -opt [n]

Parameters:
param Name of option (case sensitive)
paramName Name of parameter (only shown in help)
h Function to handle this option
help Brief one-line help about this option

References maxParamNameLen, optHelp, optMapParam, and optParamName.

Referenced by main().

void printHeader (  ) 

Print out application header (name and version) to stdout

References APP_NAME, and PDFEDIT_VERSION.

Referenced by handleHelp().

void printHeaderErr (  ) 

Print out application header (name and version) to stderr

References APP_NAME, and PDFEDIT_VERSION.

Referenced by handleParams(), main(), and nextParam().


Variable Documentation

QString binName

Name of the program (argv[0]). This variable will be set after running handleParams

Name of the program (argv[0])

Referenced by handleHelp(), handleParams(), nextParam(), and setArgv0().