KCal Library
kresult.h
Go to the documentation of this file.
00001 /* 00002 This file is part of KDE. 00003 00004 Copyright (c) 2005 Cornelius Schumacher <schumacher@kde.org> 00005 00006 This library 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 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00028 #ifndef KRESULT_H 00029 #define KRESULT_H 00030 00031 #include <QtCore/QString> 00032 #include "kcal_export.h" 00033 00034 namespace KCal { 00035 00109 class KCAL_EXPORT_DEPRECATED KResult 00110 { 00111 public: 00115 enum Type { 00116 Ok, 00117 InProgress, 00118 Error 00119 }; 00120 00124 enum ErrorType { 00125 NotAnError, 00126 Undefined, 00127 InvalidUrl, 00128 WrongParameter, 00129 ConnectionFailed, 00130 WriteError, 00131 ReadError, 00132 ParseError, 00133 WrongSchemaRevision 00134 }; 00135 00139 KResult(); 00140 00144 KResult( const KResult & ); 00145 00150 explicit KResult( Type type ); 00151 00159 explicit KResult( ErrorType error, const QString &details = QString() ); 00160 00164 ~KResult(); 00165 00171 operator bool() const; 00172 00176 bool isOk() const; 00177 00181 bool isInProgress() const; 00182 00186 bool isError() const; 00187 00191 ErrorType error() const; 00192 00198 QString message() const; 00199 00210 void setDetails( const QString &details ); 00211 00216 QString details() const; 00217 00222 QString fullMessage() const; 00223 00230 KResult &chain( const KResult &result ); 00231 00236 bool hasChainedResult() const; 00237 00241 KResult chainedResult() const; 00242 00247 QString chainedMessage() const; 00248 00249 private: 00250 //@cond PRIVATE 00251 class Private; 00252 Private *const d; 00253 //@endcond 00254 }; 00255 00260 class KCAL_EXPORT_DEPRECATED KResultOk : public KResult 00261 { 00262 public: 00266 KResultOk() : KResult( Ok ), d( 0 ) {} 00267 00268 private: 00269 //@cond PRIVATE 00270 class Private; 00271 Private *const d; 00272 //@endcond 00273 }; 00274 00279 class KCAL_EXPORT_DEPRECATED KResultInProgress : public KResult 00280 { 00281 public: 00285 KResultInProgress() : KResult( InProgress ), d( 0 ) {} 00286 00287 private: 00288 //@cond PRIVATE 00289 class Private; 00290 Private *const d; 00291 //@endcond 00292 }; 00293 00298 class KCAL_EXPORT_DEPRECATED KResultError : public KResult 00299 { 00300 public: 00304 KResultError() : KResult( Error ), d( 0 ) {} 00305 00314 explicit KResultError( ErrorType error, const QString &details = QString() ) 00315 : KResult( error, details ), d( 0 ) {} 00316 00323 KResultError( const QString &details ) : 00324 KResult( Undefined, details ), d( 0 ) {} 00325 00326 private: 00327 //@cond PRIVATE 00328 Q_DISABLE_COPY( KResultError ) 00329 class Private; 00330 Private *const d; 00331 //@endcond PRIVATE 00332 }; 00333 00334 } 00335 00336 #endif