]> Shamusworld >> Repos - architektonas/blobdiff - src/base/debug.cpp
Major refactor of Architektonas: Jettisoning old cruft.
[architektonas] / src / base / debug.cpp
diff --git a/src/base/debug.cpp b/src/base/debug.cpp
deleted file mode 100644 (file)
index 36cb5ef..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-// debug.cpp
-//
-// Part of the Architektonas Project
-// Originally part of QCad Community Edition by Andrew Mustun
-// Extensively rewritten and refactored by James L. Hammons
-// Portions copyright (C) 2001-2003 RibbonSoft
-// Copyright (C) 2010 Underground Software
-// See the README and GPLv2 files for licensing and warranty information
-//
-// JLH = James L. Hammons <jlhamm@acm.org>
-//
-// Who  When        What
-// ---  ----------  -----------------------------------------------------------
-// JLH  05/28/2010  Added this text. :-)
-//
-
-#include "debug.h"
-
-#include <stdarg.h>
-#include "system.h"
-
-Debug * Debug::uniqueInstance = NULL;
-
-/**
- * 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
- */
-Debug * Debug::instance()
-{
-       if (uniqueInstance == NULL)
-       {
-               QDateTime now = QDateTime::currentDateTime();
-               QString nowStr;
-               nowStr = now.toString("yyyyMMdd_hhmmss");
-               QString fName = QString("debug_%1.log").arg(nowStr);
-
-               uniqueInstance = new Debug;
-//             uniqueInstance->stream = fopen(fName.toAscii().data(), "wt");
-//             uniqueInstance->stream = stderr;
-               uniqueInstance->stream = stdout;
-       }
-
-       return uniqueInstance;
-}
-
-/**
- * Deletes the one and only Debug instance.
- */
-void Debug::deleteInstance()
-{
-       if (uniqueInstance)
-       {
-               fclose(uniqueInstance->stream);
-               delete uniqueInstance;
-       }
-}
-
-/**
- * Constructor for a point with default coordinates.
- */
-Debug::Debug()
-{
-       debugLevel = D_DEBUGGING;
-}
-
-/**
- * Sets the debugging level.
- */
-void Debug::setLevel(DebugLevel level)
-{
-       debugLevel = level;
-       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.
- */
-Debug::DebugLevel Debug::getLevel()
-{
-       return debugLevel;
-}
-
-/**
- * Prints the given message to stdout.
- */
-void Debug::print(const char * format ...)
-{
-       if (debugLevel == D_DEBUGGING)
-       {
-               va_list ap;
-               va_start(ap, format);
-               vfprintf(stream, format, ap);
-               fprintf(stream, "\n");
-               va_end(ap);
-               fflush(stream);
-       }
-}
-
-/**
- * Prints the given message to stdout if the current debug level
- * is lower then the given level
- *
- * @param level Debug level.
- */
-void Debug::print(DebugLevel level, const char * format ...)
-{
-       if (debugLevel >= level)
-       {
-               va_list ap;
-               va_start(ap, format);
-               vfprintf(stream, format, ap);
-               fprintf(stream, "\n");
-               va_end(ap);
-               fflush(stream);
-       }
-}
-
-/**
- * Prints a time stamp in the format yyyyMMdd_hhmmss.
- */
-void Debug::timestamp()
-{
-       QDateTime now = QDateTime::currentDateTime();
-       QString nowStr = now.toString("yyyyMMdd_hh:mm:ss:zzz ");
-       fprintf(stream, "%s", nowStr.toAscii().data());
-       fprintf(stream, "\n");
-       fflush(stream);
-}
-
-/**
- * Prints the unicode for every character in the given string.
- */
-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).toAscii());
-}
-
-void Debug::setStream(FILE * s)
-{
-       stream = s;
-}