diff options
Diffstat (limited to 'src/w32dlib/base.h')
-rw-r--r-- | src/w32dlib/base.h | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/w32dlib/base.h b/src/w32dlib/base.h index e4796ca..639c368 100644 --- a/src/w32dlib/base.h +++ b/src/w32dlib/base.h @@ -60,9 +60,9 @@ typedef BOOL (Window::*W32DLibCallback) (UINT msg, WPARAM wp, LPARAM lp); #define W32DEBUGOUT(x) \ do \ { \ - std::ostringstream s; \ - s << __FUNCTION__ << "(" << __FILE__ << "): " << x; \ - OutputDebugString(s.str().c_str()); \ + std::ostringstream str; \ + str << x; \ + W32Debug(__FUNCTION__,__FILE__,str.str().c_str()); \ } while(0) #else @@ -83,6 +83,26 @@ typedef BOOL (Window::*W32DLibCallback) (UINT msg, WPARAM wp, LPARAM lp); const char *MsgName(UINT msg); +/// \brief Logs debug output. +/// +/// Only available in debug builds -- does nothing otherwise. +/// +/// \param func The function it was called from. +/// \param file The file it was called from. +/// \param msg The debug message. +/// +void W32Debug(const char *func, const char *file, const char *msg); + + +/// \brief Encodes string so they appear C-like. +/// +/// Used in debug build to dump strings. +/// +/// \param p The string to encode. +/// \return The encoded string. +/// +std::string EncodeCString(const char *p); + }; |