2013-11-15 13:41:26 +01:00
|
|
|
/************************************************************************
|
2013-09-23 14:08:06 +02:00
|
|
|
**
|
2013-11-15 13:50:05 +01:00
|
|
|
** @file vexception.h
|
2013-11-15 13:41:26 +01:00
|
|
|
** @author Roman Telezhinsky <dismine@gmail.com>
|
2013-11-15 13:50:05 +01:00
|
|
|
** @date November 15, 2013
|
2013-09-23 14:08:06 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** This source code is part of the Valentine project, a pattern making
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2013 Valentina project
|
|
|
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
2013-09-23 14:08:06 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
2013-09-23 14:08:06 +02:00
|
|
|
** 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.
|
|
|
|
**
|
2013-10-27 13:36:29 +01:00
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
2013-09-23 14:08:06 +02:00
|
|
|
** 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 Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
*************************************************************************/
|
2013-09-23 14:08:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef VEXCEPTION_H
|
|
|
|
#define VEXCEPTION_H
|
|
|
|
|
|
|
|
#include <QException>
|
2013-11-21 13:05:26 +01:00
|
|
|
#include <QString>
|
2014-02-06 15:53:56 +01:00
|
|
|
#include <QWidget>
|
2013-09-23 14:08:06 +02:00
|
|
|
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2013-11-20 12:27:21 +01:00
|
|
|
* @brief The VException class parent for all exception. Could be use for abstract exception
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
class VException : public QException
|
|
|
|
{
|
2013-09-23 14:08:06 +02:00
|
|
|
public:
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2013-11-20 12:27:21 +01:00
|
|
|
* @brief VException constructor exception
|
|
|
|
* @param what string with error
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2013-10-26 21:30:20 +02:00
|
|
|
VException(const QString &what);
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2013-11-20 12:27:21 +01:00
|
|
|
* @brief VException copy constructor
|
|
|
|
* @param e exception
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2013-11-07 15:44:55 +01:00
|
|
|
VException(const VException &e):what(e.What()){}
|
2013-12-14 09:51:35 +01:00
|
|
|
virtual ~VException() noexcept (true){}
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2013-11-20 12:27:21 +01:00
|
|
|
* @brief raise method raise for exception
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
void raise() const;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2013-11-20 12:27:21 +01:00
|
|
|
* @brief clone clone exception
|
|
|
|
* @return new exception
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
VException *clone() const;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2013-11-20 12:27:21 +01:00
|
|
|
* @brief ErrorMessage return main error message
|
|
|
|
* @return error message
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
virtual QString ErrorMessage() const;
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2013-11-20 12:27:21 +01:00
|
|
|
* @brief DetailedInformation return detailed information about error
|
|
|
|
* @return detailed information
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
virtual QString DetailedInformation() const { return QString(); }
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2013-11-20 12:27:21 +01:00
|
|
|
* @brief What return string with error
|
|
|
|
* @return string with error
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
QString What() const;
|
2014-01-20 20:01:20 +01:00
|
|
|
/**
|
|
|
|
* @brief CriticalMessageBox show Critical Message Box.
|
|
|
|
* @param situation main text message box.
|
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
virtual void CriticalMessageBox(const QString &situation, QWidget *parent = 0) const;
|
2013-09-23 14:08:06 +02:00
|
|
|
protected:
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2013-11-20 12:27:21 +01:00
|
|
|
* @brief what string with error
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-02-26 09:18:59 +01:00
|
|
|
QString what;
|
2013-09-23 14:08:06 +02:00
|
|
|
};
|
|
|
|
|
2014-02-26 09:18:59 +01:00
|
|
|
inline void VException::raise() const
|
|
|
|
{
|
|
|
|
throw *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline VException *VException::clone() const
|
|
|
|
{
|
|
|
|
return new VException(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline QString VException::What() const
|
|
|
|
{
|
|
|
|
return what;
|
|
|
|
}
|
|
|
|
|
2013-09-23 14:08:06 +02:00
|
|
|
#endif // VEXCEPTION_H
|