File: conversionexception.h

package info (click to toggle)
martchus-cpp-utilities 5.33.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,396 kB
  • sloc: cpp: 12,679; awk: 18; ansic: 12; makefile: 10
file content (53 lines) | stat: -rw-r--r-- 1,399 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef CONVERSION_UTILITIES_CONVERSIONEXCEPTION_H
#define CONVERSION_UTILITIES_CONVERSIONEXCEPTION_H

#include "../global.h"

#include <stdexcept>
#include <string>

namespace CppUtilities {

class CPP_UTILITIES_EXPORT ConversionException : public std::runtime_error {
public:
    ConversionException() noexcept;
    ConversionException(const std::string &what) noexcept;
    ConversionException(const char *what) noexcept;
    ~ConversionException() override;
};

/*!
 * \class 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) noexcept
    : std::runtime_error(what)
{
}

} // namespace CppUtilities

#endif // CONVERSION_UTILITIES_CONVERSIONEXCEPTION_H