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 |
|
|
|
12 |
|
|
///Get the value of the option |
13 |
|
|
/** @param[out] value : value of the option |
14 |
|
|
* @param optionName : name of option to get the option |
15 |
|
|
* @return true on success, false otherwise |
16 |
|
|
*/ |
17 |
|
|
template<typename T> |
18 |
|
62 |
bool OptionMode::getValue(T & value, const std::string & optionName) const{ |
19 |
✓✓✓✓
|
186 |
Option option; |
20 |
✓✗✓ |
62 |
if(!getOption(option, optionName)){return false;} |
21 |
✓✓✓✓ ✗✗✓✗ ✓ |
62 |
if(!option.isParsed() && option.isRequired()){ |
22 |
|
|
return false; |
23 |
|
|
} |
24 |
✓ |
62 |
OptionValue & optionValue = option.getValue(); |
25 |
✓✓ |
62 |
optionValue.getValue(value, option.isParsed()); |
26 |
|
62 |
return true; |
27 |
|
|
} |
28 |
|
|
|
29 |
|
|
|
30 |
|
|
#endif |
31 |
|
|
|