PhoenixPresentation  2.0.0
Set of cmake function to automate presentation generation
OptionType.cpp
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 #include "OptionType.h"
8 
10 
14  return type >= OptionType::CHAR && type <= OptionType::LONG;
15 }
16 
18 
22  return type >= OptionType::UCHAR && type <= OptionType::ULONG;
23 }
24 
26 
30  return isOptionSignedInteger(type) || isOptionUnsignedInteger(type);
31 }
32 
34 
38  return type >= OptionType::FLOAT && type <= OptionType::DOUBLE;
39 }
40 
42 
46  return type == OptionType::STRING || type == OptionType::FILE_OR_DIR || type == OptionType::FILENAME || type == OptionType::DIRECTORY;
47 }
48 
50 
55  if(typeFromParam == typeFromType){return true;}
56  //If we are waiting for a boolean, but we do not get one, => fail
57  if(typeFromParam == OptionType::BOOL){return false;}
58  if(isOptionStringFileDir(typeFromParam) && isOptionStringFileDir(typeFromType)){return true;}
59 
60  if(isOptionInteger(typeFromParam) && isOptionFloatingPoint(typeFromType)){return false;}
61 
62  return true;
63 }
64 
66 
70  switch(type){
71  case OptionType::NONE:
72  return "NONE";
73  case OptionType::STRING:
74  return "STRING";
76  return "FILENAME";
78  return "DIRECTORY";
80  return "FILE_OR_DIR";
81  case OptionType::BOOL:
82  return "BOOL";
83  case OptionType::CHAR:
84  return "CHAR";
85  case OptionType::SHORT:
86  return "SHORT";
87  case OptionType::INT:
88  return "INT";
89  case OptionType::LONG:
90  return "LONG";
91  case OptionType::UCHAR:
92  return "UCHAR";
93  case OptionType::USHORT:
94  return "USHORT";
95  case OptionType::UINT:
96  return "UINT";
97  case OptionType::ULONG:
98  return "ULONG";
99  case OptionType::FLOAT:
100  return "FLOAT";
101  case OptionType::DOUBLE:
102  return "DOUBLE";
103  default:
104  return "";
105  }
106 }
107 
108 template<>
110 template<>
112 template<>
114 template<>
116 template<>
118 template<>
120 template<>
122 template<>
124 template<>
126 template<>
128 template<>
130 template<>
132 
133 
134 
135 
136 
OptionType::OptionType getOptionTypeFromType< unsigned short >()
Definition: OptionType.cpp:123
OptionType::OptionType getOptionTypeFromType< long >()
Definition: OptionType.cpp:119
OptionType::OptionType getOptionTypeFromType< unsigned int >()
Definition: OptionType.cpp:125
bool isOptionSignedInteger(OptionType::OptionType type)
Say if the option type is a signed integer.
Definition: OptionType.cpp:13
bool isOptionStringFileDir(OptionType::OptionType type)
Say if the option is a filename, a drectory, both or a string.
Definition: OptionType.cpp:45
OptionType::OptionType getOptionTypeFromType< unsigned char >()
Definition: OptionType.cpp:121
OptionType::OptionType getOptionTypeFromType< PString >()
Definition: OptionType.cpp:109
OptionType::OptionType getOptionTypeFromType< unsigned long >()
Definition: OptionType.cpp:127
PString convertOptionTypeToString(OptionType::OptionType type)
Convert the OptionType into PString.
Definition: OptionType.cpp:69
OptionType::OptionType getOptionTypeFromType< float >()
Definition: OptionType.cpp:129
OptionType::OptionType getOptionTypeFromType< short >()
Definition: OptionType.cpp:115
OptionType::OptionType getOptionTypeFromType< bool >()
Definition: OptionType.cpp:111
OptionType::OptionType getOptionTypeFromType< char >()
Definition: OptionType.cpp:113
bool isOptionUnsignedInteger(OptionType::OptionType type)
Say if the option type is an unsigned integer.
Definition: OptionType.cpp:21
bool isOptionInteger(OptionType::OptionType type)
Say if the option type is an integer.
Definition: OptionType.cpp:29
bool isOptionTypeCompatible(OptionType::OptionType typeFromParam, OptionType::OptionType typeFromType)
Say if two types are compatible.
Definition: OptionType.cpp:54
bool isOptionFloatingPoint(OptionType::OptionType type)
Say if the option type is a floating point.
Definition: OptionType.cpp:37
OptionType::OptionType getOptionTypeFromType< int >()
Definition: OptionType.cpp:117
OptionType::OptionType getOptionTypeFromType< double >()
Definition: OptionType.cpp:131
Extends the std::string.
Definition: PString.h:16