Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
dbgutils.h File Reference
#include <cstring>
#include <iomanip>
#include <misc/global.h>
#include <utility>
Include dependency graph for dbgutils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  sf::notify_exception
 
class  sf::debug_ostream
 Debug output stream. More...
 

Namespaces

namespace  sf
 

Macros

#define SF_DEBUG_LEVEL   1
 contains debugging macro's that are defined when define DEBUG_LEVEL is defined as non-zero.
 
#define SF_RTTI_NAME(self)   sf::demangleTypeName(typeid(self).name())
 
#define SF_RTTI_FUNCTION   SF_RTTI_TYPENAME.append("::").append(__FUNCTION__)
 
#define SF_RTTI_TYPENAME   SF_RTTI_NAME(*this)
 
#define SF_FILENAME   (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
 
#define DO_DEFAULT   sf::dotDefault
 
#define DO_COUT   sf::dotStdOut
 
#define DO_CLOG   sf::dotStdLog
 
#define DO_CERR   sf::dotStdErr
 
#define DO_MSGBOX   sf::dotMessageBox
 
#define DO_DBGSTR   sf::dotDebugString
 
#define DO_DBGBRK   sf::dotDebugBreak
 
#define SF_CLS_SEP   ';'
 
#define SF_NORM_NOTIFY(f, a)
 
#define SF_FUNC_NOTIFY(f, a)
 
#define SF_RTTI_NOTIFY(f, a)
 
#define SF_COND_NORM_NOTIFY(p, f, a)
 
#define SF_COND_FUNC_NOTIFY(p, f, a)
 
#define SF_COND_RTTI_NOTIFY(p, f, a)
 

Enumerations

enum  sf::EDebugOutputType : int {
  sf::dotThrow = 1U << 0U , sf::dotMessageBox = 1U << 1U , sf::dotStdLog = 1U << 2U , sf::dotStdOut = 1U << 3U ,
  sf::dotStdErr = 1U << 4U , sf::dotDebugString = 1U << 5U , sf::dotDebugBreak = 1U << 6U , sf::dotDefault = 1U << 7U
}
 

Functions

_MISC_FUNC void sf::UserOutputDebugString (unsigned int type, const char *str) noexcept
 Allows the passed string to be presented in various ways.
 
_MISC_FUNC void sf::SetDefaultDebugOutput (unsigned int type)
 Set and get function for the type of output when DO_DEFAULT is passed.
 
_MISC_FUNC unsigned int sf::GetDefaultDebugOutput ()
 Returns the combination of EDebugOutputType which is the default output.
 
_MISC_FUNC std::string sf::getBacktrace ()
 Prints the backtrace to a stream.
 
_MISC_FUNC void sf::printBacktrace (std::ostream &os)
 Prints the backtrace to a stream.
 
_MISC_FUNC bool sf::isDebug ()
 Gets the debug status.
 
_MISC_FUNC bool sf::isDebuggerActive ()
 Gets the debugger active status.
 
_MISC_FUNC void sf::debugBreak ()
 Causes a break when debugging.
 
_MISC_FUNC void sf::freeConsole (bool always=false)
 Closes the console window.
 
_MISC_FUNC std::string sf::demangleTypeName (const char *name)
 Demangle the passed rtti mangled type name.
 
template<typename T >
std::string sf::getTypeName (const T ptr)
 Get the demangled type name of the passed pointer type.
 

Macro Definition Documentation

◆ DO_CERR

#define DO_CERR   sf::dotStdErr

◆ DO_CLOG

#define DO_CLOG   sf::dotStdLog

◆ DO_COUT

#define DO_COUT   sf::dotStdOut

◆ DO_DBGBRK

#define DO_DBGBRK   sf::dotDebugBreak

◆ DO_DBGSTR

#define DO_DBGSTR   sf::dotDebugString

◆ DO_DEFAULT

#define DO_DEFAULT   sf::dotDefault

◆ DO_MSGBOX

#define DO_MSGBOX   sf::dotMessageBox

◆ SF_CLS_SEP

#define SF_CLS_SEP   ';'

◆ SF_COND_FUNC_NOTIFY

#define SF_COND_FUNC_NOTIFY (   p,
  f,
 
)
Value:
{ \
if (p) \
{ \
SF_FUNC_NOTIFY(f, a); \
} \
}

◆ SF_COND_NORM_NOTIFY

#define SF_COND_NORM_NOTIFY (   p,
  f,
 
)
Value:
{ \
if (p) \
{ \
SF_NORM_NOTIFY(f, a); \
} \
}

◆ SF_COND_RTTI_NOTIFY

#define SF_COND_RTTI_NOTIFY (   p,
  f,
 
)
Value:
{ \
if (p) \
{ \
SF_RTTI_NOTIFY(f, a); \
} \
}

◆ SF_DEBUG_LEVEL

#define SF_DEBUG_LEVEL   1

contains debugging macro's that are defined when define DEBUG_LEVEL is defined as non-zero.

Introduces debugging/logging macro's:

Defines that change on define _DEBUG_LEVEL:

NORM_NOTIFY(flags, text) FUNC_NOTIFY(flags, text) RTTI_NOTIFY(flags, text) COND_NORM_NOTIFY(cond, flags, text) COND_FUNC_NOTIFY(cond, flags, text) COND_RTTI_NOTIFY(cond, flags, text)

Where 'flags' can be one or a combination of the following flags:

DO_DEFAULT Predefined combination of flags. DO_THROW Throw an exception. DO_MSGBOX Notify through a message box. DO_CLOG Notify through the std::clog output stream. DO_COUT Notify through the std::cout output stream. DO_CERR Notify through the std::cerr output stream. DO_DBGSTR Notify through function OutputDebugString. DO_DBGBRK Call debug break by raising SIGTRAP.

◆ SF_FILENAME

#define SF_FILENAME   (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)

◆ SF_FUNC_NOTIFY

#define SF_FUNC_NOTIFY (   f,
 
)
Value:
{ \
sf::debug_ostream(f) << __FUNCTION__ << "() " << a; \
}

◆ SF_NORM_NOTIFY

#define SF_NORM_NOTIFY (   f,
 
)
Value:
{ \
sf::debug_ostream(f) << a; \
}

◆ SF_RTTI_FUNCTION

#define SF_RTTI_FUNCTION   SF_RTTI_TYPENAME.append("::").append(__FUNCTION__)

◆ SF_RTTI_NAME

#define SF_RTTI_NAME (   self)    sf::demangleTypeName(typeid(self).name())

◆ SF_RTTI_NOTIFY

#define SF_RTTI_NOTIFY (   f,
 
)
Value:
{ \
sf::debug_ostream(f) << SF_RTTI_TYPENAME << "::" << __FUNCTION__ << SF_CLS_SEP << " " << a; \
}
#define SF_RTTI_TYPENAME
Definition dbgutils.h:50
#define SF_CLS_SEP
Definition dbgutils.h:250

◆ SF_RTTI_TYPENAME

#define SF_RTTI_TYPENAME   SF_RTTI_NAME(*this)