PhoenixMock  1.8.7
Tools to split/merge/print mock used in Phoenix
OptionValue.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 __POPTIONVALUE_H__
8 #define __POPTIONVALUE_H__
9 
10 #include <string>
11 #include <vector>
12 
13 #include "convertToString.h"
14 #include "OptionType.h"
15 
17 typedef std::vector<std::string> VecValue;
18 
21  public:
23  OptionValue(const std::string & value, OptionType::OptionType type = OptionType::STRING);
25  OptionValue(const std::string & value, OptionType::OptionType type, const VecValue & vecDefaultValue);
26  OptionValue(const VecValue & vecValue, OptionType::OptionType type, const VecValue & vecDefaultValue);
27  OptionValue(const std::string & value, OptionType::OptionType type, const VecValue & vecDefaultValue, const VecValue & vecPossibleValue);
28  OptionValue(const VecValue & vecValue, OptionType::OptionType type, const VecValue & vecDefaultValue, const VecValue & vecPossibleValue);
29  OptionValue(const OptionValue & other);
30  virtual ~OptionValue();
31  OptionValue & operator = (const OptionValue & other);
32 
34  void setValue(const std::string & value);
35  void setValue(const VecValue & value);
36  void addValue(const std::string & value);
37 
38  template<typename T>
39  void setDefaultValue(const T & value);
40  template<typename T>
41  void setDefaultValue(const std::vector<T> & value);
42  template<typename T>
43  void setDefaultValue(const std::list<T> & value);
44 
45  const VecValue & getValue() const;
46  VecValue & getValue();
47 
50 
51  const VecValue & getDefaultValue() const;
53 
54  const VecValue & getPossibleValue() const;
56 
57 
58  template<typename T>
59  void getValue(T & value, bool isParsed) const;
60  template<typename T>
61  void getValue(std::vector<T> & vecValue, bool isParsed) const;
62  template<typename T>
63  void getValue(std::list<T> & vecValue, bool isParsed) const;
64 
65  void bashCompletionValue(std::string & strBashCompletion, const std::string & cursorOption) const;
66 
67  protected:
68  void copyOptionValue(const OptionValue & other);
69 
70  private:
71  void initialisationOptionValue(const VecValue & vecValue, OptionType::OptionType type, const VecValue & vecDefaultValue, const VecValue & vecPossibleValue);
72 
73  template<typename T>
74  void checkTypeFromTemplate() const;
75 
84 };
85 
86 #include "OptionValue_impl.h"
87 
88 #endif
89 
OptionValue::operator=
OptionValue & operator=(const OptionValue &other)
Definition of equal operator of OptionValue.
Definition: OptionValue.cpp:97
OptionType::STRING
@ STRING
Definition: OptionType.h:25
OptionType.h
OptionValue::setType
void setType(OptionType::OptionType type)
Set the type of the OptionValue.
Definition: OptionValue.cpp:105
OptionValue::getType
OptionType::OptionType getType() const
Get the type of the OptionValue.
Definition: OptionValue.cpp:141
OptionValue::getPossibleValue
const VecValue & getPossibleValue() const
Get the possible values of the OptionValue.
Definition: OptionValue.cpp:161
OptionValue_impl.h
OptionValue::p_type
OptionType::OptionType p_type
Type of the OptionValue.
Definition: OptionValue.h:77
OptionValue::bashCompletionValue
void bashCompletionValue(std::string &strBashCompletion, const std::string &cursorOption) const
Print the possible value to the bash completion.
Definition: OptionValue.cpp:172
OptionValue::addValue
void addValue(const std::string &value)
Add value of the OptionValue.
Definition: OptionValue.cpp:126
OptionValue::checkTypeFromTemplate
void checkTypeFromTemplate() const
Check the type from the template.
Definition: OptionValue_impl.h:105
OptionValue::setDefaultValue
void setDefaultValue(const T &value)
Set the value in the OptionValue.
Definition: OptionValue_impl.h:17
OptionValue::initialisationOptionValue
void initialisationOptionValue(const VecValue &vecValue, OptionType::OptionType type, const VecValue &vecDefaultValue, const VecValue &vecPossibleValue)
Initialisation function of the class OptionValue.
Definition: OptionValue.cpp:206
OptionValue::p_vecDefaultValue
VecValue p_vecDefaultValue
Default value of the OptionValue.
Definition: OptionValue.h:81
convertToString.h
createReleaseCurl.type
type
Definition: createReleaseCurl.py:124
OptionValue::OptionValue
OptionValue(OptionType::OptionType type=OptionType::STRING)
Default constructeur of OptionValue.
Definition: OptionValue.cpp:13
OptionValue::copyOptionValue
void copyOptionValue(const OptionValue &other)
Copy function of OptionValue.
Definition: OptionValue.cpp:193
OptionType::OptionType
OptionType
Definition: OptionType.h:19
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
OptionValue::p_vecValue
VecValue p_vecValue
Vector of the values of the OptionValue.
Definition: OptionValue.h:79
OptionValue::~OptionValue
virtual ~OptionValue()
Destructeur of OptionValue.
Definition: OptionValue.cpp:89
OptionValue::setValue
void setValue(const std::string &value)
Set the value of the OptionValue.
Definition: OptionValue.cpp:112
OptionValue::getDefaultValue
const VecValue & getDefaultValue() const
Get the default value of the OptionValue.
Definition: OptionValue.cpp:151
VecValue
std::vector< std::string > VecValue
Vector of values.
Definition: OptionValue.h:17
OptionValue::p_vecPossibleValue
VecValue p_vecPossibleValue
Vector of the possible value for the OptionValue.
Definition: OptionValue.h:83