Ok, the long awaited config wizard is here (at least in a very basic state). There...
[quassel.git] / src / contrib / libqxt-2007-10-24 / src / core / qxterror.h
1 /****************************************************************************
2 **
3 ** Copyright (C) Qxt Foundation. Some rights reserved.
4 **
5 ** This file is part of the QxtCore module of the Qt eXTension library
6 **
7 ** This library is free software; you can redistribute it and/or modify it
8 ** under the terms of th Common Public License, version 1.0, as published by
9 ** IBM.
10 **
11 ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
12 ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
13 ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
14 ** FITNESS FOR A PARTICULAR PURPOSE.
15 **
16 ** You should have received a copy of the CPL along with this file.
17 ** See the LICENSE file and the cpl1.0.txt file included with the source
18 ** distribution for more information. If you did not receive a copy of the
19 ** license, contact the Qxt Foundation.
20 **
21 ** <http://libqxt.sourceforge.net>  <foundation@libqxt.org>
22 **
23 ****************************************************************************/
24
25
26
27 #ifndef QXTERROR_H
28 #define QXTERROR_H
29 #include <qxtglobal.h>
30 #include <qxtnamespace.h>
31
32 /**
33 \class QxtError QxtError
34
35 \ingroup QxtCore
36
37 \brief Information about Errors ocuring inside Qxt
38
39 */
40
41 /*! \relates QxtError
42 droping an error inside a function that returns QxtError
43
44
45 short for return  QxtError(__FILE__,__LINE__,x);
46 */
47 #define QXT_DROP(x) return QxtError(__FILE__,__LINE__,x);
48
49
50 /*! \relates QxtError
51 droping an error inside a function that returns QxtError
52
53 aditionaly specifies an errorstring \n
54
55 short for return  QxtError(__FILE__,__LINE__,x,s);
56 */
57 #define QXT_DROP_S(x,s) return QxtError(__FILE__,__LINE__,x,s);
58
59
60 /*! \relates QxtError
61 droping no error inside a function that returns QxtError
62
63 short for return QxtError(__FILE__,__LINE__,Qxt::NoError);
64 */
65 #define QXT_DROP_OK return QxtError(__FILE__,__LINE__,Qxt::NoError);
66
67
68 /*! \relates QxtError
69 forward a drop
70
71
72 drops from this function if the call inside dropped too.
73 the inner function must return or be a QxtError.
74
75 example
76 \code
77 QXT_DROP_F(critical_function());
78 \endcode
79
80 */
81 #define QXT_DROP_F(call) {QxtError error_sds = call; if (error_sds != Qxt::NoError ) return error_sds; else (void)0; }
82
83 /*! \relates QxtError
84 check for errors
85
86 example
87 \code
88 QXT_DROP_SCOPE(error,critical_function())
89         {
90         qDebug()<<error;
91         QXT_DROP_F(error);
92         };
93 \endcode
94
95 short for  QxtError name = call; if (name != Qxt::NoError )
96
97 \warning: the errors name is valid outside the scope
98 */
99 #define QXT_DROP_SCOPE(name,call) QxtError name = call; if (name != Qxt::NoError )
100
101
102
103
104
105
106 class QXT_CORE_EXPORT QxtError
107 {
108 public:
109     QxtError(const char * file, long line, Qxt::ErrorCode errorcode, const char * errorString=0);
110     Qxt::ErrorCode errorCode() const;
111     long line() const;
112     const char * file() const;
113     const char * errorString() const;
114     operator Qxt::ErrorCode();
115
116
117 private:
118     Qxt::ErrorCode errorcode_m;
119     long line_m;
120     const char * file_m;
121     const char * errorString_m;
122 };
123
124 #endif