PhoenixPresentation  2.0.0
Set of cmake function to automate presentation generation
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 "OptionType.h"
14 
17  public:
21  OptionValue(const PString & value, OptionType::OptionType type, const PVecString & vecDefaultValue);
22  OptionValue(const PVecString & vecValue, OptionType::OptionType type, const PVecString & vecDefaultValue);
23  OptionValue(const PString & value, OptionType::OptionType type, const PVecString & vecDefaultValue, const PVecString & vecPossibleValue);
24  OptionValue(const PVecString & vecValue, OptionType::OptionType type, const PVecString & vecDefaultValue, const PVecString & vecPossibleValue);
25  OptionValue(const OptionValue & other);
26  virtual ~OptionValue();
27  OptionValue & operator = (const OptionValue & other);
28 
30  void setValue(const PString & value);
31  void setValue(const PVecString & value);
32  void addValue(const PString & value);
33 
34  void setVecPossibleValue(const PVecString & vecPossibleValue);
35 
36  template<typename T>
37  void setDefaultValue(const T & value);
38  template<typename T>
39  void setDefaultValue(const std::vector<T> & value);
40 
41  const PVecString & getValue() const;
42  PVecString & getValue();
43 
46 
47  const PVecString & getDefaultValue() const;
49 
50  const PVecString & getPossibleValue() const;
52 
53 
54  template<typename T>
55  void getValue(T & value, bool isParsed) const;
56  template<typename T>
57  void getValue(std::vector<T> & vecValue, bool isParsed) const;
58 
59  void bashCompletionValue(PString & strBashCompletion, const PString & cursorOption) const;
60 
61  protected:
62  void copyOptionValue(const OptionValue & other);
63 
64  private:
65  void initialisationOptionValue(const PVecString & vecValue, OptionType::OptionType type, const PVecString & vecDefaultValue, const PVecString & vecPossibleValue);
66 
67  template<typename T>
68  void checkTypeFromTemplate() const;
69 
78 };
79 
80 #include "OptionValue_impl.h"
81 
82 #endif
83 
std::vector< PString > PVecString
Definition: PString.h:96
Describe the value of an option passed to a program.
Definition: OptionValue.h:16
void initialisationOptionValue(const PVecString &vecValue, OptionType::OptionType type, const PVecString &vecDefaultValue, const PVecString &vecPossibleValue)
Initialisation function of the class OptionValue.
virtual ~OptionValue()
Destructeur of OptionValue.
Definition: OptionValue.cpp:90
const PVecString & getValue() const
Get the vector of values.
void setValue(const PString &value)
Set the value of the OptionValue.
void setVecPossibleValue(const PVecString &vecPossibleValue)
Set the vector of possible values.
OptionValue & operator=(const OptionValue &other)
Definition of equal operator of OptionValue.
Definition: OptionValue.cpp:98
PVecString p_vecDefaultValue
Default value of the OptionValue.
Definition: OptionValue.h:75
void bashCompletionValue(PString &strBashCompletion, const PString &cursorOption) const
Print the possible value to the bash completion.
void addValue(const PString &value)
Add value of the OptionValue.
void setDefaultValue(const T &value)
Set the value in the OptionValue.
PVecString p_vecPossibleValue
Vector of the possible value for the OptionValue.
Definition: OptionValue.h:77
OptionValue(OptionType::OptionType type=OptionType::STRING)
Default constructeur of OptionValue.
Definition: OptionValue.cpp:14
OptionType::OptionType getType() const
Get the type of the OptionValue.
void copyOptionValue(const OptionValue &other)
Copy function of OptionValue.
const PVecString & getDefaultValue() const
Get the default value of the OptionValue.
const PVecString & getPossibleValue() const
Get the possible values of the OptionValue.
OptionType::OptionType p_type
Type of the OptionValue.
Definition: OptionValue.h:71
void setType(OptionType::OptionType type)
Set the type of the OptionValue.
void checkTypeFromTemplate() const
Check the type from the template.
PVecString p_vecValue
Vector of the values of the OptionValue.
Definition: OptionValue.h:73
Extends the std::string.
Definition: PString.h:16