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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
/*
MIDI Sequencer C++ library
Copyright (C) 2006-2024, Pedro Lopez-Cabanillas <plcl@users.sf.net>
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SEQUENCERERROR_H
#define SEQUENCERERROR_H
#include <QString>
#include "macros.h"
#include <exception>
/**
* @file sequencererror.h
* SequencerError Exception class
*/
/**
* @namespace std
* C++ Standard Library namespace
*
* @class std::exception
* Provides consistent interface to handle errors.
* @see https://en.cppreference.com/w/cpp/error/exception
*/
#if defined(DRUMSTICK_STATIC)
#define DRUMSTICK_ALSA_EXPORT
#else
#if defined(drumstick_alsa_EXPORTS)
#define DRUMSTICK_ALSA_EXPORT Q_DECL_EXPORT
#else
#define DRUMSTICK_ALSA_EXPORT Q_DECL_IMPORT
#endif
#endif
namespace drumstick {
namespace ALSA {
/**
* @addtogroup ALSAError ALSA Sequencer Exception
* @{
*
* @class SequencerError
* Exception class for ALSA Sequencer errors.
* This class is used to report errors from the ALSA sequencer.
*
* The class SequencerError represents an exception object reported when the
* ALSA library returns an error code. It is only used for severe errors.
*/
class DRUMSTICK_ALSA_EXPORT SequencerError : std::exception
{
public:
/**
* Constructor
* @param s Error location
* @param rc Numeric error code
*/
SequencerError(QString const& s, int rc);
/**
* Retrieve a human readable error message
* @return human readable error message
*/
virtual const char* what() const noexcept override;
/**
* Gets the human readable error message from the error code
* @return Error message
*/
QString qstrError() const;
/**
* Gets the numeric error code
* @return Error code
*/
int code() const;
/**
* Gets the location of the error code as provided in the constructor
* @return Error location
*/
const QString& location() const;
private:
QString m_location;
int m_errCode;
};
/** @} */
} // namespace ALSA
} // namespace drumstick
#endif // SEQUENCERERROR_H
|