diff options
author | Kurt Zenker <kz@openoffice.org> | 2008-06-24 09:12:25 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2008-06-24 09:12:25 +0000 |
commit | bb9aae9e42cafb26c6764864b6eea9a5c38ecfbe (patch) | |
tree | 8b449f3030ee17ec22d06de863ca4f6dd1223bf2 | |
parent | abd0c71c35882e0fe3b80c48f4f723bb591c66c3 (diff) |
INTEGRATION: CWS canvas05 (1.6.112); FILE MERGED
2008/04/21 07:27:00 thb 1.6.112.2: RESYNC: (1.6-1.7); FILE MERGED
2007/10/01 13:02:00 thb 1.6.112.1: #i78888# #i78925# #i79258# #i79437# Merge from CWS picom
-rw-r--r-- | canvas/inc/canvas/debug.hxx | 99 |
1 files changed, 15 insertions, 84 deletions
diff --git a/canvas/inc/canvas/debug.hxx b/canvas/inc/canvas/debug.hxx index b838035d2ad9..8d1d0838a492 100644 --- a/canvas/inc/canvas/debug.hxx +++ b/canvas/inc/canvas/debug.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: debug.hxx,v $ - * $Revision: 1.7 $ + * $Revision: 1.8 $ * * This file is part of OpenOffice.org. * @@ -28,94 +28,25 @@ * ************************************************************************/ -#if ! defined(INCLUDED_CANVAS_DEBUG_HXX) +#ifndef INCLUDED_CANVAS_DEBUG_HXX #define INCLUDED_CANVAS_DEBUG_HXX -#include <osl/diagnose.h> -#include <rtl/ustring.hxx> -#include <com/sun/star/uno/RuntimeException.hpp> -#include <com/sun/star/lang/IllegalArgumentException.hpp> - -#include <boost/current_function.hpp> - -// Class invariants -// ---------------- -#if OSL_DEBUG_LEVEL > 0 - -/** This macro asserts the given condition, and throws an - IllegalArgumentException afterwards. - - In production code, no assertion appears, but the - IllegalArgumentException is thrown nevertheless (although without - the given error string, to conserve space). - */ -#define CHECK_AND_THROW(c, m) if( !(c) ) { \ - OSL_ENSURE(false, m); \ - throw ::com::sun::star::lang::IllegalArgumentException( \ - ::rtl::OUString::createFromAscii(BOOST_CURRENT_FUNCTION) + \ - ::rtl::OUString::createFromAscii(",\n"m), \ - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(), \ - 0 ); } - -/** This macro asserts the given condition, and throws an - RuntimeException afterwards. - - In production code, no assertion appears, but the - RuntimeException is thrown nevertheless (although without - the given error string, to conserve space). - */ -#define ENSURE_AND_THROW(c, m) if( !(c) ) { \ - OSL_ENSURE(false, m); \ - throw ::com::sun::star::uno::RuntimeException( \ - ::rtl::OUString::createFromAscii(BOOST_CURRENT_FUNCTION) + \ - ::rtl::OUString::createFromAscii(",\n"m), \ - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() ); } - -/** This macro asserts the given condition, and returns false - afterwards. - - In production code, no assertion appears, but the return is issued - nevertheless. - */ -#define ENSURE_AND_RETURN(c, m) if( !(c) ) { \ - OSL_ENSURE(false, m); \ - return false; } - -#else // ! (OSL_DEBUG_LEVEL > 0) - -#define CHECK_AND_THROW(c, m) if( !(c) ) \ - throw ::com::sun::star::lang::IllegalArgumentException( \ - ::rtl::OUString::createFromAscii(BOOST_CURRENT_FUNCTION) + \ - ::rtl::OUString::createFromAscii(",\n"m), \ - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(), \ - 0 ) - -#define ENSURE_AND_THROW(c, m) if( !(c) ) \ - throw ::com::sun::star::uno::RuntimeException( \ - ::rtl::OUString::createFromAscii(BOOST_CURRENT_FUNCTION) + \ - ::rtl::OUString::createFromAscii(",\n"m), \ - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() ) - -#define ENSURE_AND_RETURN(c, m) if( !(c) ) \ - return false - -#endif - - // shared_ptr debugging // -------------------- #ifdef BOOST_SP_ENABLE_DEBUG_HOOKS -#include <boost/shared_ptr.hpp> +# include <sal/config.h> +# include <boost/shared_ptr.hpp> ::std::size_t find_unreachable_objects( bool ); -#ifdef VERBOSE -#define SHARED_PTR_LEFTOVERS(a) OSL_TRACE( "%s\n%s: Unreachable objects still use %d bytes\n", \ - BOOST_CURRENT_FUNCTION, a, \ - find_unreachable_objects(true) ) -#else +# ifdef VERBOSE +# include <osl/diagnose.h> +# define SHARED_PTR_LEFTOVERS(a) OSL_TRACE("%s\n%s: Unreachable objects still use %d bytes\n", \ + BOOST_CURRENT_FUNCTION, a, \ + find_unreachable_objects(true) ) +# else /** This macro shows how much memory is still used by shared_ptrs Use this macro at places in the code where normally all shared_ptr @@ -123,14 +54,14 @@ still contained in those objects, which quite possibly are prevented from deletion by circular references. */ -#define SHARED_PTR_LEFTOVERS(a) OSL_TRACE( "%s\n%s: Unreachable objects still use %d bytes\n", \ - BOOST_CURRENT_FUNCTION, a, \ - find_unreachable_objects(false) ) -#endif +# define SHARED_PTR_LEFTOVERS(a) OSL_TRACE("%s\n%s: Unreachable objects still use %d bytes\n", \ + BOOST_CURRENT_FUNCTION, a, \ + find_unreachable_objects(false) ) +# endif #else -#define SHARED_PTR_LEFTOVERS(a) ((void)0) +# define SHARED_PTR_LEFTOVERS(a) ((void)0) #endif |