general/arguments.cc File Reference

#include <iostream>
#include <map>
#include <vector>
#include "log.h"
#include "arguments.h"

Classes

class  argument

Defines

#define DEBUG_ROUTINE   "arguments"

Functions

void arg_add (std::string arg, std::string param, std::string group, std::string text, sigc::signal< void, std::string > handler)
 Add a new argument definition to parse.
void arg_extra (std::string arg, std::string param)
 Alternative name of the last argument.
string dup_str (string todub, int dubs)
 Create a string that dupicates the base string a number of times.
void show_help ()
 Calculate the amount of room needed between arguments and descriptions and show the help.
void arg_parse (int args, char *argv[])
 Routine that scans the arguments and invokes the various functions on them.

Variables

map< string, argumentarguments
 Map from the arguments to its parameters.
vector< string > help
 --help text lines
vector< string > version
 --version text lines
static string args = ""
 List of parameters that are synonimes of each other.
static string lastarg = ""
 The previous argument found.
static string lasttext = ""
 The previous description.
static argument last
 The previous argument parameters.
static string program
 The name of the current program for --help and --version texts.

Define Documentation

#define DEBUG_ROUTINE   "arguments"


Function Documentation

void arg_add ( std::string  arg,
std::string  param,
std::string  group,
std::string  text,
sigc::signal< void, std::string >  handler 
)

Add a new argument definition to parse.

Fill the argument data structure

Parameters:
arg  Name of the argument
param  Parameter of argument name, optional when between [], empty is no arg
group  Group of the argument in the help page
text  Text description
handler  Function to call when this argument is found or NULL

void arg_extra ( std::string  arg,
std::string  param 
)

Alternative name of the last argument.

Parameters:
arg  Alternative name of the argument
param  Argument description, optional show between [], empty is no argument

void arg_parse ( int  args,
char *  argv[] 
)

Routine that scans the arguments and invokes the various functions on them.

This routine also handles --help and --version calls and exists then directly

Parameters:
args  Number of command line arguments
argv  Array of the cmmand line argument strings

string dup_str ( string  todub,
int  dubs 
)

Create a string that dupicates the base string a number of times.

Parameters:
todub  The string to duplicate
dubs  Number of duplicates needed

void show_help (  ) 

Calculate the amount of room needed between arguments and descriptions and show the help.


Variable Documentation

string args = "" [static]

List of parameters that are synonimes of each other.

map<string, argument> arguments

Map from the arguments to its parameters.

vector<string> help

--help text lines

argument last [static]

The previous argument parameters.

string lastarg = "" [static]

The previous argument found.

string lasttext = "" [static]

The previous description.

string program [static]

The name of the current program for --help and --version texts.

vector<string> version

--version text lines



Generated on Tue Jan 1 17:30:01 2008 for general/arguments.cc File Reference by  doxygen   Visit the project page on SourceForge.net Logo