Files
wagic/JGE/include/DebugRoutines.h
wrenczes@gmail.com ae227a7cb8 Minor project cleanup:
- Consolidated duplicate PSP / PSPENV defines;
- removed some ancillary file crap from the 2010 projects;
- pulled 1xx references from the makefiles;
- consolidated multiple #defines for OutputDebugString into one header (previously was split between config.h & DebugRoutines.h).
2011-04-22 13:12:36 +00:00

64 lines
1.3 KiB
C++

#ifndef DEBUGROUTINES_H
#define DEBUGROUTINES_H
// dirty, but I get OS header includes this way
#include "JGE.h"
#include <ostream>
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <string>
#include <sstream>
using namespace std;
template <class T>
std::string ToHex(T* pointer)
{
std::ostringstream stream;
stream << hex << showbase << setfill('0') << setw(8) << (uint64_t) pointer;
return stream.str();
}
#ifdef LINUX
#define OutputDebugString(val) (std::cerr << val);
#endif
#if defined (WIN32) || defined (LINUX)
#ifdef _DEBUG
#ifndef QT_CONFIG
#define DebugTrace(inString) \
{ \
std::ostringstream stream; \
stream << inString << std::endl; \
OutputDebugString(stream.str().c_str()); \
}
#else
#define DebugTrace(inString) \
{ \
std::ostringstream stream; \
stream << inString << std::endl; \
qDebug(stream.str().c_str()); \
}
#endif //QT_CONFIG
#endif //#ifdef _DEBUG
#endif // Win32, Linux
#if defined (DEBUG)
#ifndef DebugTrace
#define DebugTrace(inString) \
{ \
std::cerr << inString << std::endl; \
}
#endif //DEBUG
#endif
#ifndef DebugTrace
#define DebugTrace(inString) (void (0))
#endif
#endif // DEBUGROUTINES_H