PhoenixMock  1.8.7
Tools to split/merge/print mock used in Phoenix
OptionType.cpp File Reference
#include "OptionType.h"
+ Include dependency graph for OptionType.cpp:

Go to the source code of this file.

Functions

std::string convertOptionTypeToString (OptionType::OptionType type)
 Convert the OptionType into string. More...
 
template<>
OptionType::OptionType getOptionTypeFromType< bool > ()
 
template<>
OptionType::OptionType getOptionTypeFromType< char > ()
 
template<>
OptionType::OptionType getOptionTypeFromType< double > ()
 
template<>
OptionType::OptionType getOptionTypeFromType< float > ()
 
template<>
OptionType::OptionType getOptionTypeFromType< int > ()
 
template<>
OptionType::OptionType getOptionTypeFromType< long > ()
 
template<>
OptionType::OptionType getOptionTypeFromType< short > ()
 
template<>
OptionType::OptionType getOptionTypeFromType< std::string > ()
 
template<>
OptionType::OptionType getOptionTypeFromType< unsigned char > ()
 
template<>
OptionType::OptionType getOptionTypeFromType< unsigned int > ()
 
template<>
OptionType::OptionType getOptionTypeFromType< unsigned long > ()
 
template<>
OptionType::OptionType getOptionTypeFromType< unsigned short > ()
 
bool isOptionFloatingPoint (OptionType::OptionType type)
 Say if the option type is a floating point. More...
 
bool isOptionInteger (OptionType::OptionType type)
 Say if the option type is an integer. More...
 
bool isOptionSignedInteger (OptionType::OptionType type)
 Say if the option type is a signed integer. More...
 
bool isOptionStringFileDir (OptionType::OptionType type)
 Say if the option is a filename, a drectory, both or a string. More...
 
bool isOptionTypeCompatible (OptionType::OptionType typeFromParam, OptionType::OptionType typeFromType)
 Say if two types are compatible. More...
 
bool isOptionUnsignedInteger (OptionType::OptionType type)
 Say if the option type is an unsigned integer. More...
 

Function Documentation

◆ convertOptionTypeToString()

std::string convertOptionTypeToString ( OptionType::OptionType  type)

Convert the OptionType into string.

Parameters
type: OptionType to be converted
Returns
string

Definition at line 69 of file OptionType.cpp.

69  {
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 }

References OptionType::BOOL, OptionType::CHAR, OptionType::DIRECTORY, OptionType::DOUBLE, OptionType::FILE_OR_DIR, OptionType::FILENAME, OptionType::FLOAT, OptionType::INT, OptionType::LONG, OptionType::NONE, OptionType::SHORT, OptionType::STRING, createReleaseCurl::type, OptionType::UCHAR, OptionType::UINT, OptionType::ULONG, and OptionType::USHORT.

Referenced by OptionValue::bashCompletionValue(), Option::checkArgument(), OptionParser::checkOptionType(), OptionValue::checkTypeFromTemplate(), Option::print(), and testOptionType().

+ Here is the caller graph for this function:

◆ getOptionTypeFromType< bool >()

Definition at line 111 of file OptionType.cpp.

111 {return OptionType::BOOL;}

References OptionType::BOOL.

Referenced by testOptionType().

+ Here is the caller graph for this function:

◆ getOptionTypeFromType< char >()

Definition at line 113 of file OptionType.cpp.

113 {return OptionType::CHAR;}

References OptionType::CHAR.

Referenced by testOptionType().

+ Here is the caller graph for this function:

◆ getOptionTypeFromType< double >()

Definition at line 131 of file OptionType.cpp.

131 {return OptionType::DOUBLE;}

References OptionType::DOUBLE.

Referenced by testOptionType().

+ Here is the caller graph for this function:

◆ getOptionTypeFromType< float >()

Definition at line 129 of file OptionType.cpp.

129 {return OptionType::FLOAT;}

References OptionType::FLOAT.

Referenced by testOptionType().

+ Here is the caller graph for this function:

◆ getOptionTypeFromType< int >()

Definition at line 117 of file OptionType.cpp.

117 {return OptionType::INT;}

References OptionType::INT.

Referenced by testOptionType().

+ Here is the caller graph for this function:

◆ getOptionTypeFromType< long >()

Definition at line 119 of file OptionType.cpp.

119 {return OptionType::LONG;}

References OptionType::LONG.

Referenced by testOptionType().

+ Here is the caller graph for this function:

◆ getOptionTypeFromType< short >()

Definition at line 115 of file OptionType.cpp.

115 {return OptionType::SHORT;}

References OptionType::SHORT.

Referenced by testOptionType().

+ Here is the caller graph for this function:

◆ getOptionTypeFromType< std::string >()

template<>
OptionType::OptionType getOptionTypeFromType< std::string > ( )

Definition at line 109 of file OptionType.cpp.

109 {return OptionType::STRING;}

References OptionType::STRING.

◆ getOptionTypeFromType< unsigned char >()

template<>
OptionType::OptionType getOptionTypeFromType< unsigned char > ( )

Definition at line 121 of file OptionType.cpp.

121 {return OptionType::UCHAR;}

References OptionType::UCHAR.

Referenced by testOptionType().

+ Here is the caller graph for this function:

◆ getOptionTypeFromType< unsigned int >()

template<>
OptionType::OptionType getOptionTypeFromType< unsigned int > ( )

Definition at line 125 of file OptionType.cpp.

125 {return OptionType::UINT;}

References OptionType::UINT.

Referenced by testOptionType().

+ Here is the caller graph for this function:

◆ getOptionTypeFromType< unsigned long >()

template<>
OptionType::OptionType getOptionTypeFromType< unsigned long > ( )

Definition at line 127 of file OptionType.cpp.

127 {return OptionType::ULONG;}

References OptionType::ULONG.

Referenced by testOptionType().

+ Here is the caller graph for this function:

◆ getOptionTypeFromType< unsigned short >()

template<>
OptionType::OptionType getOptionTypeFromType< unsigned short > ( )

Definition at line 123 of file OptionType.cpp.

123 {return OptionType::USHORT;}

References OptionType::USHORT.

Referenced by testOptionType().

+ Here is the caller graph for this function:

◆ isOptionFloatingPoint()

bool isOptionFloatingPoint ( OptionType::OptionType  type)

Say if the option type is a floating point.

Parameters
type: type to be checked
Returns
true if type is a floating point, false otherwise

Definition at line 37 of file OptionType.cpp.

37  {
39 }

References OptionType::DOUBLE, OptionType::FLOAT, and createReleaseCurl::type.

Referenced by isOptionTypeCompatible(), and testOptionType().

+ Here is the caller graph for this function:

◆ isOptionInteger()

bool isOptionInteger ( OptionType::OptionType  type)

Say if the option type is an integer.

Parameters
type: type to be checked
Returns
true if type is an integer, false otherwise

Definition at line 29 of file OptionType.cpp.

29  {
31 }

References isOptionSignedInteger(), isOptionUnsignedInteger(), and createReleaseCurl::type.

Referenced by isOptionTypeCompatible(), and testOptionType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isOptionSignedInteger()

bool isOptionSignedInteger ( OptionType::OptionType  type)

Say if the option type is a signed integer.

Parameters
type: type to be checked
Returns
true if type is a signed integer, false otherwise

Definition at line 13 of file OptionType.cpp.

13  {
15 }

References OptionType::CHAR, OptionType::LONG, and createReleaseCurl::type.

Referenced by isOptionInteger(), and testOptionType().

+ Here is the caller graph for this function:

◆ isOptionStringFileDir()

bool isOptionStringFileDir ( OptionType::OptionType  type)

Say if the option is a filename, a drectory, both or a string.

Parameters
type: type to be checked
Returns
true if type is a filename, a drectory, both or a string, false otherwise

Definition at line 45 of file OptionType.cpp.

References OptionType::DIRECTORY, OptionType::FILE_OR_DIR, OptionType::FILENAME, OptionType::STRING, and createReleaseCurl::type.

Referenced by isOptionTypeCompatible(), and testOptionType().

+ Here is the caller graph for this function:

◆ isOptionTypeCompatible()

bool isOptionTypeCompatible ( OptionType::OptionType  typeFromParam,
OptionType::OptionType  typeFromType 
)

Say if two types are compatible.

Parameters
typeFromParam: type from parameters user
typeFromType: type automatically determined with default value type
Returns
true if the two types are compatible, false otherwise

Definition at line 54 of file OptionType.cpp.

54  {
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 }

References OptionType::BOOL, isOptionFloatingPoint(), isOptionInteger(), and isOptionStringFileDir().

Referenced by OptionParser::checkOptionType(), and OptionValue::checkTypeFromTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isOptionUnsignedInteger()

bool isOptionUnsignedInteger ( OptionType::OptionType  type)

Say if the option type is an unsigned integer.

Parameters
type: type to be checked
Returns
true if type is an unsigned integer, false otherwise

Definition at line 21 of file OptionType.cpp.

21  {
23 }

References createReleaseCurl::type, OptionType::UCHAR, and OptionType::ULONG.

Referenced by isOptionInteger(), and testOptionType().

+ Here is the caller graph for this function:
isOptionInteger
bool isOptionInteger(OptionType::OptionType type)
Say if the option type is an integer.
Definition: OptionType.cpp:29
OptionType::LONG
@ LONG
Definition: OptionType.h:33
isOptionStringFileDir
bool isOptionStringFileDir(OptionType::OptionType type)
Say if the option is a filename, a drectory, both or a string.
Definition: OptionType.cpp:45
OptionType::STRING
@ STRING
Definition: OptionType.h:25
OptionType::UCHAR
@ UCHAR
Definition: OptionType.h:34
OptionType::CHAR
@ CHAR
Definition: OptionType.h:30
OptionType::USHORT
@ USHORT
Definition: OptionType.h:35
isOptionUnsignedInteger
bool isOptionUnsignedInteger(OptionType::OptionType type)
Say if the option type is an unsigned integer.
Definition: OptionType.cpp:21
OptionType::BOOL
@ BOOL
Definition: OptionType.h:29
OptionType::DIRECTORY
@ DIRECTORY
Definition: OptionType.h:27
OptionType::INT
@ INT
Definition: OptionType.h:32
OptionType::UINT
@ UINT
Definition: OptionType.h:36
OptionType::ULONG
@ ULONG
Definition: OptionType.h:37
OptionType::SHORT
@ SHORT
Definition: OptionType.h:31
OptionType::FLOAT
@ FLOAT
Definition: OptionType.h:38
OptionType::FILE_OR_DIR
@ FILE_OR_DIR
Definition: OptionType.h:28
createReleaseCurl.type
type
Definition: createReleaseCurl.py:124
OptionType::NONE
@ NONE
Definition: OptionType.h:24
OptionType::DOUBLE
@ DOUBLE
Definition: OptionType.h:39
isOptionFloatingPoint
bool isOptionFloatingPoint(OptionType::OptionType type)
Say if the option type is a floating point.
Definition: OptionType.cpp:37
isOptionSignedInteger
bool isOptionSignedInteger(OptionType::OptionType type)
Say if the option type is a signed integer.
Definition: OptionType.cpp:13
OptionType::FILENAME
@ FILENAME
Definition: OptionType.h:26