From f7a9549bd6ad83f2e0bceec9cddacfa5e3f84a54 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 1 May 2006 17:11:04 +0000 Subject: libbu++ is finally laid out the way it should be, trunk, branches, and tags. --- src/pproc.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/pproc.h (limited to 'src/pproc.h') diff --git a/src/pproc.h b/src/pproc.h new file mode 100644 index 0000000..bf5063c --- /dev/null +++ b/src/pproc.h @@ -0,0 +1,35 @@ +#ifndef PPROC_H_ +#define PPROC_H_ + +/** + * Contains all required info to handle a single program parameter. + *@author Mike Buland + */ +typedef struct PPROC +{ + const char *lpWord; /**< The full text-word to use as a param. */ + const char cChar; /**< The short char version of the param. */ + /** + * Pointer to the function to call when this param is triggered. + *@param argc The number of params after and including the one that + * triggered this call. + *@param argv The array of commandline tokens to use as parameters. + *@returns 0 for everything is ok. A number greater than zero signals that + * this parameter function used n parameters and they should be skipped by + * the processParams function. + */ + int (*proc)( int argc, char *argv[] ); + bool *stateVar; /**< A pointer to a bool to be setwhen this is triggered */ + bool bSetState; /**< The state to set the above bool to. */ +} PPROC; + +/** + * Process command line parameters based on a null-terminated array of PPROC + * structures. + *@param argc Should come straight from your main function's argc. + *@param argv Should come straight from your main function's argv. + *@param pproc The array of params that this function can respond to. + */ +void processParams( int argc, char *argv[], PPROC *pproc ); + +#endif /*PPROC_H_*/ -- cgit v1.2.3