kmobiletools
baseerror.cpp
Go to the documentation of this file.00001 /*************************************************************************** 00002 Copyright (C) 2007 by Matthias Lechner <matthias@lmme.de> 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the 00016 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 ***************************************************************************/ 00019 00020 #include "baseerror.h" 00021 #include <KLocale> 00022 00023 00024 namespace KMobileTools { 00025 00026 class BaseErrorPrivate { 00027 public: 00028 QString m_fileName; 00029 int m_lineNumber; 00030 QDateTime m_dateTime; 00031 QString m_methodName; 00032 DebugHash m_customDebugInformation; 00033 00034 BaseError::Priority m_priority; 00035 QString m_description; 00036 }; 00037 00038 BaseError::BaseError( const QString& fileName, int lineNumber, const QDateTime& dateTime, 00039 const QString& methodName, const DebugHash& customDebugInformation ) 00040 : d ( new BaseErrorPrivate ) 00041 { 00042 00043 d->m_fileName = fileName; 00044 d->m_lineNumber = lineNumber; 00045 d->m_dateTime = dateTime; 00046 d->m_methodName = methodName; 00047 d->m_customDebugInformation = customDebugInformation; 00048 00049 d->m_priority = High; 00050 d->m_description = i18n("No error description available."); 00051 } 00052 00053 00054 BaseError::~BaseError() { 00055 delete d; 00056 } 00057 00058 bool BaseError::operator==( const BaseError& error ) const { 00059 if( error.fileName() == d->m_fileName && 00060 error.lineNumber() == d->m_lineNumber && 00061 error.dateTime() == d->m_dateTime ) 00062 return true; 00063 00064 return false; 00065 } 00066 00067 bool BaseError::operator!=( const BaseError& error ) const { 00068 if( error.fileName() == d->m_fileName && 00069 error.lineNumber() == d->m_lineNumber && 00070 error.dateTime() == d->m_dateTime ) 00071 return false; 00072 00073 return true; 00074 } 00075 00076 BaseError::Priority BaseError::priority() const { 00077 return d->m_priority; 00078 } 00079 00080 QString BaseError::fileName() const { 00081 return d->m_fileName; 00082 } 00083 00084 int BaseError::lineNumber() const { 00085 return d->m_lineNumber; 00086 } 00087 00088 QDateTime BaseError::dateTime() const { 00089 return d->m_dateTime; 00090 } 00091 00092 QString BaseError::methodName() const { 00093 return d->m_methodName; 00094 } 00095 00096 QString BaseError::description() const { 00097 return d->m_description; 00098 } 00099 00100 DebugHash BaseError::customDebugInformation() const { 00101 return d->m_customDebugInformation; 00102 } 00103 00104 void BaseError::setPriority( Priority priority ) { 00105 d->m_priority = priority; 00106 } 00107 00108 void BaseError::setDescription( const QString& errorDescription ) { 00109 d->m_description = errorDescription; 00110 } 00111 00112 }
KDE 4.2 API Reference