Sophie

Sophie

distrib > Mandriva > 2007.0 > i586 > by-pkgid > ad1ba1135a9c9eeffc2e538163e00373 > files > 630

libCommonC++2_1.4-devel-1.4.1-1mdv2007.0.i586.rpm

\section{ost::Command\-Option Class Reference}
\label{classost_1_1_command_option}\index{ost::CommandOption@{ost::CommandOption}}
{\bf Command\-Option}{\rm (p.\,\pageref{classost_1_1_command_option})} is the base class for all command line options.  


{\tt \#include $<$cmdoptns.h$>$}

Inheritance diagram for ost::Command\-Option::\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3cm]{classost_1_1_command_option}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum {\bf Option\-Type} \{ {\bf has\-Arg}, 
{\bf no\-Arg}, 
{\bf trailing}, 
{\bf collect}
 \}
\begin{CompactList}\small\item\em Option\-Type is for denoting what type of option this is, with an arg, without an arg or the trailing args.Option type. \item\end{CompactList}\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
virtual {\bf $\sim$Command\-Option} ()
\begin{CompactList}\small\item\em A virtual destructor just in case. \item\end{CompactList}\item 
{\bf Command\-Option} (const char $\ast$in\-Option\-Name, const char $\ast$in\-Option\-Letter, const char $\ast$in\-Description, {\bf Option\-Type} in\-Option\-Type, bool in\-Required=false, {\bf Command\-Option} $\ast$$\ast$pp\-Next=\&{\bf default\-Command\-Option\-List})
\begin{CompactList}\small\item\em {\bf Command\-Option}{\rm (p.\,\pageref{classost_1_1_command_option})} contructor. \item\end{CompactList}\item 
virtual void {\bf found\-Option} ({\bf Command\-Option\-Parse} $\ast$cop, const char $\ast$value=0)
\begin{CompactList}\small\item\em found\-Option is called by the {\bf Command\-Option\-Parse}{\rm (p.\,\pageref{classost_1_1_command_option_parse})} object during the parsing of the command line options. \item\end{CompactList}\item 
virtual void {\bf found\-Option} ({\bf Command\-Option\-Parse} $\ast$cop, const char $\ast$$\ast$value, int num)
\begin{CompactList}\small\item\em found\-Option is called by the {\bf Command\-Option\-Parse}{\rm (p.\,\pageref{classost_1_1_command_option_parse})} object during the parsing of the command line options. \item\end{CompactList}\item 
virtual void {\bf parse\-Done} ({\bf Command\-Option\-Parse} $\ast$cop)
\begin{CompactList}\small\item\em Once parsing of command line options is complete, this method is called. \item\end{CompactList}\item 
virtual void {\bf perform\-Task} ({\bf Command\-Option\-Parse} $\ast$cop)
\begin{CompactList}\small\item\em Once {\bf Command\-Option}{\rm (p.\,\pageref{classost_1_1_command_option})} objects have completed parsing and there are no errors they may have some specific tasks to perform. \item\end{CompactList}\item 
virtual bool {\bf has\-Value} ()
\begin{CompactList}\small\item\em For fields with the required flag set, this method is used to determine if the Option has satisfied it's required status. \item\end{CompactList}\end{CompactItemize}
\subsection*{Public Attributes}
\begin{CompactItemize}
\item 
const char $\ast$ {\bf option\-Name}
\begin{CompactList}\small\item\em Long option name, these will be preceded with \char`\"{}--\char`\"{} on the command line. \item\end{CompactList}\item 
const char $\ast$ {\bf option\-Letter}
\begin{CompactList}\small\item\em option letter, these will be preceded with \char`\"{}-\char`\"{} on the command line. \item\end{CompactList}\item 
const char $\ast$ {\bf description}
\begin{CompactList}\small\item\em A short description of the option for Usage messages. \item\end{CompactList}\item 
{\bf Option\-Type} {\bf option\-Type}
\begin{CompactList}\small\item\em This command option's Option\-Type. \item\end{CompactList}\item 
bool {\bf required}
\begin{CompactList}\small\item\em True if this parameter is required. \item\end{CompactList}\item 
{\bf Command\-Option} $\ast$ {\bf next}
\begin{CompactList}\small\item\em This next {\bf Command\-Option}{\rm (p.\,\pageref{classost_1_1_command_option})} in this list of options or nil if no more options exist. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
{\bf Command\-Option}{\rm (p.\,\pageref{classost_1_1_command_option})} is the base class for all command line options. 

