Warning, file /office/alkimia/src/alkexception.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2000-2018 Thomas Baumgart tbaumgart @kde.org 0003 0004 This file is part of libalkimia. 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef ALKEXCEPTION_H 0010 #define ALKEXCEPTION_H 0011 0012 #include <alkimia/alk_export.h> 0013 0014 #include <QString> 0015 0016 /** 0017 * @file 0018 * @author Thomas Baumgart 0019 */ 0020 0021 /** 0022 * This class describes an exception that is thrown by the engine 0023 * in case of a failure. 0024 */ 0025 class ALK_NO_EXPORT AlkException 0026 { 0027 public: 0028 0029 /** 0030 * @def ALKEXCEPTION(text) 0031 * This is the preferred constructor to create a new exception 0032 * object. It automatically inserts the filename and the source 0033 * code line into the object upon creation. 0034 * 0035 * It is equivalent to AlkException(text, __FILE__, __LINE__) 0036 */ 0037 #define ALKEXCEPTION(what) AlkException(what, __FILE__, __LINE__) 0038 0039 /** 0040 * The constructor to create a new ALKEXCEPTION object. 0041 * 0042 * @param msg reference to QString containing the message 0043 * @param file reference to QString containing the name of the sourcefile where 0044 * the exception was thrown 0045 * @param line unsigned long containing the line number of the line where 0046 * the exception was thrown in the file. 0047 * 0048 * An easier way to use this constructor is to use the macro 0049 * ALKEXCEPTION(text) instead. It automatically assigns the file 0050 * and line parameter to the correct values. 0051 */ 0052 AlkException(const QString &msg, const QString &file, const unsigned long line); 0053 0054 ~AlkException(); 0055 0056 /** 0057 * This method is used to return the message that was passed 0058 * during the creation of the exception object. 0059 * 0060 * @return reference to QString containing the message 0061 */ 0062 const QString &what() const 0063 { 0064 return m_msg; 0065 } 0066 0067 /** 0068 * This method is used to return the filename that was passed 0069 * during the creation of the exception object. 0070 * 0071 * @return reference to QString containing the filename 0072 */ 0073 const QString &file() const 0074 { 0075 return m_file; 0076 } 0077 0078 /** 0079 * This method is used to return the linenumber that was passed 0080 * during the creation of the exception object. 0081 * 0082 * @return long integer containing the line number 0083 */ 0084 unsigned long line() const 0085 { 0086 return m_line; 0087 } 0088 0089 private: 0090 /** 0091 * This member variable holds the message 0092 */ 0093 QString m_msg; 0094 0095 /** 0096 * This member variable holds the filename 0097 */ 0098 QString m_file; 0099 0100 /** 0101 * This member variable holds the line number 0102 */ 0103 unsigned long m_line; 0104 }; 0105 0106 #endif