#include <stdarg.h>
#include "system.h"
-RS_Debug * RS_Debug::uniqueInstance = NULL;
+Debug * Debug::uniqueInstance = NULL;
/**
- * Gets the one and only RS_Debug instance
- * (creates a new one on first call only)
+ * Gets the one and only Debug instance (creates a new one on first call only)
*
- * @return Pointer to the single instance of this
- * singleton class
+ * @return Pointer to the single instance of this singleton class
*/
-RS_Debug * RS_Debug::instance()
+Debug * Debug::instance()
{
if (uniqueInstance == NULL)
{
nowStr = now.toString("yyyyMMdd_hhmmss");
QString fName = QString("debug_%1.log").arg(nowStr);
- uniqueInstance = new RS_Debug;
- //uniqueInstance->stream = fopen(fName.latin1(), "wt");
+ uniqueInstance = new Debug;
+// uniqueInstance->stream = fopen(fName.toAscii().data(), "wt");
// uniqueInstance->stream = stderr;
uniqueInstance->stream = stdout;
}
}
/**
- * Deletes the one and only RS_Debug instance.
+ * Deletes the one and only Debug instance.
*/
-void RS_Debug::deleteInstance()
+void Debug::deleteInstance()
{
- if (uniqueInstance != NULL)
+ if (uniqueInstance)
{
fclose(uniqueInstance->stream);
delete uniqueInstance;
/**
* Constructor for a point with default coordinates.
*/
-RS_Debug::RS_Debug()
+Debug::Debug()
{
debugLevel = D_DEBUGGING;
}
/**
* Sets the debugging level.
*/
-void RS_Debug::setLevel(RS_DebugLevel level)
+void Debug::setLevel(DebugLevel level)
{
debugLevel = level;
- print("RS_DEBUG: Warnings", D_WARNING);
- print("RS_DEBUG: Errors", D_ERROR);
- print("RS_DEBUG: Notice", D_NOTICE);
- print("RS_DEBUG: Informational", D_INFORMATIONAL);
- print("RS_DEBUG: Debugging", D_DEBUGGING);
+ print("DEBUG: Warnings", D_WARNING);
+ print("DEBUG: Errors", D_ERROR);
+ print("DEBUG: Notice", D_NOTICE);
+ print("DEBUG: Informational", D_INFORMATIONAL);
+ print("DEBUG: Debugging", D_DEBUGGING);
}
/**
* Gets the current debugging level.
*/
-RS_Debug::RS_DebugLevel RS_Debug::getLevel()
+Debug::DebugLevel Debug::getLevel()
{
return debugLevel;
}
/**
* Prints the given message to stdout.
*/
-void RS_Debug::print(const char * format ...)
+void Debug::print(const char * format ...)
{
if (debugLevel == D_DEBUGGING)
{
*
* @param level Debug level.
*/
-void RS_Debug::print(RS_DebugLevel level, const char * format ...)
+void Debug::print(DebugLevel level, const char * format ...)
{
if (debugLevel >= level)
{
/**
* Prints a time stamp in the format yyyyMMdd_hhmmss.
*/
-void RS_Debug::timestamp()
+void Debug::timestamp()
{
QDateTime now = QDateTime::currentDateTime();
QString nowStr = now.toString("yyyyMMdd_hh:mm:ss:zzz ");
- fprintf(stream, "%s", nowStr.toLatin1().data());
+ fprintf(stream, "%s", nowStr.toAscii().data());
fprintf(stream, "\n");
fflush(stream);
}
/**
* Prints the unicode for every character in the given string.
*/
-void RS_Debug::printUnicode(const QString & text)
+void Debug::printUnicode(const QString & text)
{
for(int i=0; i<(int)text.length(); i++)
- print("[%X] %c", text.at(i).unicode(), text.at(i).toLatin1());
+ print("[%X] %c", text.at(i).unicode(), text.at(i).toAscii());
}
-void RS_Debug::setStream(FILE * s)
+void Debug::setStream(FILE * s)
{
stream = s;
}