PhoenixMock  1.8.7
Tools to split/merge/print mock used in Phoenix
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 std::string & 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 
Option::isRequired
bool isRequired() const
Get if the option is required.
Definition: Option.cpp:212
OptionMode.h
Option::isParsed
bool isParsed() const
Say if the Option has been parsed or not.
Definition: Option.cpp:242
OptionMode::getValue
bool getValue(T &value, const std::string &optionName) const
Get the value of the option.
Definition: OptionMode_impl.h:18
Option::getValue
const OptionValue & getValue() const
Get the value of the Option.
Definition: Option.cpp:202
OptionMode::getOption
bool getOption(Option &option, const std::string &optionName) const
Get the option with its name.
Definition: OptionMode.cpp:257
Option
Definition: Option.h:13
OptionValue::getValue
const VecValue & getValue() const
Get the vector of values.
Definition: OptionValue.cpp:131
OptionValue
Describe the value of an option passed to a program.
Definition: OptionValue.h:20