mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
Move Math constants into class (to be consistent with other constants), tested against minGW / gcc 4.7.2 and fixed various issues (mainly initializer lists, unused variables). BlackMisc compiles now in MinGW, but still issues (especially with qDebug() friend methods)
This commit is contained in:
@@ -7,133 +7,133 @@
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
CDebug::CDebug()
|
||||
: m_isInitialized(false), m_errorLog(NULL), m_warningLog(NULL),
|
||||
m_infoLog(NULL), m_debugLog(NULL)
|
||||
CDebug::CDebug()
|
||||
: m_isInitialized(false), m_errorLog(NULL), m_warningLog(NULL),
|
||||
m_infoLog(NULL), m_debugLog(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CDebug::create(const char *logPath, bool logInFile, bool eraseLastLog)
|
||||
{
|
||||
if (!m_isInitialized)
|
||||
{
|
||||
setErrorLog(new CLog(IContext::getInstance(), CLog::eError));
|
||||
setWarningLog(new CLog(IContext::getInstance(), CLog::eWarning));
|
||||
setInfoLog(new CLog(IContext::getInstance(), CLog::eInfo));
|
||||
setDebugLog(new CLog(IContext::getInstance(), CLog::eDebug));
|
||||
|
||||
}
|
||||
|
||||
void CDebug::create(const char *logPath, bool logInFile, bool eraseLastLog)
|
||||
{
|
||||
if (!m_isInitialized)
|
||||
{
|
||||
setErrorLog(new CLog(IContext::getInstance(), CLog::eError));
|
||||
setWarningLog(new CLog(IContext::getInstance(), CLog::eWarning));
|
||||
setInfoLog(new CLog(IContext::getInstance(), CLog::eInfo));
|
||||
setDebugLog(new CLog(IContext::getInstance(), CLog::eDebug));
|
||||
|
||||
stdDisplayer = new CStdDisplay("DEFAULT_SD");
|
||||
|
||||
if (logInFile)
|
||||
{
|
||||
QDir fileinfo(m_logPath);
|
||||
QString fn;
|
||||
if (!m_logPath.isEmpty())
|
||||
{
|
||||
m_logPath = fileinfo.absolutePath();
|
||||
fn += m_logPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
fileDisplayer = new CFileDisplay("", true, "DEFAULT_FD");
|
||||
fileDisplayer = new CFileDisplay("", eraseLastLog, "DEFAULT_FD");
|
||||
}
|
||||
|
||||
init(true);
|
||||
m_isInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CDebug::init(bool logInFile)
|
||||
{
|
||||
m_debugLog->attachDisplay(stdDisplayer);
|
||||
m_infoLog->attachDisplay(stdDisplayer);
|
||||
m_warningLog->attachDisplay(stdDisplayer);
|
||||
m_errorLog->attachDisplay(stdDisplayer);
|
||||
stdDisplayer = new CStdDisplay("DEFAULT_SD");
|
||||
|
||||
if (logInFile)
|
||||
{
|
||||
m_debugLog->attachDisplay(fileDisplayer);
|
||||
m_infoLog->attachDisplay(fileDisplayer);
|
||||
m_warningLog->attachDisplay(fileDisplayer);
|
||||
m_errorLog->attachDisplay(fileDisplayer);
|
||||
QDir fileinfo(m_logPath);
|
||||
QString fn;
|
||||
if (!m_logPath.isEmpty())
|
||||
{
|
||||
m_logPath = fileinfo.absolutePath();
|
||||
fn += m_logPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
fileDisplayer = new CFileDisplay("", true, "DEFAULT_FD");
|
||||
fileDisplayer = new CFileDisplay("", eraseLastLog, "DEFAULT_FD");
|
||||
}
|
||||
}
|
||||
|
||||
QString CDebug::getLogDirectory()
|
||||
{
|
||||
return m_logPath;
|
||||
init(true);
|
||||
m_isInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
CLog *CDebug::getErrorLog()
|
||||
{
|
||||
return m_errorLog;
|
||||
}
|
||||
void CDebug::init(bool logInFile)
|
||||
{
|
||||
m_debugLog->attachDisplay(stdDisplayer);
|
||||
m_infoLog->attachDisplay(stdDisplayer);
|
||||
m_warningLog->attachDisplay(stdDisplayer);
|
||||
m_errorLog->attachDisplay(stdDisplayer);
|
||||
|
||||
void CDebug::setErrorLog(CLog *errorLog)
|
||||
if (logInFile)
|
||||
{
|
||||
m_errorLog = errorLog;
|
||||
m_debugLog->attachDisplay(fileDisplayer);
|
||||
m_infoLog->attachDisplay(fileDisplayer);
|
||||
m_warningLog->attachDisplay(fileDisplayer);
|
||||
m_errorLog->attachDisplay(fileDisplayer);
|
||||
}
|
||||
}
|
||||
|
||||
CLog *CDebug::getWarningLog()
|
||||
{
|
||||
return m_warningLog;
|
||||
}
|
||||
QString CDebug::getLogDirectory()
|
||||
{
|
||||
return m_logPath;
|
||||
}
|
||||
|
||||
void CDebug::setWarningLog(CLog *warningLog)
|
||||
{
|
||||
m_warningLog = warningLog;
|
||||
}
|
||||
CLog *CDebug::getErrorLog()
|
||||
{
|
||||
return m_errorLog;
|
||||
}
|
||||
|
||||
CLog *CDebug::getInfoLog()
|
||||
{
|
||||
return m_infoLog;
|
||||
}
|
||||
void CDebug::setErrorLog(CLog *errorLog)
|
||||
{
|
||||
m_errorLog = errorLog;
|
||||
}
|
||||
|
||||
void CDebug::setInfoLog(CLog *infoLog)
|
||||
{
|
||||
m_infoLog = infoLog;
|
||||
}
|
||||
CLog *CDebug::getWarningLog()
|
||||
{
|
||||
return m_warningLog;
|
||||
}
|
||||
|
||||
CLog *CDebug::getDebugLog()
|
||||
{
|
||||
return m_debugLog;
|
||||
}
|
||||
void CDebug::setWarningLog(CLog *warningLog)
|
||||
{
|
||||
m_warningLog = warningLog;
|
||||
}
|
||||
|
||||
void CDebug::setDebugLog(CLog *debugLog)
|
||||
{
|
||||
m_debugLog = debugLog;
|
||||
}
|
||||
CLog *CDebug::getInfoLog()
|
||||
{
|
||||
return m_infoLog;
|
||||
}
|
||||
|
||||
CLogMessage CDebug::blackInfo(int line, const char *fileName, const char *methodName)
|
||||
{
|
||||
create();
|
||||
m_infoLog->setLogInformation(line, fileName, methodName);
|
||||
return CLogMessage(*this, CLog::eInfo);
|
||||
}
|
||||
void CDebug::setInfoLog(CLog *infoLog)
|
||||
{
|
||||
m_infoLog = infoLog;
|
||||
}
|
||||
|
||||
CLogMessage CDebug::blackWarning(int line, const char *fileName, const char *methodName)
|
||||
{
|
||||
create();
|
||||
m_warningLog->setLogInformation(line, fileName, methodName);
|
||||
return CLogMessage(*this, CLog::eWarning);
|
||||
}
|
||||
CLog *CDebug::getDebugLog()
|
||||
{
|
||||
return m_debugLog;
|
||||
}
|
||||
|
||||
CLogMessage CDebug::blackDebug(int line, const char *fileName, const char *methodName)
|
||||
{
|
||||
create();
|
||||
m_debugLog->setLogInformation(line, fileName, methodName);
|
||||
return CLogMessage(*this, CLog::eDebug);
|
||||
}
|
||||
void CDebug::setDebugLog(CLog *debugLog)
|
||||
{
|
||||
m_debugLog = debugLog;
|
||||
}
|
||||
|
||||
CLogMessage CDebug::blackError(int line, const char *fileName, const char *methodName)
|
||||
{
|
||||
create();
|
||||
m_errorLog->setLogInformation(line, fileName, methodName);
|
||||
return CLogMessage(*this, CLog::eError);
|
||||
}
|
||||
CLogMessage CDebug::blackInfo(int line, const char *fileName, const char *methodName)
|
||||
{
|
||||
create();
|
||||
m_infoLog->setLogInformation(line, fileName, methodName);
|
||||
return CLogMessage(*this, CLog::eInfo);
|
||||
}
|
||||
|
||||
CLogMessage CDebug::blackWarning(int line, const char *fileName, const char *methodName)
|
||||
{
|
||||
create();
|
||||
m_warningLog->setLogInformation(line, fileName, methodName);
|
||||
return CLogMessage(*this, CLog::eWarning);
|
||||
}
|
||||
|
||||
CLogMessage CDebug::blackDebug(int line, const char *fileName, const char *methodName)
|
||||
{
|
||||
create();
|
||||
m_debugLog->setLogInformation(line, fileName, methodName);
|
||||
return CLogMessage(*this, CLog::eDebug);
|
||||
}
|
||||
|
||||
CLogMessage CDebug::blackError(int line, const char *fileName, const char *methodName)
|
||||
{
|
||||
create();
|
||||
m_errorLog->setLogInformation(line, fileName, methodName);
|
||||
return CLogMessage(*this, CLog::eError);
|
||||
}
|
||||
|
||||
} // namespace BlackMisc
|
||||
|
||||
Reference in New Issue
Block a user