CuteHMI - CuteHMI (CuteHMI.2)
ErrorInfo.hpp
1 #ifndef H_EXTENSIONS_CUTEHMI_2_INCLUDE_CUTEHMI_ERRORINFO_HPP
2 #define H_EXTENSIONS_CUTEHMI_2_INCLUDE_CUTEHMI_ERRORINFO_HPP
3 
4 #include <QString>
5 
6 #include <typeinfo>
7 
8 #include "Error.hpp"
9 
10 namespace cutehmi {
11 
19 struct CUTEHMI_API ErrorInfo
20 {
21  int code;
22  const char * errClass;
24 
29  QString toString() const;
30 };
31 
37 template <typename ERR>
39 {
40  return ErrorInfo{err.code(), typeid(ERR).name(), err.str()};
41 }
42 
43 }
44 
45 Q_DECLARE_METATYPE(cutehmi::ErrorInfo)
46 
47 #endif
48 
49 //(c)C: Copyright © 2018-2019, Michał Policht <michal@policht.pl>. All rights reserved.
50 //(c)C: This file is a part of CuteHMI.
51 //(c)C: CuteHMI is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
52 //(c)C: CuteHMI 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 Lesser General Public License for more details.
53 //(c)C: You should have received a copy of the GNU Lesser General Public License along with CuteHMI. If not, see <https://www.gnu.org/licenses/>.
cutehmi::errorInfo
ErrorInfo errorInfo(ERR err)
Get error info.
Definition: ErrorInfo.hpp:38
cutehmi
Definition: constants.hpp:6
QString
cutehmi::ErrorInfo::code
int code
Error code.
Definition: ErrorInfo.hpp:21
cutehmi::ErrorInfo::str
QString str
Error string.
Definition: ErrorInfo.hpp:23
cutehmi::ErrorInfo
Error info.
Definition: ErrorInfo.hpp:19
cutehmi::ErrorInfo::errClass
const char * errClass
Error class.
Definition: ErrorInfo.hpp:22