NAME

OTC_Options - Class to encapsulate a list of options.

SYNOPSIS


#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();
};

CLASS TYPE

Concrete

DESCRIPTION

This class helps to encapsulate and break options coming from a string. The set can be created from an 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.

INITIALISATION

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);
If a list of options is already held then it will first be deleted when calling either of the following functions.
void initialise(int argc, char* argv[]);
void initialise(char const* theArgs);

QUERY

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;

OPERATIONS

inline void shift(u_int theNum=1);
inline void restore();

LIBRARY

OTC

AUTHOR(S)

Graham Dumpleton

COPYRIGHT

Copyright 1992 OTC LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED