Leonetienne/Hazelnupp
Simple, easy to use, command line parameter interface
Public Member Functions | List of all members
Hazelnp::HazelnuppConstraintTypeMissmatch Class Reference

Gets thrown when a parameter is of a type that does not match the required type, and is not convertible to it. More...

#include <HazelnuppException.h>

Inheritance diagram for Hazelnp::HazelnuppConstraintTypeMissmatch:
Inheritance graph
[legend]
Collaboration diagram for Hazelnp::HazelnuppConstraintTypeMissmatch:
Collaboration graph
[legend]

Public Member Functions

 HazelnuppConstraintTypeMissmatch ()
 
 HazelnuppConstraintTypeMissmatch (const std::string &msg)
 
 HazelnuppConstraintTypeMissmatch (const std::string &key, const DATA_TYPE requiredType, const DATA_TYPE actualType, const std::string &paramDescription="")
 
- Public Member Functions inherited from Hazelnp::HazelnuppConstraintException
 HazelnuppConstraintException ()
 
 HazelnuppConstraintException (const std::string &msg)
 
- Public Member Functions inherited from Hazelnp::HazelnuppException
 HazelnuppException ()
 
 HazelnuppException (const std::string &msg)
 
const std::string & What () const
 Will return an error message. More...
 

Additional Inherited Members

- Protected Attributes inherited from Hazelnp::HazelnuppException
std::string message
 

Detailed Description

Gets thrown when a parameter is of a type that does not match the required type, and is not convertible to it.

Definition at line 56 of file HazelnuppException.h.

Constructor & Destructor Documentation

◆ HazelnuppConstraintTypeMissmatch() [1/3]

Hazelnp::HazelnuppConstraintTypeMissmatch::HazelnuppConstraintTypeMissmatch ( )
inline

◆ HazelnuppConstraintTypeMissmatch() [2/3]

Hazelnp::HazelnuppConstraintTypeMissmatch::HazelnuppConstraintTypeMissmatch ( const std::string &  msg)
inline

◆ HazelnuppConstraintTypeMissmatch() [3/3]

Hazelnp::HazelnuppConstraintTypeMissmatch::HazelnuppConstraintTypeMissmatch ( const std::string &  key,
const DATA_TYPE  requiredType,
const DATA_TYPE  actualType,
const std::string &  paramDescription = "" 
)
inline

Definition at line 62 of file HazelnuppException.h.

63  {
64  // Generate descriptive error message
65  std::stringstream ss;
66  ss << "Cannot convert parameter " << key << " to type " << DataTypeToString(requiredType)
67  << ". You supplied type: " << DataTypeToString(actualType) << ".";
68 
69  // Add the parameter description, if provided
70  if (paramDescription.length() > 0)
71  ss << std::endl << key << " => " << paramDescription;
72 
73  message = ss.str();
74  return;
75  };
static std::string DataTypeToString(DATA_TYPE type)
Definition: DataType.h:17

The documentation for this class was generated from the following file: