2015-09-06 19:57:33 +02:00
|
|
|
#include "./exceptions.h"
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
2018-03-06 23:09:15 +01:00
|
|
|
namespace TagParser {
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
/*!
|
2018-06-03 20:38:32 +02:00
|
|
|
* \class TagParser::Failure
|
2015-04-22 19:22:01 +02:00
|
|
|
* \brief The class inherits from std::exception and serves as base class for exceptions
|
|
|
|
* thrown by the elements of the Media namespace.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Constructs a new exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
Failure::Failure() noexcept
|
2018-03-07 01:17:50 +01:00
|
|
|
{
|
|
|
|
}
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Destroys the exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
Failure::~Failure() noexcept
|
2018-03-07 01:17:50 +01:00
|
|
|
{
|
|
|
|
}
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns a C-style character string describing the cause of the exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
const char *Failure::what() const noexcept
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
|
|
|
return "unable to parse given data";
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2018-06-03 20:38:32 +02:00
|
|
|
* \class TagParser::NoDataFoundException
|
2015-04-22 19:22:01 +02:00
|
|
|
* \brief The exception that is thrown when the data to be parsed holds no
|
2019-02-13 20:19:46 +01:00
|
|
|
* parsable information (e.g. relevant section in the file does not exist or
|
|
|
|
* has size of zero).
|
2015-04-22 19:22:01 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Constructs a new exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
NoDataFoundException::NoDataFoundException() noexcept
|
2018-03-07 01:17:50 +01:00
|
|
|
{
|
|
|
|
}
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Destroys the exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
NoDataFoundException::~NoDataFoundException() noexcept
|
2018-03-07 01:17:50 +01:00
|
|
|
{
|
|
|
|
}
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns a C-style character string describing the cause of the exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
const char *NoDataFoundException::what() const noexcept
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
|
|
|
return "no parsable data has been found";
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2018-06-03 20:38:32 +02:00
|
|
|
* \class TagParser::InvalidDataException
|
2015-04-22 19:22:01 +02:00
|
|
|
* \brief The exception that is thrown when the data to be parsed or to be made seems
|
|
|
|
* invalid and therefore can not be parsed.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Constructs a new exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
InvalidDataException::InvalidDataException() noexcept
|
2018-03-07 01:17:50 +01:00
|
|
|
{
|
|
|
|
}
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Destroys the exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
InvalidDataException::~InvalidDataException() noexcept
|
2018-03-07 01:17:50 +01:00
|
|
|
{
|
|
|
|
}
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns a C-style character string describing the cause of the exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
const char *InvalidDataException::what() const noexcept
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
|
|
|
return "data to be parsed or to be made seems to be invalid";
|
|
|
|
}
|
|
|
|
|
2019-02-13 20:19:46 +01:00
|
|
|
/*!
|
2020-11-05 19:52:09 +01:00
|
|
|
* \class TagParser::NoDataProvidedException
|
2019-02-13 20:19:46 +01:00
|
|
|
* \brief The exception that is thrown when the value to be written is empty but that
|
|
|
|
* is not allowed in that context (e.g. an empty ID3v2 frame is not allowed).
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Constructs a new exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
NoDataProvidedException::NoDataProvidedException() noexcept
|
2019-02-13 20:19:46 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Destroys the exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
NoDataProvidedException::~NoDataProvidedException() noexcept
|
2019-02-13 20:19:46 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns a C-style character string describing the cause of the exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
const char *NoDataProvidedException::what() const noexcept
|
2019-02-13 20:19:46 +01:00
|
|
|
{
|
|
|
|
return "can not write empty value";
|
|
|
|
}
|
|
|
|
|
2015-04-22 19:22:01 +02:00
|
|
|
/*!
|
2018-06-03 20:38:32 +02:00
|
|
|
* \class TagParser::TruncatedDataException
|
2015-04-22 19:22:01 +02:00
|
|
|
* \brief The exception that is thrown when the data to be parsed is truncated
|
|
|
|
* and therefore can not be parsed at all.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Constructs a new exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
TruncatedDataException::TruncatedDataException() noexcept
|
2018-03-07 01:17:50 +01:00
|
|
|
{
|
|
|
|
}
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Destroys the exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
TruncatedDataException::~TruncatedDataException() noexcept
|
2018-03-07 01:17:50 +01:00
|
|
|
{
|
|
|
|
}
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns a C-style character string describing the cause of the exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
const char *TruncatedDataException::what() const noexcept
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
|
|
|
return "data to be parsed seems to be truncated";
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2018-06-03 20:38:32 +02:00
|
|
|
* \class TagParser::OperationAbortedException
|
2015-04-22 19:22:01 +02:00
|
|
|
* \brief The exception that is thrown when an operation has been stopped
|
2015-10-16 21:46:36 +02:00
|
|
|
* and thus not successfully completed because it has been aborted.
|
2015-04-22 19:22:01 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Constructs a new exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
OperationAbortedException::OperationAbortedException() noexcept
|
2018-03-07 01:17:50 +01:00
|
|
|
{
|
|
|
|
}
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Destroys the exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
OperationAbortedException::~OperationAbortedException() noexcept
|
2018-03-07 01:17:50 +01:00
|
|
|
{
|
|
|
|
}
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns a C-style character string describing the cause of the exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
const char *OperationAbortedException::what() const noexcept
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
|
|
|
return "operation has been aborted";
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2018-06-03 20:38:32 +02:00
|
|
|
* \class TagParser::VersionNotSupportedException
|
2015-04-22 19:22:01 +02:00
|
|
|
* \brief The exception that is thrown when an operation fails because the
|
|
|
|
* detected or specified version is not supported by the implementation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Constructs a new exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
VersionNotSupportedException::VersionNotSupportedException() noexcept
|
2018-03-07 01:17:50 +01:00
|
|
|
{
|
|
|
|
}
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Destroys the exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
VersionNotSupportedException::~VersionNotSupportedException() noexcept
|
2018-03-07 01:17:50 +01:00
|
|
|
{
|
|
|
|
}
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns a C-style character string describing the cause of the exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
const char *VersionNotSupportedException::what() const noexcept
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
|
|
|
return "the version of the data to be parsed is not supported";
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2018-06-03 20:38:32 +02:00
|
|
|
* \class TagParser::NotImplementedException
|
2015-04-22 19:22:01 +02:00
|
|
|
* \brief This exception is thrown when the an operation is invoked that has not
|
|
|
|
* been implemented yet.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Constructs a new exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
NotImplementedException::NotImplementedException() noexcept
|
2018-03-07 01:17:50 +01:00
|
|
|
{
|
|
|
|
}
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Destroys the exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
NotImplementedException::~NotImplementedException() noexcept
|
2018-03-07 01:17:50 +01:00
|
|
|
{
|
|
|
|
}
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns a C-style character string describing the cause of the exception.
|
|
|
|
*/
|
2019-02-17 17:14:07 +01:00
|
|
|
const char *NotImplementedException::what() const noexcept
|
2015-04-22 19:22:01 +02:00
|
|
|
{
|
|
|
|
return "the operation has not been implemented yet";
|
|
|
|
}
|
|
|
|
|
2018-03-07 01:17:50 +01:00
|
|
|
} // namespace TagParser
|