PhoenixPresentation  2.0.0
Set of cmake function to automate presentation generation
OptionMode_impl.h
Go to the documentation of this file.
1 /***************************************
2  Auteur : Pierre Aubert
3  Mail : pierre.aubert@lapp.in2p3.fr
4  Licence : CeCILL-C
5 ****************************************/
6 
7 #ifndef __POPTIONMODE_IMPL_H__
8 #define __POPTIONMODE_IMPL_H__
9 
10 #include "OptionMode.h"
11 
13 
17 template<typename T>
18 bool OptionMode::getValue(T & value, const PString & optionName) const{
19  Option option;
20  if(!getOption(option, optionName)){return false;}
21  if(!option.isParsed() && option.isRequired()){
22  return false;
23  }
24  OptionValue & optionValue = option.getValue();
25  optionValue.getValue(value, option.isParsed());
26  return true;
27 }
28 
29 
30 #endif
31 
bool getOption(Option &option, const PString &optionName) const
Get the option with its name.
Definition: OptionMode.cpp:273
bool getValue(T &value, const PString &optionName) const
Get the value of the option.
Describe the value of an option passed to a program.
Definition: OptionValue.h:16
const PVecString & getValue() const
Get the vector of values.
Describes an option passed to a program.
Definition: Option.h:14
const OptionValue & getValue() const
Get the value of the Option.
Definition: Option.cpp:209
bool isParsed() const
Say if the Option has been parsed or not.
Definition: Option.cpp:249
bool isRequired() const
Get if the option is required.
Definition: Option.cpp:219
Extends the std::string.
Definition: PString.h:16