VAPoR  0.1
Classes | Public Types | Public Member Functions | Friends | List of all members
VetsUtil::OptionParser Class Reference

#include <OptionParser.h>

Inheritance diagram for VetsUtil::OptionParser:
VetsUtil::MyBase

Classes

struct  _DPOption
 
struct  _EnvOpt
 
struct  _OptDescRec
 An option description record (odr) More...
 
struct  _OptRec
 
struct  Dimension2D_
 
struct  Dimension3D_
 
struct  IntRange_
 

Public Types

typedef struct VetsUtil::OptionParser::_OptDescRec OptDescRec_T
 An option description record (odr) More...
 
typedef struct VetsUtil::OptionParser::_DPOption Option_T
 
typedef struct VetsUtil::OptionParser::_EnvOpt EnvOpt_T
 
typedef int Boolean_T
 
typedef struct VetsUtil::OptionParser::Dimension2D_ Dimension2D_T
 
typedef struct VetsUtil::OptionParser::Dimension3D_ Dimension3D_T
 
typedef struct VetsUtil::OptionParser::IntRange_ IntRange_T
 
typedef struct VetsUtil::OptionParser::_OptRec _OptRec_T
 
- Public Types inherited from VetsUtil::MyBase
typedef void(* ErrMsgCB_T) (const char *msg, int err_code)
 
typedef void(* DiagMsgCB_T) (const char *msg)
 

Public Member Functions

 OptionParser ()
 
 ~OptionParser ()
 
int AppendOptions (const OptDescRec_T *odr)
 Append a list of option descriptions. More...
 
int ParseOptions (int *argc, char **argv, Option_T *opts)
 Parse a command line argument vector. More...
 
int ParseOptions (const EnvOpt_T *envv, Option_T *opts)
 
void RemoveOptions (std::vector< string > options)
 
void PrintOptionHelp (FILE *fp, int linelimit=80, bool docopyright=true)
 
- Public Member Functions inherited from VetsUtil::MyBase
 MyBase ()
 
const string & getClassName () const
 

Friends

bool opt_cmp (OptionParser::_OptRec_T *a, OptionParser::_OptRec_T *b)
 

Additional Inherited Members

- Static Public Member Functions inherited from VetsUtil::MyBase
static void SetErrMsg (const char *format,...)
 Record a formatted error message. More...
 
static void SetErrMsg (int errcode, const char *format,...)
 Record a formatted error message and an error code. More...
 
static const char * GetErrMsg ()
 
static void SetErrCode (int err_code)
 Record an error code. More...
 
static int GetErrCode ()
 Retrieve the current error code. More...
 
static void SetErrMsgCB (ErrMsgCB_T cb)
 
static ErrMsgCB_T GetErrMsgCB ()
 
static void SetErrMsgFilePtr (FILE *fp)
 
static const FILE * SetErrMsgFilePtr ()
 
static void SetDiagMsg (const char *format,...)
 Record a formatted diagnostic message. More...
 
static const char * GetDiagMsg ()
 
static void SetDiagMsgCB (DiagMsgCB_T cb)
 
static DiagMsgCB_T GetDiagMsgCB ()
 
static void SetDiagMsgFilePtr (FILE *fp)
 
static bool EnableErrMsg (bool enable)
 
- Static Public Attributes inherited from VetsUtil::MyBase
static char * ErrMsg
 
static int ErrCode
 
static int ErrMsgSize
 
static FILE * ErrMsgFilePtr
 
static ErrMsgCB_T ErrMsgCB
 
static char * DiagMsg
 
static int DiagMsgSize
 
static FILE * DiagMsgFilePtr
 
static DiagMsgCB_T DiagMsgCB
 
static bool Enabled
 
- Protected Member Functions inherited from VetsUtil::MyBase
void SetClassName (const string &name)
 

Detailed Description

Definition at line 47 of file OptionParser.h.

Member Typedef Documentation

Definition at line 85 of file OptionParser.h.

An option description record (odr)

A structure for descriping an option

Parameters
optionThe name of the option
arg_countNumber of arguments expected by the option
valueOption's default value
helpA C string containing a help message for the option

Constructor & Destructor Documentation

VetsUtil::OptionParser::OptionParser ( )
VetsUtil::OptionParser::~OptionParser ( )

Member Function Documentation

int VetsUtil::OptionParser::AppendOptions ( const OptDescRec_T odr)

Append a list of option descriptions.

Append a list of option descriptions. The input option descriptor records are appended to the current list of option description records.

Parameters
[in]odrA null-terminated option descriptor record.
See also
ParseOptions(), RemoveOptions()
int VetsUtil::OptionParser::ParseOptions ( int *  argc,
char **  argv,
Option_T opts 
)

Parse a command line argument vector.

Destrutively parse a command line argument vector against the option descriptor records (odr) supplied by previous invocations of AppendOptions(). Command line arguments that match option names in the odr and the input option table are

Parameters
[in,out]argcA pointer to a count of the number of elements in argv
[in,out]argvA null-terminated vector of command line arguments
[in,out]optsA null-terminated option table
See also
ParseOptions(), RemoveOptions()
int VetsUtil::OptionParser::ParseOptions ( const EnvOpt_T envv,
Option_T opts 
)
void VetsUtil::OptionParser::PrintOptionHelp ( FILE *  fp,
int  linelimit = 80,
bool  docopyright = true 
)
void VetsUtil::OptionParser::RemoveOptions ( std::vector< string >  options)

Friends And Related Function Documentation

bool opt_cmp ( OptionParser::_OptRec_T a,
OptionParser::_OptRec_T b 
)
friend

The documentation for this class was generated from the following file: