class CmdOption

This class defines an option for the command line.

Inheritance:


Public Fields

[more]char* name
Name of the option
[more]char* type_name
Type name of the option
[more]char* help
An help string.
[more]bool save
True is the option has to be saved when saving the command line
[more]bool is_setted
True is the option has been setted after reading the command-line

Public Methods

[more] CmdOption(const char* name_, const char* type_name_, const char* help_="", bool save_=false)
[more]virtual void initValue()
Initialize the value of the option
[more]virtual void printValue(XFile* file_)
If is_setted is true, print the current value, else the init value
[more]virtual void read(int* argc_, char*** argv_)
Read the option on the command line.
[more]bool isOption(bool set_=false)
Returns true if it's an optional argument.
[more]bool isArgument(bool set_=false)
Returns true if it's a required argument.
[more]bool isText(bool set_=false)
Returns true if it's just text to be displayed in the command line.
[more]bool isMasterSwitch(bool set_=false)
Returns true if it's a master switch.


Inherited from Object:

Public Fields

oAllocator* allocator

Public Methods

ovoid addOption(const char* name, int size, void* ptr, const char* help="")
ovoid addIOption(const char* name, int* ptr, int init_value, const char* help="")
ovoid addROption(const char* name, real* ptr, real init_value, const char* help="")
ovoid addBOption(const char* name, bool* ptr, bool init_value, const char* help="")
ovoid addOOption(const char* name, Object** ptr, Object* init_value, const char* help="")
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)
ovoid setOOption(const char* name, Object* option)
ovirtual void loadXFile(XFile* file)
ovirtual void saveXFile(XFile* file)
ovoid load(const char* filename)
ovoid* operator new(size_t size, Allocator* allocator_=NULL)
ovoid* operator new(size_t size, Allocator* allocator_, void* ptr_)
ovoid operator delete(void* ptr)


Documentation

This class defines an option for the command line. If you need special command line arguments/options, you have to create a new children of this class.

ochar* name
Name of the option

ochar* type_name
Type name of the option

ochar* help
An help string. Cannot be NULL.

obool save
True is the option has to be saved when saving the command line

obool is_setted
True is the option has been setted after reading the command-line

o CmdOption(const char* name_, const char* type_name_, const char* help_="", bool save_=false)

ovirtual void initValue()
Initialize the value of the option

ovirtual void printValue(XFile* file_)
If is_setted is true, print the current value, else the init value

ovirtual void read(int* argc_, char*** argv_)
Read the option on the command line. argv_ and argc_ have to point of the next option after that.

obool isOption(bool set_=false)
Returns true if it's an optional argument. If set_ is true, set it to an optional argument.

obool isArgument(bool set_=false)
Returns true if it's a required argument. If set_ is true, set it to a required argument.

obool isText(bool set_=false)
Returns true if it's just text to be displayed in the command line. If set_ is true, set it to text mode.

obool isMasterSwitch(bool set_=false)
Returns true if it's a master switch. If set_ is true, set it to a master switch.


Direct child classes:
StringCmdOption
RealCmdOption
IntCmdOption
FileListCmdOption
BoolCmdOption
Author:
Ronan Collobert (collober@idiap.ch)
See Also:
CmdLine

Alphabetic index HTML hierarchy of classes or Java



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