diff options
Diffstat (limited to 'intern/vamr/intern/Exception.h')
-rw-r--r-- | intern/vamr/intern/Exception.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/intern/vamr/intern/Exception.h b/intern/vamr/intern/Exception.h new file mode 100644 index 00000000000..060e8f3a458 --- /dev/null +++ b/intern/vamr/intern/Exception.h @@ -0,0 +1,55 @@ +/* + * This program 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 2 + * of the License, or (at your option) any later version. + * + * This program 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, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup VAMR + */ + +#ifndef __EXCEPTION_H__ +#define __EXCEPTION_H__ + +#include <exception> + +namespace VAMR { + +/** + * For now just a general Exception type (note that it's in namespace VAMR, so name shouldn't cause + * conflicts). + */ +class Exception : public std::exception { + friend class Context; + + public: + Exception(const char *msg, const char *file, int line, int res = 0) + : std::exception(), m_msg(msg), m_file(file), m_line(line), m_res(res) + { + } + + const char *what() const noexcept override + { + return m_msg; + } + + private: + const char *m_msg; + const char *m_file; + const int m_line; + int m_res; +}; + +} // namespace VAMR + +#endif // __EXCEPTION_H__ |