KCal Library
kresult.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
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 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
00251 class Private;
00252 Private *const d;
00253
00254 };
00255
00260 class KCAL_EXPORT KResultOk : public KResult
00261 {
00262 public:
00266 KResultOk() : KResult( Ok ), d( 0 ) {}
00267
00268 private:
00269
00270 class Private;
00271 Private *const d;
00272
00273 };
00274
00279 class KCAL_EXPORT KResultInProgress : public KResult
00280 {
00281 public:
00285 KResultInProgress() : KResult( InProgress ), d( 0 ) {}
00286
00287 private:
00288
00289 class Private;
00290 Private *const d;
00291
00292 };
00293
00298 class KCAL_EXPORT 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
00328 Q_DISABLE_COPY( KResultError )
00329 class Private;
00330 Private *const d;
00331
00332 };
00333
00334 }
00335
00336 #endif