class CmdLine

This class provides a useful interface for the user, to easily read some arguments/options from the command-line.

Inheritance:


Public Methods

[more] CmdLine()
[more]void read(int argc, char** argv)
Read the command-line.
[more]void help(char* name)
Print the help.
[more]void addBCmdOption(const char* name, bool* ptr, bool initvalue, const char* help="")
[more]void addRCmdOption(const char* name, real* ptr, real initvalue, const char* help="")
[more]void addSCmdOption(const char* name, char** ptr, const char* initvalue, const char* help="")
[more]void addBCmdArg(const char* name, bool* ptr, const char* help="")
[more]void addRCmdArg(const char* name, real* ptr, const char* help="")
[more]void addSCmdArg(const char* name, char** ptr, const char* help="")
[more]void addText(const char* text)
Add a text line in the help message
[more]void info(const char* text)
Add a text at the beginnig of the help

Public Members

[more] Functions for adding options.
[more] Functions for adding an argument.


Inherited from Object:

Public Methods

ovirtual void init()
ovoid addOption(const char* name, int size, void* ptr, const char* help="", bool is_allowed_after_init=false)
ovoid addIOption(const char* name, int* ptr, int init_value, const char* help="", bool is_allowed_after_init=false)
ovoid addROption(const char* name, real* ptr, real init_value, const char* help="", bool is_allowed_after_init=false)
ovoid addBOption(const char* name, bool* ptr, bool init_value, const char* help="", bool is_allowed_after_init=false)
ovoid setOption(const char* name, void* ptr)
ovoid setIOption(const char* name, int option)
ovoid setROption(const char* name, real option)
ovoid setBOption(const char* name, bool option)
ovirtual void loadFILE(FILE* file)
ovirtual void saveFILE(FILE* file)
ovoid load(const char* filename)
ovoid save(const char* filename)


Documentation

This class provides a useful interface for the user, to easily read some arguments/options from the command-line.

Note that here, we make a difference between:

o CmdLine()

ovoid read(int argc, char** argv)
Read the command-line. Call this function after adding options/arguments that you need, with the help of the following functions.

ovoid help(char* name)
Print the help. Call this function after adding options/arguments that you need, with the help of the following functions.

o Functions for adding options.
Functions for adding options. The calling order of the following functions will define the text order associated when you will call help().

Add an option (Int, Bool, Real, String).

The option will be setted to value in the command-line by printing "name value"

ovoid addBCmdOption(const char* name, bool* ptr, bool initvalue, const char* help="")

ovoid addRCmdOption(const char* name, real* ptr, real initvalue, const char* help="")

ovoid addSCmdOption(const char* name, char** ptr, const char* initvalue, const char* help="")

o Functions for adding an argument.
Functions for adding an argument. The argument will be setted to value in the command-line by writting "value" after all the options. If there are N arguments, you have to write "value1 value2 value3 ... valueN" to set them in the command-line.

ovoid addBCmdArg(const char* name, bool* ptr, const char* help="")

ovoid addRCmdArg(const char* name, real* ptr, const char* help="")

ovoid addSCmdArg(const char* name, char** ptr, const char* help="")

ovoid addText(const char* text)
Add a text line in the help message

ovoid info(const char* text)
Add a text at the beginnig of the help


This class has no child classes.
Author:
Ronan Collobert (collober@iro.umontreal.ca)

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.