Command line options can be defined statically and used when constructing a command line parser onject using make\-Command\-Option\-Parse. This serves only as a base class to {\bf Command\-Option\-With\-Arg}{\rm (p.\,\pageref{classost_1_1_command_option_with_arg})}, {\bf Command\-Option\-Rest}{\rm (p.\,\pageref{classost_1_1_command_option_rest})} or {\bf Command\-Option\-No\-Arg}{\rm (p.\,\pageref{classost_1_1_command_option_no_arg})} which can also be used to derive more complex classes or even entire applications.

\begin{Desc}
\item[Author:]Gianni Mariani $<${\tt gianni@mariani.ws}$>$ \end{Desc}
\begin{Desc}
\item[Examples: ]\par


{\bf cmdlineopt.cpp}.\end{Desc}




\subsection{Member Enumeration Documentation}
\index{ost::CommandOption@{ost::Command\-Option}!OptionType@{OptionType}}
\index{OptionType@{OptionType}!ost::CommandOption@{ost::Command\-Option}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf ost::Command\-Option::Option\-Type}}\label{classost_1_1_command_option_b56f222627bb3843d2b055d42ceaa493}


Option\-Type is for denoting what type of option this is, with an arg, without an arg or the trailing args.Option type. 

\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{hasArg@{hasArg}!ost::CommandOption@{ost::CommandOption}}\index{ost::CommandOption@{ost::CommandOption}!hasArg@{hasArg}}\item[{\em 
has\-Arg\label{classost_1_1_command_option_b56f222627bb3843d2b055d42ceaa49351afdccef3c1eefa378b4ea79872fb9f}
}]This option is associated with a value. \index{noArg@{noArg}!ost::CommandOption@{ost::CommandOption}}\index{ost::CommandOption@{ost::CommandOption}!noArg@{noArg}}\item[{\em 
no\-Arg\label{classost_1_1_command_option_b56f222627bb3843d2b055d42ceaa493206297cbdc29de03edfa0e24d589b227}
}]This option is a flag only. \index{trailing@{trailing}!ost::CommandOption@{ost::CommandOption}}\index{ost::CommandOption@{ost::CommandOption}!trailing@{trailing}}\item[{\em 
trailing\label{classost_1_1_command_option_b56f222627bb3843d2b055d42ceaa4934fbaf902c23f48a6d217585297f3afb5}
}]Remaining of the command line arguments. \index{collect@{collect}!ost::CommandOption@{ost::CommandOption}}\index{ost::CommandOption@{ost::CommandOption}!collect@{collect}}\item[{\em 
collect\label{classost_1_1_command_option_b56f222627bb3843d2b055d42ceaa4939ebaee9fbe6ef1338347908f6e410095}
}]Collect values that are not a value to an option. \end{description}
\end{Desc}



\subsection{Constructor \& Destructor Documentation}
\index{ost::CommandOption@{ost::Command\-Option}!~CommandOption@{$\sim$CommandOption}}
\index{~CommandOption@{$\sim$CommandOption}!ost::CommandOption@{ost::Command\-Option}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual ost::Command\-Option::$\sim$Command\-Option ()\hspace{0.3cm}{\tt  [virtual]}}\label{classost_1_1_command_option_7e42ca61d049698df46daae73bb205bb}


A virtual destructor just in case. 

