]> Shamusworld >> Repos - architektonas/blobdiff - src/base/debug.cpp
Removed unnecessary RS_ prefix from classes and whatnot.
[architektonas] / src / base / debug.cpp
index acfafaca02fc282614b0c33e9cf64faa16490b05..36cb5ef054306182422d9ed4af07e26f8362497a 100644 (file)
 #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)
        {
@@ -37,8 +35,8 @@ RS_Debug * RS_Debug::instance()
                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;
        }
@@ -47,11 +45,11 @@ RS_Debug * RS_Debug::instance()
 }
 
 /**
- * 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;
@@ -61,7 +59,7 @@ void RS_Debug::deleteInstance()
 /**
  * Constructor for a point with default coordinates.
  */
-RS_Debug::RS_Debug()
+Debug::Debug()
 {
        debugLevel = D_DEBUGGING;
 }
@@ -69,20 +67,20 @@ RS_Debug::RS_Debug()
 /**
  * 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;
 }
@@ -90,7 +88,7 @@ RS_Debug::RS_DebugLevel RS_Debug::getLevel()
 /**
  * Prints the given message to stdout.
  */
-void RS_Debug::print(const char * format ...)
+void Debug::print(const char * format ...)
 {
        if (debugLevel == D_DEBUGGING)
        {
@@ -109,7 +107,7 @@ void RS_Debug::print(const char * format ...)
  *
  * @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)
        {
@@ -125,11 +123,11 @@ void RS_Debug::print(RS_DebugLevel level, const char * format ...)
 /**
  * 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);
 }
@@ -137,13 +135,13 @@ void RS_Debug::timestamp()
 /**
  * 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;
 }