From 69a4a545a556bd189736b3e510d4b4b07ae8cb6e Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Mon, 27 Apr 2009 11:42:05 +0000 Subject: #i48179# Debug: added descriptive strings to events. --- slideshow/source/inc/delayevent.hxx | 69 +++++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 18 deletions(-) (limited to 'slideshow/source/inc/delayevent.hxx') diff --git a/slideshow/source/inc/delayevent.hxx b/slideshow/source/inc/delayevent.hxx index 29ef713f6550..458d5f9c0a0e 100644 --- a/slideshow/source/inc/delayevent.hxx +++ b/slideshow/source/inc/delayevent.hxx @@ -31,6 +31,7 @@ #define INCLUDED_SLIDESHOW_DELAYEVENT_HXX #include "event.hxx" +#include "debug.hxx" #include #include #if defined(VERBOSE) && defined(DBG_UTIL) @@ -48,16 +49,23 @@ public: typedef ::boost::function0 FunctorT; template - Delay( FuncT const& func, double nTimeout ) - : mnTimeout(nTimeout), maFunc(func), mbWasFired(false) {} + Delay( FuncT const& func, + double nTimeout +#if OSL_DEBUG_LEVEL > 1 && defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS) + , const ::rtl::OUString& rsDescription + ) : Event(rsDescription), +#else + ) : +#endif + mnTimeout(nTimeout), maFunc(func), mbWasFired(false) {} -#if defined(VERBOSE) && defined(DBG_UTIL) Delay( const boost::function0& func, - double nTimeout, - char const* const ) : + double nTimeout +#if OSL_DEBUG_LEVEL > 1 && defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS) + , const ::rtl::OUString& rsDescription + ) : Event(rsDescription), #else - Delay( const boost::function0& func, - double nTimeout ) : + ) : #endif mnTimeout(nTimeout), maFunc(func), @@ -76,7 +84,7 @@ private: bool mbWasFired; }; -#if OSL_DEBUG_LEVEL < 1 +#if OSL_DEBUG_LEVEL <= 1 /** Generate delay event @@ -89,7 +97,7 @@ private: @return generated delay event */ template -inline EventSharedPtr makeDelay( FuncT const& func, double nTimeout ) +inline EventSharedPtr makeDelay_( FuncT const& func, double nTimeout ) { return EventSharedPtr( new Delay( func, nTimeout ) ); } @@ -102,19 +110,29 @@ inline EventSharedPtr makeDelay( FuncT const& func, double nTimeout ) @return generated immediate event. */ template -inline EventSharedPtr makeEvent( FuncT const& func ) +inline EventSharedPtr makeEvent_( FuncT const& func ) { return EventSharedPtr( new Delay( func, 0.0 ) ); } + +// Strip away description. +#define makeDelay(f, t, d) makeDelay_(f, t) +#define makeEvent(f, d) makeEvent_(f) + #else // OSL_DEBUG_LEVEL > 1 class Delay_ : public Delay { public: template Delay_( FuncT const& func, double nTimeout, - char const* from_function, char const* from_file, int from_line ) - : Delay(func, nTimeout), + char const* from_function, char const* from_file, int from_line, + const ::rtl::OUString& rsDescription ) + : Delay(func, nTimeout +#if defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS) + , rsDescription +#endif + ), FROM_FUNCTION(from_function), FROM_FILE(from_file), FROM_LINE(from_line) {} @@ -126,16 +144,31 @@ public: template inline EventSharedPtr makeDelay_( FuncT const& func, double nTimeout, - char const* from_function, char const* from_file, int from_line ) + char const* from_function, char const* from_file, int from_line, + const ::rtl::OUString& rsDescription ) { return EventSharedPtr( new Delay_( func, nTimeout, - from_function, from_file, from_line ) ); + from_function, from_file, from_line, rsDescription ) ); } -#define makeDelay(f, t) makeDelay_(f, t, \ -BOOST_CURRENT_FUNCTION, __FILE__, __LINE__) -#define makeEvent(f) makeDelay_(f, 0.0, \ -BOOST_CURRENT_FUNCTION, __FILE__, __LINE__) +#if defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS) + +#define makeDelay(f, t, d) makeDelay_(f, t, \ + BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, \ + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(d))) +#define makeEvent(f, d) makeDelay_(f, 0.0, \ + BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, \ + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(d))) + +#else + +#define makeDelay(f, t, d) makeDelay_(f, t, \ + BOOST_CURRENT_FUNCTION, __FILE__, __LINE__) +#define makeEvent(f, d) makeDelay_(f, 0.0, \ + BOOST_CURRENT_FUNCTION, __FILE__, __LINE__) + +#endif + #endif // OSL_DEBUG_LEVEL < 1 -- cgit From 11a2f378b1111e0d51e294fade2133c7563c359f Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Wed, 6 May 2009 08:16:59 +0000 Subject: #i48179# Improved/fixed debugging code. --- slideshow/source/inc/delayevent.hxx | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'slideshow/source/inc/delayevent.hxx') diff --git a/slideshow/source/inc/delayevent.hxx b/slideshow/source/inc/delayevent.hxx index 458d5f9c0a0e..ba06bffa95ec 100644 --- a/slideshow/source/inc/delayevent.hxx +++ b/slideshow/source/inc/delayevent.hxx @@ -51,7 +51,7 @@ public: template Delay( FuncT const& func, double nTimeout -#if OSL_DEBUG_LEVEL > 1 && defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS) +#if OSL_DEBUG_LEVEL > 1 , const ::rtl::OUString& rsDescription ) : Event(rsDescription), #else @@ -61,7 +61,7 @@ public: Delay( const boost::function0& func, double nTimeout -#if OSL_DEBUG_LEVEL > 1 && defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS) +#if OSL_DEBUG_LEVEL > 1 , const ::rtl::OUString& rsDescription ) : Event(rsDescription), #else @@ -127,12 +127,8 @@ public: template Delay_( FuncT const& func, double nTimeout, char const* from_function, char const* from_file, int from_line, - const ::rtl::OUString& rsDescription ) - : Delay(func, nTimeout -#if defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS) - , rsDescription -#endif - ), + const ::rtl::OUString& rsDescription) + : Delay(func, nTimeout, rsDescription), FROM_FUNCTION(from_function), FROM_FILE(from_file), FROM_LINE(from_line) {} @@ -145,14 +141,12 @@ template inline EventSharedPtr makeDelay_( FuncT const& func, double nTimeout, char const* from_function, char const* from_file, int from_line, - const ::rtl::OUString& rsDescription ) + const ::rtl::OUString& rsDescription) { return EventSharedPtr( new Delay_( func, nTimeout, - from_function, from_file, from_line, rsDescription ) ); + from_function, from_file, from_line, rsDescription) ); } -#if defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS) - #define makeDelay(f, t, d) makeDelay_(f, t, \ BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, \ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(d))) @@ -160,17 +154,7 @@ inline EventSharedPtr makeDelay_( BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, \ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(d))) -#else - -#define makeDelay(f, t, d) makeDelay_(f, t, \ - BOOST_CURRENT_FUNCTION, __FILE__, __LINE__) -#define makeEvent(f, d) makeDelay_(f, 0.0, \ - BOOST_CURRENT_FUNCTION, __FILE__, __LINE__) - -#endif - - -#endif // OSL_DEBUG_LEVEL < 1 +#endif // OSL_DEBUG_LEVEL <= 1 } // namespace internal } // namespace presentation -- cgit