\index{ost::CommandOption@{ost::Command\-Option}!CommandOption@{CommandOption}}
\index{CommandOption@{CommandOption}!ost::CommandOption@{ost::Command\-Option}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Command\-Option::Command\-Option (const char $\ast$ {\em in\-Option\-Name}, const char $\ast$ {\em in\-Option\-Letter}, const char $\ast$ {\em in\-Description}, {\bf Option\-Type} {\em in\-Option\-Type}, bool {\em in\-Required} = {\tt false}, {\bf Command\-Option} $\ast$$\ast$ {\em pp\-Next} = {\tt \&{\bf default\-Command\-Option\-List}})}\label{classost_1_1_command_option_989bf900aed6323812ae6922edcdc4af}


{\bf Command\-Option}{\rm (p.\,\pageref{classost_1_1_command_option})} contructor. 

Note the default values for required and pp\-Next.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in\-Option\-Name}]long option name \item[{\em in\-Option\-Letter}]short letter name \item[{\em in\-Description}]short description of the option \item[{\em in\-Option\-Type}]the type of this option \item[{\em in\-Required}]true if option is required \item[{\em pp\-Next}]the linked list header \end{description}
\end{Desc}


\subsection{Member Function Documentation}
\index{ost::CommandOption@{ost::Command\-Option}!foundOption@{foundOption}}
\index{foundOption@{foundOption}!ost::CommandOption@{ost::Command\-Option}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void ost::Command\-Option::found\-Option ({\bf Command\-Option\-Parse} $\ast$ {\em cop}, const char $\ast$$\ast$ {\em value}, int {\em num})\hspace{0.3cm}{\tt  [virtual]}}\label{classost_1_1_command_option_c6597549063ded15f8d50d72e8cd9bf6}


found\-Option is called by the {\bf Command\-Option\-Parse}{\rm (p.\,\pageref{classost_1_1_command_option_parse})} object during the parsing of the command line options. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cop}]pointer to the command option parser \item[{\em value}]an array of values of this option \item[{\em num}]number of values in the array \end{description}
\end{Desc}


Reimplemented in {\bf ost::Command\-Option\-With\-Arg} {\rm (p.\,\pageref{classost_1_1_command_option_with_arg_7e012538193acafda06b609dc1dee369})}.\index{ost::CommandOption@{ost::Command\-Option}!foundOption@{foundOption}}
\index{foundOption@{foundOption}!ost::CommandOption@{ost::Command\-Option}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void ost::Command\-Option::found\-Option ({\bf Command\-Option\-Parse} $\ast$ {\em cop}, const char $\ast$ {\em value} = {\tt 0})\hspace{0.3cm}{\tt  [virtual]}}\label{classost_1_1_command_option_70394fb2a025443e6890e0e076a94477}


found\-Option is called by the {\bf Command\-Option\-Parse}{\rm (p.\,\pageref{classost_1_1_command_option_parse})} object during the parsing of the command line options. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cop}]pointer to the command option parser \item[{\em value}]the value of this option \end{description}
\end{Desc}


Reimplemented in {\bf ost::Command\-Option\-With\-Arg} {\rm (p.\,\pageref{classost_1_1_command_option_with_arg_a7a9e87b68ef493f84688355062fc9a8})}, and {\bf ost::Command\-Option\-No\-Arg} {\rm (p.\,\pageref{classost_1_1_command_option_no_arg_5762755aabab3298e9e9d2fe45f4de61})}.\index{ost::CommandOption@{ost::Command\-Option}!hasValue@{hasValue}}
\index{hasValue@{hasValue}!ost::CommandOption@{ost::Command\-Option}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool ost::Command\-Option::has\-Value ()\hspace{0.3cm}{\tt  [virtual]}}\label{classost_1_1_command_option_cf1272321b17a2cbe953ce23ffa6a5e8}


For fields with the required flag set, this method is used to determine if the Option has satisfied it's required status. 

The default methods simply returns true if any values have been found. This could be specialized to return true based on some other criteria. 

Reimplemented in {\bf ost::Command\-Option\-With\-Arg} {\rm (p.\,\pageref{classost_1_1_command_option_with_arg_cf0c03d84b032dab059ae219922dadde})}.\index{ost::CommandOption@{ost::Command\-Option}!parseDone@{parseDone}}
\index{parseDone@{parseDone}!ost::CommandOption@{ost::Command\-Option}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void ost::Command\-Option::parse\-Done ({\bf Command\-Option\-Parse} $\ast$ {\em cop})\hspace{0.3cm}{\tt  [virtual]}}\label{classost_1_1_command_option_1cc99afcc775ca21d16c38a0661839a2}


