F:/KPlato/koffice/libs/kross/core/errorinterface.h

Aller à la documentation de ce fichier.
00001 /***************************************************************************
00002  * errorinterface.h
00003  * This file is part of the KDE project
00004  * copyright (C)2004-2006 by Sebastian Sauer (mail@dipe.org)
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this program; see the file COPYING.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  ***************************************************************************/
00019 
00020 #ifndef KROSS_ERRORINTERFACE_H
00021 #define KROSS_ERRORINTERFACE_H
00022 
00023 #include <QString>
00024 #include <koffice_export.h>
00025 
00026 #include "krossconfig.h"
00027 
00028 namespace Kross {
00029 
00033     class KROSSCORE_EXPORT ErrorInterface
00034     {
00035         public:
00036 
00044             ErrorInterface() {}
00045 
00049             bool hadError() const { return ! m_error.isNull(); }
00050 
00054             const QString errorMessage() const { return m_error; }
00055 
00059             const QString errorTrace() const { return m_trace; }
00060 
00065             long errorLineNo() const { return m_lineno; }
00066 
00070             void setError(const QString& errormessage, const QString& tracemessage = QString::null, long lineno = -1) {
00071                 m_error = errormessage;
00072                 m_trace = tracemessage;
00073                 m_lineno = lineno;
00074                 krosswarning( QString("Error error=%1 lineno=%2 trace=\n%3").arg(m_error).arg(m_lineno).arg(m_trace) );
00075             }
00076 
00080             void setError(ErrorInterface* error) {
00081                 m_error = error->errorMessage();
00082                 m_trace = error->errorTrace();
00083                 m_lineno = error->errorLineNo();
00084             }
00085 
00089             void clearError() {
00090                 m_error = QString::null;
00091                 m_trace = QString::null;
00092                 m_lineno = -1;
00093             }
00094 
00095         private:
00097             QString m_error;
00099             QString m_trace;
00101             long m_lineno;
00102     };
00103 
00104 }
00105 
00106 #endif
00107 

Généré le Wed Nov 22 23:41:11 2006 pour KPlato par  doxygen 1.5.1-p1