メインページ   モジュール   クラス階層   アルファベット順一覧   構成   ファイル一覧   構成メンバ   ファイルメンバ   関連ページ    

TOption.hh

解説を見る。
00001 // ============================================================================
00018 // ============================================================================
00019 #ifndef __TOPTION_HH
00020 #define __TOPTION_HH
00021 
00022 #include "Tglobals.h"
00023 
00024 
00044 class TOption
00045 {
00046 
00047   public:
00048     enum { tNeedNot = 0, tNeed = 1, tEither = 2 };
00049 
00050   private:
00051     Tstring theLongOption;
00052     Tstring theShortOption;
00053     Tint theArgumentStyle;
00054     Tstring theDescription;
00055 
00056   public:
00057     TOption( const Tstring& longoption, const Tstring& shortoption = "", Tint argstyle = tNeedNot, const Tstring& desc = "" );
00058     TOption( const Tstring& longoption, Tint argstyle, const Tstring& shortoption = "", const Tstring& desc = "" );
00059     TOption( const TOption& right );
00060     ~TOption();
00061 
00062   public:
00063     const TOption& operator=( const TOption& right );
00064     Tbool operator==( const TOption& right ) const;
00065     Tbool operator!=( const TOption& right ) const;
00066     Tbool operator==( const Tstring& right ) const;
00067     Tbool operator!=( const Tstring& right ) const;
00068 
00069   public:
00070     friend Tostream& operator<<( Tostream& tos, const TOption& right );
00071 
00072   public:
00073     Tbool NeedParameter() const;
00074     Tbool NeedNotParameter() const;
00075     Tbool EitherNeedOrNot() const;
00076 
00077   public:
00078     const Tstring& GetLongOption() const;
00079     const Tstring& GetShortOption() const;
00080     Tint GetArgumentStyle() const;
00081     const Tstring& GetDescription() const;
00082     Tvoid SetLongOption( const Tstring& longoption );
00083     Tvoid SetShortOption( const Tstring& shortoption );
00084     Tvoid SetArgumentStyle( Tint argstyle );
00085     Tvoid SetDescription( const Tstring& desc );
00086 
00087   private:
00088     Tvoid initialize();
00089 
00090 };
00091 
00092 inline const Tstring& TOption::GetLongOption() const
00093 {
00094   return theLongOption;
00095 }
00096 
00097 inline const Tstring& TOption::GetShortOption() const
00098 {
00099   return theShortOption;
00100 }
00101 
00102 inline Tint TOption::GetArgumentStyle() const
00103 {
00104   return theArgumentStyle;
00105 }
00106 
00107 inline const Tstring& TOption::GetDescription() const
00108 {
00109   return theDescription;
00110 }
00111 
00112 inline Tvoid TOption::SetLongOption( const Tstring& longoption )
00113 {
00114   theLongOption = longoption;
00115   initialize();
00116   return;
00117 }
00118 
00119 inline Tvoid TOption::SetShortOption( const Tstring& shortoption )
00120 {
00121   theShortOption = shortoption;
00122   initialize();
00123   return;
00124 }
00125 
00126 inline Tvoid TOption::SetArgumentStyle( Tint argstyle )
00127 {
00128   theArgumentStyle = argstyle;
00129   initialize();
00130   return;
00131 }
00132 
00133 inline Tvoid TOption::SetDescription( const Tstring& desc )
00134 {
00135   theDescription = desc;
00136   initialize();
00137   return;
00138 }
00139 
00140 #endif

CLDAQ - a Class Library for Data AcQuisition (Version 1.10.0)
Go IWAI <goiwai@users.sourceforge.jp>