#include <OTC/options/options.hh> class OTC_Options {
public:
static os_typespec* get_os_typespec();
OTC_Options();
OTC_Options(int argc, char* argv[]);
OTC_Options(char const* theArgs);
OTC_Options(OTC_Options const& theOptions);
OTC_Options& operator=(OTC_Options const& theOptions);
void initialise(int argc, char* argv[]);
void initialise(char const* theArgs);
u_int numOptions() const;
OTC_String const& option(u_int theNum) const;
OTC_Iterator<OTC_String> options( OTC_Direction theDirection=OTCLIB_FORWARD ) const;
OTC_Iterator<OTC_String> options( u_int theStart, u_int theLength, OTC_Direction theDirection=OTCLIB_FORWARD ) const;
OTC_Iterator<OTC_String> options( OTC_Range const& theRange, OTC_Direction theDirection=OTCLIB_FORWARD ) const;
inline void shift(u_int theNum=1);
inline void restore();
};
argv
,
argc
style argument list or from a string. In the case
of a string arguments will be split with whitespace
being the delimiter. If whitespace is required within
an option then it should be delineated with double
quotes.
OTC_Options();
OTC_Options(int argc, char* argv[]);
argv
where argc
is the number of
options in argv
.
OTC_Options(char const* theArgs);
theArgs
. If spaces are
required in a particular options it should
be delineated with double quotes. These
double quotes will subsequently be
dropped. If a real double quote is
required then it should be prefixed with a
backslash.
OTC_Options(OTC_Options const& theOptions);
theOptions
.
OTC_Options& operator=(OTC_Options const& theOptions);
theOptions
.
void initialise(int argc, char* argv[]);
argv
where argc
is the number of
options in argv
.
void initialise(char const* theArgs);
theArgs
. If spaces are
required in a particular options it should
be delineated with double quotes. These
double quotes will subsequently be
dropped. If a real double quote is
required then it should be prefixed with a
backslash.
u_int numOptions() const;
OTC_String const& option(u_int theNum) const;
theNum
.
Generates an exception if theNum
is
greater than the number of options.
Note that the first option has an index
of 1
and not 0
. If 0
is supplied
then an exception will be generated.
OTC_Iterator<OTC_String> options(
OTC_Direction theDirection=OTCLIB_FORWARD
) const;
OTC_Iterator<OTC_String> options(
u_int theStart,
u_int theLength,
OTC_Direction theDirection=OTCLIB_FORWARD
) const;
theStart
and with
length theLength
.
OTC_Iterator<OTC_String> options(
OTC_Range const& theRange,
OTC_Direction theDirection=OTCLIB_FORWARD
) const;
theRange
.
inline void shift(u_int theNum=1);
theNum
options and shift all
other options down one spot. This is
analagous to the shift
operator in shell
scripts.
inline void restore();
shift()
.