Update ooo320-m1
[ooovba.git] / sw / inc / errhdl.hxx
blob646c1dab7f8514057a601a5d80678e8764bb7831
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: errhdl.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _ERRHDL_HXX
31 #define _ERRHDL_HXX
33 #ifndef PRODUCT
35 #include <tools/solar.h>
36 #include <sal/types.h>
37 #include "swdllapi.h"
39 extern BOOL bAssert; // TRUE, wenn eine ASSERT-Box hochkam
42 // -----------------------------------------------------------------------
43 // Ausgabe einer Fehlermeldung inkl. Dateiname und Zeilennummer
44 // wo der Fehler auftrat.
45 // Die Funktion darf nicht direkt benutzt werden!
46 // -----------------------------------------------------------------------
47 SW_DLLPUBLIC void AssertFail( const sal_Char*, const sal_Char*, USHORT );
48 SW_DLLPUBLIC void AssertFail( USHORT, const sal_Char*, USHORT );
50 #define ASSERT( cond, message ) \
51 if( !(cond) ) { \
52 const char *_pErrorText = #message; \
53 const char *_pFileName = __FILE__; \
54 ::AssertFail( _pErrorText, _pFileName, __LINE__ ); \
57 // -----------------------------------------------------------------------
58 // Prueft ob die angegebene Bedingung wahr ist, wenn nicht wird eine
59 // Fehlermeldung die ueber die ID Identifiziert wird, ausgegeben.
60 // -----------------------------------------------------------------------
61 #define ASSERT_ID( cond, id ) \
62 if( !(cond) ) { \
63 const char *_pFileName = __FILE__; \
64 ::AssertFail( (USHORT)id, _pFileName, __LINE__ ); \
68 // -----------------------------------------------------------------------
69 // Beim Bilden der Produktversion werden alle Debug-Utilities automatisch
70 // ignoriert
71 // -----------------------------------------------------------------------
72 #else
73 #define ASSERT( cond, message ) ;
74 #define ASSERT_ID( cond, id ) ;
75 #endif // PRODUCT
79 #endif