Once parsing of command line options is complete, this method is called. 

This can be used to perform last minute checks on the options collected.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cop}]pointer to the command option parser \end{description}
\end{Desc}
\begin{Desc}
\item[Examples: ]\par
{\bf cmdlineopt.cpp}.\end{Desc}
\index{ost::CommandOption@{ost::Command\-Option}!performTask@{performTask}}
\index{performTask@{performTask}!ost::CommandOption@{ost::Command\-Option}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void ost::Command\-Option::perform\-Task ({\bf Command\-Option\-Parse} $\ast$ {\em cop})\hspace{0.3cm}{\tt  [virtual]}}\label{classost_1_1_command_option_f52fe62b7a0d3c40b726fa2447cb3b78}


Once {\bf Command\-Option}{\rm (p.\,\pageref{classost_1_1_command_option})} objects have completed parsing and there are no errors they may have some specific tasks to perform. 

Perform\-Task must return.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cop}]pointer to the command option parser \end{description}
\end{Desc}
\begin{Desc}
\item[Examples: ]\par
{\bf cmdlineopt.cpp}.\end{Desc}


\subsection{Member Data Documentation}
\index{ost::CommandOption@{ost::Command\-Option}!description@{description}}
\index{description@{description}!ost::CommandOption@{ost::Command\-Option}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ {\bf ost::Command\-Option::description}}\label{classost_1_1_command_option_e7c1ad2ef21198b1bef933847ff5d197}


A short description of the option for Usage messages. 

e.g. Usage: mycommand : blah -f, --file $<$DESCRIPTION here$>$ \index{ost::CommandOption@{ost::Command\-Option}!next@{next}}
\index{next@{next}!ost::CommandOption@{ost::Command\-Option}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Command\-Option}$\ast$ {\bf ost::Command\-Option::next}}\label{classost_1_1_command_option_0dd94d805913bf11cd188de53baaf27c}


This next {\bf Command\-Option}{\rm (p.\,\pageref{classost_1_1_command_option})} in this list of options or nil if no more options exist. 

\index{ost::CommandOption@{ost::Command\-Option}!optionLetter@{optionLetter}}
\index{optionLetter@{optionLetter}!ost::CommandOption@{ost::Command\-Option}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ {\bf ost::Command\-Option::option\-Letter}}\label{classost_1_1_command_option_c894a27c5aeeb70ff07387bb721bd7c6}


option letter, these will be preceded with \char`\"{}-\char`\"{} on the command line. 

e.g. -f foo.x \index{ost::CommandOption@{ost::Command\-Option}!optionName@{optionName}}
\index{optionName@{optionName}!ost::CommandOption@{ost::Command\-Option}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ {\bf ost::Command\-Option::option\-Name}}\label{classost_1_1_command_option_3cf7d6f9d1943e981d29c38e2e188231}


Long option name, these will be preceded with \char`\"{}--\char`\"{} on the command line. 

e.g. --file foo.x \index{ost::CommandOption@{ost::Command\-Option}!optionType@{optionType}}
\index{optionType@{optionType}!ost::CommandOption@{ost::Command\-Option}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Option\-Type} {\bf ost::Command\-Option::option\-Type}}\label{classost_1_1_command_option_2e5f9f895bda7cf7dbe48e0106866368}


This command option's Option\-Type. 

\index{ost::CommandOption@{ost::Command\-Option}!required@{required}}
\index{required@{required}!ost::CommandOption@{ost::Command\-Option}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool {\bf ost::Command\-Option::required}}\label{classost_1_1_command_option_05f8b1439cbf0cf33f47707a33baad57}


True if this parameter is required. 

If the parameter is not supplied and required is true, an error will be flagged in the option processor. 

The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
{\bf cmdoptns.h}\end{CompactItemize}