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 |
|
50 |
bool OptionMode::getValue(T & value, const std::string & optionName) const{ |
19 |
✓✓✓✓
|
150 |
Option option; |
20 |
✓✗✓ |
50 |
if(!getOption(option, optionName)){return false;} |
21 |
✓✗✓✗ ✗✗✗✗ ✓ |
50 |
if(!option.isParsed() && option.isRequired()){ |
22 |
|
|
return false; |
23 |
|
|
} |
24 |
✓ |
50 |
OptionValue & optionValue = option.getValue(); |
25 |
✓✓ |
50 |
optionValue.getValue(value, option.isParsed()); |
26 |
|
50 |
return true; |
27 |
|
|
} |
28 |
|
|
|
29 |
|
|
|
30 |
|
|
#endif |
31 |
|
|
|