All Classes |Grouped Classes |Index

Class CL_CommandLine

Helper class to parse command line arguments. More...

Derived from:

None

Derived by:

None

Group:

System (Core)

#include <ClanLib/core.h>

Class Members:

Construction:

CL_CommandLine


Attributes:

@26

get_key

Return the key of the current option.

get_argument

Return the argument to the current option.


Operations:

set_help_indent

Change the indention used for the help message, default is 18.

add_usage

Add a usage line to the help output, usage is for example.

add_doc

Adds extra documentation to the help output, should only be.

add_group

Starts a new group of options, the grouptopic gets printed.

add_option

Adds a option to the parser.

parse_args

Parse the options arcording to the options added with.

print_help

Print the help output, normaly done via a help option.

next

Goto the next option.

Detailed description:

The CL_CommandLine class helps to parse command line arguments, namely the argc/argv pair that you get from main(). CL_CommandLine mimics getopt_long() behaviour as closely as possible, while providing a cleaner interface and a few additional features, like automatic generation of 'help' t.tput. CL_CommandLine can parse long arguments in the following styles:

program file FILENAMEprogram file=FILENAME

Short arguments are handled like this:

program -f FILENAME

Concatenating short arguments is also supported, so that:

program -f -a -b FILENAME

is equivalent to:

program -fab FILENAME

Non-option arguments (aka rest arguments) are supported as well:

program SOMEFILE SOMEOTHERFILE ...

To avoid ambiguity when a filename starts with 's; pos; CL_CommandLine stops parsing arguments after the first encounter of a '', so in

program -f -b -f -b

In the above example the first '-f -b&apotions are td as d as n while thee the afterafter the &ahe '' are treated as rest arguments (aka filenam most most programs).