␍␊ |
};␍␊ |
␍␊ |
class Parameter : public component␍␊ |
{␍␊ |
public:␍␊ |
␉string longparameter;␍␊ |
␉string shortparameter;␍␊ |
␉int numberofparameters;␍␊ |
␉bool required;␍␊ |
␉string hint;␍␊ |
␉Parameter(string longpara, string shortpara, string hint, bool required = false, int numberofparameters = 0)␍␊ |
␉{␍␊ |
␉␉this->longparameter = longpara;␍␊ |
␉␉this->shortparameter = shortpara;␍␊ |
␉␉this->hint = hint;␍␊ |
␉␉this->required = required;␍␊ |
␉␉this->numberofparameters = numberofparameters;␍␊ |
␉}␍␊ |
};␍␊ |
␍␊ |
class pparser␍␊ |
{␍␊ |
␉private:␍␊ |
␉␉variant choices;␍␊ |
␉␉//char * argv;␍␊ |
␉␉tobjlist<Parameter> * paras;␍␊ |
␉␉tobjlist<char> argv;␍␊ |
␉␉tobjlist<char> invalidparas;␍␊ |
␉␉tobjlist<char> missingparas;␍␊ |
␉␉bool checkreq;␍␊ |
␉public:␍␊ |
␉␉pparser(int argc, char * argv[], const tobjlist<Parameter> & parameters);␍␊ |
␍␊ |
␉␉void printusage(const char * header, const char * pname, const char * footer);␍␊ |
␍␊ |
␉␉// Checks to make sure all required parameters are set␍␊ |
␉␉bool check() { return this->checkreq; }␍␊ |
␍␊ |
␉␉// Returns true if parameter is set␍␊ |
␉␉bool isparameterset(const Parameter * para);␍␊ |
␍␊ |
␉␉// Gets an array of variants of all the options to the parameters␍␊ |
␉␉// A variant will make it easier to convert to an int or another type␍␊ |
␉␉variant getoptions(const Parameter * para);␍␊ |
};␍␊ |
␍␊ |
// -------------------------------------------------------------------- //␍␊ |
// --- pre-2.0 compatibility declarations ----------------------------- //␍␊ |
// -------------------------------------------------------------------- //␍␊ |