| Directory: | ./ |
|---|---|
| File: | src/OptionMode_impl.h |
| Date: | 2024-12-09 15:28:54 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 8 | 9 | 88.9% |
| Branches: | 15 | 19 | 78.9% |
| Line | Branch | Exec | Source |
|---|---|---|---|
| 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 | 46 | bool OptionMode::getValue(T & value, const std::string & optionName) const{ | |
| 19 |
4/4✓ Branch 2 taken 34 times.
✓ Branch 6 taken 34 times.
✓ Branch 10 taken 34 times.
✓ Branch 13 taken 34 times.
|
92 | Option option; |
| 20 |
2/3✓ Branch 1 taken 34 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 34 times.
|
46 | if(!getOption(option, optionName)){return false;} |
| 21 |
6/9✓ Branch 1 taken 34 times.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 26 times.
✓ Branch 6 taken 8 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 8 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 34 times.
|
46 | if(!option.isParsed() && option.isRequired()){ |
| 22 | ✗ | return false; | |
| 23 | } | ||
| 24 |
1/1✓ Branch 1 taken 34 times.
|
46 | OptionValue & optionValue = option.getValue(); |
| 25 |
2/2✓ Branch 1 taken 34 times.
✓ Branch 4 taken 34 times.
|
46 | optionValue.getValue(value, option.isParsed()); |
| 26 | 46 | return true; | |
| 27 | 46 | } | |
| 28 | |||
| 29 | |||
| 30 | #endif | ||
| 31 | |||
| 32 |