summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2008-06-24 10:57:11 +0000
committerKurt Zenker <kz@openoffice.org>2008-06-24 10:57:11 +0000
commit0907dfd7e00da69b60f7610d7fc16cb98f898da2 (patch)
tree81a4134622d208fd18dbfbd8308863274cfecac6 /tools
parent8a7a284e9e8e89dc7b284373f5e1bcaab1cda21c (diff)
INTEGRATION: CWS canvas05 (1.2.74); FILE MERGED
2008/04/21 07:51:52 thb 1.2.74.3: RESYNC: (1.3-1.4); FILE MERGED 2008/04/07 14:41:04 thb 1.2.74.2: RESYNC: (1.2-1.3); FILE MERGED 2007/10/01 13:45:51 thb 1.2.74.1: #i79258# Merge from CWS picom
Diffstat (limited to 'tools')
-rw-r--r--tools/inc/tools/diagnose_ex.h55
1 files changed, 54 insertions, 1 deletions
diff --git a/tools/inc/tools/diagnose_ex.h b/tools/inc/tools/diagnose_ex.h
index 930a5bc5e2d9..5ca7a71cf62c 100644
--- a/tools/inc/tools/diagnose_ex.h
+++ b/tools/inc/tools/diagnose_ex.h
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: diagnose_ex.h,v $
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
* This file is part of OpenOffice.org.
*
@@ -31,6 +31,15 @@
#ifndef TOOLS_DIAGNOSE_EX_H
#define TOOLS_DIAGNOSE_EX_H
+#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>
+
+
#define OSL_UNUSED( expression ) \
(void)(expression)
@@ -76,4 +85,48 @@
#endif // OSL_DEBUG_LEVEL
+
+/** This macro asserts the given condition (in debug mode), and throws
+ an IllegalArgumentException afterwards.
+ */
+#define ENSURE_ARG_OR_THROW(c, m) if( !(c) ) { \
+ OSL_ENSURE(c, 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 ); }
+#define ENSURE_ARG_OR_THROW2(c, m, ifc, arg) if( !(c) ) { \
+ OSL_ENSURE(c, m); \
+ throw ::com::sun::star::lang::IllegalArgumentException( \
+ ::rtl::OUString::createFromAscii(BOOST_CURRENT_FUNCTION) + \
+ ::rtl::OUString::createFromAscii(",\n"m), \
+ ifc, \
+ arg ); }
+
+/** This macro asserts the given condition (in debug mode), and throws
+ an RuntimeException afterwards.
+ */
+#define ENSURE_OR_THROW(c, m) if( !(c) ) { \
+ OSL_ENSURE(c, 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 >() ); }
+#define ENSURE_OR_THROW2(c, m, ifc) if( !(c) ) { \
+ OSL_ENSURE(c, m); \
+ throw ::com::sun::star::uno::RuntimeException( \
+ ::rtl::OUString::createFromAscii(BOOST_CURRENT_FUNCTION) + \
+ ::rtl::OUString::createFromAscii(",\n"m), \
+ ifc ); }
+
+/** This macro asserts the given condition (in debug mode), and
+ returns false afterwards.
+ */
+#define ENSURE_OR_RETURN(c, m) if( !(c) ) { \
+ OSL_ENSURE(c, m); \
+ return false; }
+
+
+
#endif // TOOLS_DIAGNOSE_EX_H