X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Fdebug.cpp;fp=src%2Fbase%2Fdebug.cpp;h=36cb5ef054306182422d9ed4af07e26f8362497a;hb=16354e0421b316a62c6b9f7b0b4f3b8cf6f06284;hp=acfafaca02fc282614b0c33e9cf64faa16490b05;hpb=3239ef39dcee08fa6e8cd68cdf2727fc68cc7a8c;p=architektonas diff --git a/src/base/debug.cpp b/src/base/debug.cpp index acfafac..36cb5ef 100644 --- a/src/base/debug.cpp +++ b/src/base/debug.cpp @@ -19,16 +19,14 @@ #include #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; }