tagparser/exceptions.h

80 lines
2.0 KiB
C
Raw Normal View History

2015-04-22 19:22:01 +02:00
#ifndef MEDIA_EXCEPTIONS_H
#define MEDIA_EXCEPTIONS_H
2016-08-29 15:43:05 +02:00
#include "./global.h"
2015-04-22 19:22:01 +02:00
#include <stdexcept>
#include <string>
namespace Media {
2016-08-29 15:43:05 +02:00
class TAG_PARSER_EXPORT Failure : public std::exception
2015-04-22 19:22:01 +02:00
{
public:
Failure() USE_NOTHROW;
virtual ~Failure() USE_NOTHROW;
virtual const char *what() const USE_NOTHROW;
};
2016-08-29 15:43:05 +02:00
class TAG_PARSER_EXPORT NoDataFoundException : public Failure
2015-04-22 19:22:01 +02:00
{
public:
NoDataFoundException() USE_NOTHROW;
virtual ~NoDataFoundException() USE_NOTHROW;
virtual const char *what() const USE_NOTHROW;
};
2016-08-29 15:43:05 +02:00
class TAG_PARSER_EXPORT InvalidDataException : public Failure
2015-04-22 19:22:01 +02:00
{
public:
InvalidDataException() USE_NOTHROW;
virtual ~InvalidDataException() USE_NOTHROW;
virtual const char *what() const USE_NOTHROW;
};
2016-08-29 15:43:05 +02:00
class TAG_PARSER_EXPORT TruncatedDataException : public InvalidDataException
2015-04-22 19:22:01 +02:00
{
public:
TruncatedDataException() USE_NOTHROW;
virtual ~TruncatedDataException() USE_NOTHROW;
virtual const char *what() const USE_NOTHROW;
};
2016-08-29 15:43:05 +02:00
class TAG_PARSER_EXPORT OperationAbortedException : public Failure
2015-04-22 19:22:01 +02:00
{
public:
OperationAbortedException() USE_NOTHROW;
virtual ~OperationAbortedException() USE_NOTHROW;
virtual const char *what() const USE_NOTHROW;
};
2016-08-29 15:43:05 +02:00
class TAG_PARSER_EXPORT VersionNotSupportedException : public Failure
2015-04-22 19:22:01 +02:00
{
public:
VersionNotSupportedException() USE_NOTHROW;
virtual ~VersionNotSupportedException() USE_NOTHROW;
virtual const char *what() const USE_NOTHROW;
};
2016-08-29 15:43:05 +02:00
class TAG_PARSER_EXPORT NotImplementedException : public Failure
2015-04-22 19:22:01 +02:00
{
public:
NotImplementedException() USE_NOTHROW;
virtual ~NotImplementedException() USE_NOTHROW;
virtual const char *what() const USE_NOTHROW;
};
2016-05-16 20:56:53 +02:00
/*!
* \brief Throws TruncatedDataException() if the specified \a sizeDenotation exceeds maxSize; otherwise maxSize is reduced by \a sizeDenotation.
*/
#define CHECK_MAX_SIZE(sizeDenotation) \
if(maxSize < sizeDenotation) { \
throw TruncatedDataException(); \
} else { \
maxSize -= sizeDenotation; \
}
2015-04-22 19:22:01 +02:00
}
#endif // MEDIA_EXCEPTIONS_H