CommandLineOption Class Reference

#include <CommandLineOption.hpp>

List of all members.

Public Types

enum  ArgumentsType { integer, real, string, end }

Public Member Functions

const std::string & shortName () const
const std::string & longName () const
const std::string & description () const
const std::string arguments () const
const int & identifier () const
 CommandLineOption (const int &id, const std::string &longName, const std::string &shortName, const std::string &description, ArgumentsType arguments[]=0)
 ~CommandLineOption ()

Private Attributes

const int __identifier
const std::string __longName
const std::string __shortName
const std::string __description
std::vector< ArgumentsType__arguments


Detailed Description

Definition at line 38 of file CommandLineOption.hpp.


Member Enumeration Documentation

Enumerator:
integer 
real 
string 
end 

Definition at line 41 of file CommandLineOption.hpp.

00042   {
00043     integer,
00044     real,
00045     string,
00046     end
00047   };


Constructor & Destructor Documentation

CommandLineOption::CommandLineOption ( const int &  id,
const std::string &  longName,
const std::string &  shortName,
const std::string &  description,
ArgumentsType  arguments[] = 0 
) [inline]

Constructor

Definition at line 132 of file CommandLineOption.hpp.

References __arguments, arguments(), and end.

00137     : __identifier(id),
00138       __longName(longName),
00139       __shortName(shortName),
00140       __description(description)
00141   {
00142     if (arguments != 0) {
00143       for (int i=0; arguments[i]!=CommandLineOption::end; ++i) {
00144         __arguments.push_back(arguments[i]);
00145       }
00146     }
00147   }

Here is the call graph for this function:

CommandLineOption::~CommandLineOption (  )  [inline]

Destructor

Definition at line 152 of file CommandLineOption.hpp.

00153   {
00154     ;
00155   }


Member Function Documentation

const std::string& CommandLineOption::shortName (  )  const [inline]

Returns the short name of an option

Returns:
__shortName

Definition at line 64 of file CommandLineOption.hpp.

References __shortName.

Referenced by CommandLineParser::CommandLineParser().

00065   {
00066     return __shortName;
00067   }

const std::string& CommandLineOption::longName (  )  const [inline]

Returns the long name of an option

Returns:
__longName

Definition at line 74 of file CommandLineOption.hpp.

References __longName.

Referenced by CommandLineParser::CommandLineParser().

00075   {
00076     return __longName;
00077   }

const std::string& CommandLineOption::description (  )  const [inline]

Returns the description of an option

Returns:
__description

Definition at line 84 of file CommandLineOption.hpp.

References __description.

00085   {
00086     return __description;
00087   }

const std::string CommandLineOption::arguments (  )  const [inline]

Definition at line 89 of file CommandLineOption.hpp.

References __arguments, end, integer, real, string, and ErrorHandler::unexpected.

Referenced by CommandLineOption().

00090   {
00091     std::string argument;
00092     for (size_t i=0; i<__arguments.size(); ++i) {
00093       if (i!=0) argument += ',';
00094       switch (__arguments[i]) {
00095       case CommandLineOption::integer: {
00096         argument += "int";
00097         break;
00098       }
00099       case CommandLineOption::real: {
00100         argument += "real";
00101         break;
00102       }
00103       case CommandLineOption::string: {
00104         argument += "str";
00105         break;
00106       }
00107       case CommandLineOption::end:
00108       default: {
00109         throw ErrorHandler(__FILE__,__LINE__,
00110                            "unexpected command line option",
00111                            ErrorHandler::unexpected);
00112       }
00113       }
00114     }
00115     return argument;
00116   }

const int& CommandLineOption::identifier (  )  const [inline]

Returns option idetifier

Returns:
__identifier

Definition at line 123 of file CommandLineOption.hpp.

References __identifier.

Referenced by CommandLineParser::__treatOption().

00124   {
00125     return __identifier;
00126   }


Member Data Documentation

const int CommandLineOption::__identifier [private]

Option id

Definition at line 50 of file CommandLineOption.hpp.

Referenced by identifier().

const std::string CommandLineOption::__longName [private]

long name (--help for instance)

Definition at line 52 of file CommandLineOption.hpp.

Referenced by longName().

const std::string CommandLineOption::__shortName [private]

short name (-h for instance)

Definition at line 53 of file CommandLineOption.hpp.

Referenced by shortName().

const std::string CommandLineOption::__description [private]

Description of the option

Definition at line 54 of file CommandLineOption.hpp.

Referenced by description().

Arguments type

Definition at line 55 of file CommandLineOption.hpp.

Referenced by arguments(), and CommandLineOption().


The documentation for this class was generated from the following file:

Generated on Wed Nov 19 00:05:00 2008 for FreeFEM3D (aka ff3d) by  doxygen 1.5.6