Kross
errorinterface.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KROSS_ERRORINTERFACE_H
00021 #define KROSS_ERRORINTERFACE_H
00022
00023 #include "krossconfig.h"
00024
00025 #include <QtCore/QString>
00026
00027 namespace Kross {
00028
00032 class KROSSCORE_EXPORT ErrorInterface
00033 {
00034 public:
00035
00043 ErrorInterface() {}
00044
00048 bool hadError() const { return ! m_error.isNull(); }
00049
00053 const QString errorMessage() const { return m_error; }
00054
00058 const QString errorTrace() const { return m_trace; }
00059
00064 long errorLineNo() const { return m_lineno; }
00065
00069 void setError(const QString& errormessage, const QString& tracemessage = QString(), long lineno = -1) {
00070 m_error = errormessage;
00071 m_trace = tracemessage;
00072 m_lineno = lineno;
00073 krosswarning( QString::fromLatin1("Error error=%1 lineno=%2 trace=\n%3").arg(m_error).arg(m_lineno).arg(m_trace) );
00074 }
00075
00079 void setError(ErrorInterface* error) {
00080 m_error = error->errorMessage();
00081 m_trace = error->errorTrace();
00082 m_lineno = error->errorLineNo();
00083 }
00084
00088 void clearError() {
00089 m_error.clear();
00090 m_trace.clear();
00091 m_lineno = -1;
00092 }
00093
00094 private:
00096 QString m_error;
00098 QString m_trace;
00100 long m_lineno;
00101 };
00102
00103 }
00104
00105 #endif
00106