#include #include #include #include #include #include #include #include #include ClassImp(TAppOption); // Options class ------------------------------ TAppOption::TAppOption(const Char_t shortName, const Char_t* longName, const Char_t* helpString) : fShortName(shortName), fLongName(longName), fHelpString(helpString) {} Int_t TAppOption::Compare(TObject* o) { return fLongName.CompareTo(o->GetName()); } ULong_t TAppOption::Hash(void) { return fLongName.Hash(); } ClassImp(TAppIntOption); // Options class --------------------------- Bool_t TAppIntOption::SetValue(const Char_t* strValue) { if (!strValue) throw "Option need an argument"; fValue = strtol(strValue,NULL,0); return kTRUE; } const Char_t* TAppIntOption::GetValue(void) const { return Form("%d", fValue); } ClassImp(TAppFloatOption); // Options class ------------------------- Bool_t TAppFloatOption::SetValue(const Char_t* strValue) { if (!strValue) throw "Option need an argument"; fValue = strtod(strValue,NULL); return kTRUE; } const Char_t* TAppFloatOption::GetValue(void) const { return Form("%f", fValue); } ClassImp(TAppBoolOption); // Options class -------------------------- Bool_t TAppBoolOption::SetValue(const Char_t* strValue) { fValue = !fValue; return kFALSE; } const Char_t* TAppBoolOption::GetValue(void) const { return (fValue ? "true" : "false"); } ClassImp(TAppStringOption); // Options class ------------------------ Bool_t TAppStringOption::SetValue(const Char_t* strValue) { if (!strValue) throw "Option -%c/--%s need an argument"; fValue = strValue; return kTRUE; } const Char_t* TAppStringOption::GetValue(void) const { return fValue.Data(); }