Remove USE_NOTHROW and make ConversionException inline
This commit is contained in:
parent
62902f98e8
commit
f40a800107
|
@ -33,7 +33,7 @@ Failure::Failure(const std::string &what)
|
|||
/*!
|
||||
* Destroys the Failure.
|
||||
*/
|
||||
Failure::~Failure() USE_NOTHROW
|
||||
Failure::~Failure() noexcept
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ Failure::~Failure() USE_NOTHROW
|
|||
* Returns a C-style character string describing the cause
|
||||
* of the Failure.
|
||||
*/
|
||||
const char *Failure::what() const USE_NOTHROW
|
||||
const char *Failure::what() const noexcept
|
||||
{
|
||||
return m_what.c_str();
|
||||
}
|
||||
|
|
|
@ -13,9 +13,9 @@ class CPP_UTILITIES_EXPORT Failure : public std::exception {
|
|||
public:
|
||||
Failure();
|
||||
Failure(const std::string &what);
|
||||
~Failure() USE_NOTHROW;
|
||||
~Failure() noexcept;
|
||||
|
||||
virtual const char *what() const USE_NOTHROW;
|
||||
virtual const char *what() const noexcept;
|
||||
|
||||
private:
|
||||
std::string m_what;
|
||||
|
|
|
@ -84,20 +84,6 @@
|
|||
#define LIB_HIDDEN __attribute__((visibility("hidden")))
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \def USE_NOTHROW
|
||||
* \brief Marks a function as never throwing, under no circumstances.
|
||||
* \remarks If the function does nevertheless throw, the behaviour is undefined.
|
||||
*/
|
||||
|
||||
#ifndef USE_NOTHROW
|
||||
#if __cplusplus >= 201103L
|
||||
#define USE_NOTHROW noexcept
|
||||
#else
|
||||
#define USE_NOTHROW throw()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \def DECLARE_ENUM
|
||||
* \brief Declares an enum without preventing lupdate to parse the file correctly.
|
||||
|
|
|
@ -2,31 +2,11 @@
|
|||
|
||||
namespace ConversionUtilities {
|
||||
|
||||
/*!
|
||||
* \class ConversionUtilities::ConversionException
|
||||
* \brief The ConversionException class is thrown by the various conversion
|
||||
* functions of this library when a conversion error occurs.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Constructs a new ConversionException.
|
||||
*/
|
||||
ConversionException::ConversionException() USE_NOTHROW : runtime_error("unable to convert")
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a new ConversionException. \a what is a std::string
|
||||
* describing the cause of the ConversionException.
|
||||
*/
|
||||
ConversionException::ConversionException(const std::string &what) USE_NOTHROW : runtime_error(what)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Destroys the ConversionException.
|
||||
*/
|
||||
ConversionException::~ConversionException() USE_NOTHROW
|
||||
ConversionException::~ConversionException()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace ConversionUtilities
|
||||
|
|
|
@ -10,17 +10,41 @@ namespace ConversionUtilities {
|
|||
|
||||
class CPP_UTILITIES_EXPORT ConversionException : public std::runtime_error {
|
||||
public:
|
||||
ConversionException() USE_NOTHROW;
|
||||
ConversionException(const std::string &what) USE_NOTHROW;
|
||||
ConversionException(const char *what) USE_NOTHROW;
|
||||
~ConversionException() USE_NOTHROW;
|
||||
ConversionException() noexcept;
|
||||
ConversionException(const std::string &what) noexcept;
|
||||
ConversionException(const char *what) noexcept;
|
||||
~ConversionException() override;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \class ConversionUtilities::ConversionException
|
||||
* \brief The ConversionException class is thrown by the various conversion
|
||||
* functions of this library when a conversion error occurs.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Constructs a new ConversionException.
|
||||
*/
|
||||
inline ConversionException::ConversionException() noexcept
|
||||
: runtime_error("unable to convert")
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a new ConversionException. \a what is a std::string
|
||||
* describing the cause of the ConversionException.
|
||||
*/
|
||||
inline ConversionException::ConversionException(const std::string &what) noexcept
|
||||
: runtime_error(what)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a new ConversionException. \a what is a C-style string
|
||||
* describing the cause of the ConversionException.
|
||||
*/
|
||||
inline ConversionException::ConversionException(const char *what) USE_NOTHROW : std::runtime_error(what)
|
||||
inline ConversionException::ConversionException(const char *what) noexcept
|
||||
: std::runtime_error(what)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue