00001
00025
00026 #ifndef CLDAQ__TOPTION_HH
00027 #define CLDAQ__TOPTION_HH
00028
00029 #include "Tglobals.h"
00030
00031
00051 class TOption
00052 {
00053
00054 public:
00055 enum { tNeedNot = 0, tNeed = 1, tEither = 2 };
00056
00057 private:
00058 Tstring theLongOption;
00059 Tstring theShortOption;
00060 Tint theArgumentStyle;
00061 Tstring theDescription;
00062
00063 public:
00064 TOption( const Tstring& longoption, const Tstring& shortoption = "", Tint argstyle = tNeedNot, const Tstring& desc = "" );
00065 TOption( const Tstring& longoption, Tint argstyle, const Tstring& shortoption = "", const Tstring& desc = "" );
00066 TOption( const TOption& right );
00067 ~TOption();
00068
00069 public:
00070 const TOption& operator=( const TOption& right );
00071 Tbool operator==( const TOption& right ) const;
00072 Tbool operator!=( const TOption& right ) const;
00073 Tbool operator==( const Tstring& right ) const;
00074 Tbool operator!=( const Tstring& right ) const;
00075
00076 public:
00077 friend Tostream& operator<<( Tostream& tos, const TOption& right );
00078
00079 public:
00080 Tbool NeedParameter() const;
00081 Tbool NeedNotParameter() const;
00082 Tbool EitherNeedOrNot() const;
00083
00084 public:
00085 const Tstring& GetLongOption() const;
00086 const Tstring& GetShortOption() const;
00087 Tint GetArgumentStyle() const;
00088 const Tstring& GetDescription() const;
00089 Tvoid SetLongOption( const Tstring& longoption );
00090 Tvoid SetShortOption( const Tstring& shortoption );
00091 Tvoid SetArgumentStyle( Tint argstyle );
00092 Tvoid SetDescription( const Tstring& desc );
00093
00094 private:
00095 Tvoid initialize();
00096
00097 #ifdef __CLDAQ_ROOT_DLL
00098 ClassDef(TOption,0)
00099 #endif
00100
00101 };
00102
00103 inline const Tstring& TOption::GetLongOption() const
00104 {
00105 return theLongOption;
00106 }
00107
00108 inline const Tstring& TOption::GetShortOption() const
00109 {
00110 return theShortOption;
00111 }
00112
00113 inline Tint TOption::GetArgumentStyle() const
00114 {
00115 return theArgumentStyle;
00116 }
00117
00118 inline const Tstring& TOption::GetDescription() const
00119 {
00120 return theDescription;
00121 }
00122
00123 inline Tvoid TOption::SetLongOption( const Tstring& longoption )
00124 {
00125 theLongOption = longoption;
00126 initialize();
00127 return;
00128 }
00129
00130 inline Tvoid TOption::SetShortOption( const Tstring& shortoption )
00131 {
00132 theShortOption = shortoption;
00133 initialize();
00134 return;
00135 }
00136
00137 inline Tvoid TOption::SetArgumentStyle( Tint argstyle )
00138 {
00139 theArgumentStyle = argstyle;
00140 initialize();
00141 return;
00142 }
00143
00144 inline Tvoid TOption::SetDescription( const Tstring& desc )
00145 {
00146 theDescription = desc;
00147 initialize();
00148 return;
00149 }
00150
00151 #endif