1 /****************************************************************************
3 ** Copyright (C) Qxt Foundation. Some rights reserved.
5 ** This file is part of the QxtCore module of the Qt eXTension library
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
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.
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.
21 ** <http://libqxt.sourceforge.net> <foundation@libqxt.org>
23 ****************************************************************************/
29 #include <qxtglobal.h>
30 #include <qxtnamespace.h>
33 \class QxtError QxtError
37 \brief Information about Errors ocuring inside Qxt
42 droping an error inside a function that returns QxtError
45 short for return QxtError(__FILE__,__LINE__,x);
47 #define QXT_DROP(x) return QxtError(__FILE__,__LINE__,x);
51 droping an error inside a function that returns QxtError
53 aditionaly specifies an errorstring \n
55 short for return QxtError(__FILE__,__LINE__,x,s);
57 #define QXT_DROP_S(x,s) return QxtError(__FILE__,__LINE__,x,s);
61 droping no error inside a function that returns QxtError
63 short for return QxtError(__FILE__,__LINE__,Qxt::NoError);
65 #define QXT_DROP_OK return QxtError(__FILE__,__LINE__,Qxt::NoError);
72 drops from this function if the call inside dropped too.
73 the inner function must return or be a QxtError.
77 QXT_DROP_F(critical_function());
81 #define QXT_DROP_F(call) {QxtError error_sds = call; if (error_sds != Qxt::NoError ) return error_sds; else (void)0; }
88 QXT_DROP_SCOPE(error,critical_function())
95 short for QxtError name = call; if (name != Qxt::NoError )
97 \warning: the errors name is valid outside the scope
99 #define QXT_DROP_SCOPE(name,call) QxtError name = call; if (name != Qxt::NoError )
106 class QXT_CORE_EXPORT QxtError
109 QxtError(const char * file, long line, Qxt::ErrorCode errorcode, const char * errorString=0);
110 Qxt::ErrorCode errorCode() const;
112 const char * file() const;
113 const char * errorString() const;
114 operator Qxt::ErrorCode();
118 Qxt::ErrorCode errorcode_m;
121 const char * errorString_m;