X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d1b20379e45636461e4aa45e5263fb3d9a4956a8..defbed48e78f4e84b35f62c2c1b7fd58d740501c:/include/wx/log.h diff --git a/include/wx/log.h b/include/wx/log.h index 8dda8c390a..4ceeace557 100644 --- a/include/wx/log.h +++ b/include/wx/log.h @@ -18,25 +18,29 @@ #include "wx/defs.h" -#if wxUSE_LOG - -#include "wx/string.h" -#include "wx/arrstr.h" - // ---------------------------------------------------------------------------- -// forward declarations +// common constants for use in wxUSE_LOG/!wxUSE_LOG // ---------------------------------------------------------------------------- -#if wxUSE_GUI - class WXDLLIMPEXP_CORE wxTextCtrl; - class WXDLLIMPEXP_CORE wxLogFrame; - class WXDLLIMPEXP_CORE wxFrame; -#endif // wxUSE_GUI +// the trace masks have been superceded by symbolic trace constants, they're +// for compatibility only andwill be removed soon - do NOT use them + +// meaning of different bits of the trace mask (which allows selectively +// enable/disable some trace messages) +#define wxTraceMemAlloc 0x0001 // trace memory allocation (new/delete) +#define wxTraceMessages 0x0002 // trace window messages/X callbacks +#define wxTraceResAlloc 0x0004 // trace GDI resource allocation +#define wxTraceRefCount 0x0008 // trace various ref counting operations + +#ifdef __WXMSW__ + #define wxTraceOleCalls 0x0100 // OLE interface calls +#endif // ---------------------------------------------------------------------------- // types // ---------------------------------------------------------------------------- +// NB: these types are needed even if wxUSE_LOG == 0 typedef unsigned long wxTraceMask; typedef unsigned long wxLogLevel; @@ -44,8 +48,14 @@ typedef unsigned long wxLogLevel; // headers // ---------------------------------------------------------------------------- +#include "wx/string.h" + +#if wxUSE_LOG + +#include "wx/arrstr.h" + #ifndef __WXWINCE__ -#include // for time_t + #include // for time_t #endif #include "wx/dynarray.h" @@ -58,6 +68,17 @@ typedef unsigned long wxLogLevel; # endif #endif +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +#if wxUSE_GUI + class WXDLLIMPEXP_CORE wxTextCtrl; + class WXDLLIMPEXP_CORE wxLogFrame; + class WXDLLIMPEXP_CORE wxFrame; + class WXDLLIMPEXP_CORE wxWindow; +#endif // wxUSE_GUI + // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- @@ -91,20 +112,6 @@ enum #define wxTRACE_OleCalls wxT("ole") // OLE interface calls #endif -// the trace masks have been superceded by symbolic trace constants, they're -// for compatibility only andwill be removed soon - do NOT use them - -// meaning of different bits of the trace mask (which allows selectively -// enable/disable some trace messages) -#define wxTraceMemAlloc 0x0001 // trace memory allocation (new/delete) -#define wxTraceMessages 0x0002 // trace window messages/X callbacks -#define wxTraceResAlloc 0x0004 // trace GDI resource allocation -#define wxTraceRefCount 0x0008 // trace various ref counting operations - -#ifdef __WXMSW__ - #define wxTraceOleCalls 0x0100 // OLE interface calls -#endif - #include "wx/iosfwrap.h" // ---------------------------------------------------------------------------- @@ -116,7 +123,7 @@ class WXDLLIMPEXP_BASE wxLog { public: // ctor - wxLog(); + wxLog(){} // Internal buffer. @@ -442,9 +449,6 @@ extern void expdecl wxVLog##level(arg, const wxChar *szFormat, \ va_list argptr); \ extern void expdecl wxLog##level(arg, const wxChar *szFormat, \ ...) ATTRIBUTE_PRINTF_2 -#define DECLARE_LOG_FUNCTION2(level, arg) \ - DECLARE_LOG_FUNCTION2_EXP(level, arg, WXDLLIMPEXP_BASE) - #else // !wxUSE_LOG // log functions do nothing at all @@ -452,7 +456,7 @@ extern void expdecl wxLog##level(arg, const wxChar *szFormat, \ inline void wxVLog##level(const wxChar *szFormat, \ va_list argptr) { } \ inline void wxLog##level(const wxChar *szFormat, ...) { } -#define DECLARE_LOG_FUNCTION2(level, arg) \ +#define DECLARE_LOG_FUNCTION2_EXP(level, arg, expdecl) \ inline void wxVLog##level(arg, const wxChar *szFormat, \ va_list argptr) {} \ inline void wxLog##level(arg, const wxChar *szFormat, ...) { } @@ -472,6 +476,9 @@ public: #define wxTRACE_OleCalls wxEmptyString // OLE interface calls #endif // wxUSE_LOG/!wxUSE_LOG +#define DECLARE_LOG_FUNCTION2(level, arg) \ + DECLARE_LOG_FUNCTION2_EXP(level, arg, WXDLLIMPEXP_BASE) + // a generic function for all levels (level is passes as parameter) DECLARE_LOG_FUNCTION2(Generic, wxLogLevel level); @@ -490,6 +497,7 @@ DECLARE_LOG_FUNCTION(Status); #if wxUSE_GUI // this one is the same as previous except that it allows to explicitly + class WXDLLEXPORT wxFrame; // specify the frame to which the output should go DECLARE_LOG_FUNCTION2_EXP(Status, wxFrame *pFrame, WXDLLIMPEXP_CORE); #endif // wxUSE_GUI @@ -556,9 +564,14 @@ wxSafeShowMessage(const wxString& title, const wxString& text); #define wxLogLastError(api) wxLogApiError(api, wxSysErrorCode()) #else //!debug - #define wxLogApiError(api, rc) {} - #define wxLogLastError(api) {} + inline void wxLogApiError(const wxChar *, long) { } + inline void wxLogLastError(const wxChar *) { } #endif //debug/!debug +// wxCocoa has additiional trace masks +#if defined(__WXCOCOA__) +#include "wx/cocoa/log.h" +#endif + #endif // _WX_LOG_H_