1 /************************************************************************
2 **
3 ** @file vexceptionconversionerror.h
4 ** @author Roman Telezhynskyi <dismine(at)gmail.com>
5 ** @date November 15, 2013
6 **
7 ** @brief
8 ** @copyright
9 ** This source code is part of the Valentina project, a pattern making
10 ** program, whose allow create and modeling patterns of clothing.
11 ** Copyright (C) 2013-2015 Valentina project
12 ** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
13 **
14 ** Valentina is free software: you can redistribute it and/or modify
15 ** it under the terms of the GNU General Public License as published by
16 ** the Free Software Foundation, either version 3 of the License, or
17 ** (at your option) any later version.
18 **
19 ** Valentina is distributed in the hope that it will be useful,
20 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ** GNU General Public License for more details.
23 **
24 ** You should have received a copy of the GNU General Public License
25 ** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
26 **
27 *************************************************************************/
28
29 #ifndef VEXCEPTIONCONVERSIONERROR_H
30 #define VEXCEPTIONCONVERSIONERROR_H
31
32 #include <qcompilerdetection.h>
33 #include <QString>
34
35 #include "../ifcdef.h"
36 #include "vexception.h"
37
38 /**
39 * @brief The VExceptionConversionError class for exception of conversion error
40 */
41 class VExceptionConversionError : public VException
42 {
43 public:
44 VExceptionConversionError(const QString &error, const QString &str) V_NOEXCEPT_EXPR (true);
45 VExceptionConversionError(const VExceptionConversionError &e) V_NOEXCEPT_EXPR (true);
46 VExceptionConversionError &operator=(const VExceptionConversionError &e) V_NOEXCEPT_EXPR (true);
47 virtual ~VExceptionConversionError() V_NOEXCEPT_EXPR (true) Q_DECL_EQ_DEFAULT;
48
raise()49 Q_NORETURN virtual void raise() const override { throw *this; }
50
clone()51 Q_REQUIRED_RESULT virtual VExceptionConversionError *clone() const override
52 { return new VExceptionConversionError(*this); }
53
54 virtual QString ErrorMessage() const override;
55 QString String() const;
56 protected:
57 /** @brief str string, where happend error */
58 QString str;
59 };
60
61 //---------------------------------------------------------------------------------------------------------------------
62 /**
63 * @brief String return string, where happend error
64 * @return string
65 */
String()66 inline QString VExceptionConversionError::String() const
67 {
68 return str;
69 }
70
71 #endif // VEXCEPTIONCONVERSIONERROR_H
72