diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:08:06 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:08:06 +0200 |
commit | fbe76102e941b9f1edaf236788e42678f05fdf9a (patch) | |
tree | f5f538316019fa89be8dc478103490c3a826f3ac /shared/globalFunctions.cpp | |
parent | 3.8 (diff) | |
download | FreeFileSync-fbe76102e941b9f1edaf236788e42678f05fdf9a.tar.gz FreeFileSync-fbe76102e941b9f1edaf236788e42678f05fdf9a.tar.bz2 FreeFileSync-fbe76102e941b9f1edaf236788e42678f05fdf9a.zip |
3.9
Diffstat (limited to 'shared/globalFunctions.cpp')
-rw-r--r-- | shared/globalFunctions.cpp | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/shared/globalFunctions.cpp b/shared/globalFunctions.cpp deleted file mode 100644 index 63831e1a..00000000 --- a/shared/globalFunctions.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * -// ************************************************************************** -// -#include "globalFunctions.h" -#include <wx/msgdlg.h> -#include <wx/file.h> -#include <wx/stopwatch.h> -#include "systemConstants.h" - - -size_t globalFunctions::getDigitCount(size_t number) //count number of digits -{ - return number == 0 ? 1 : static_cast<size_t>(::log10(static_cast<double>(number))) + 1; -} - - -//############################################################################ -Performance::Performance() : - resultWasShown(false), - timer(new wxStopWatch) -{ - timer->Start(); -} - - -Performance::~Performance() -{ - //keep non-inline destructor for std::auto_ptr to work with forward declaration - - if (!resultWasShown) - showResult(); -} - - -void Performance::showResult() -{ - resultWasShown = true; - wxMessageBox(wxLongLong(timer->Time()).ToString() + wxT(" ms")); - timer->Start(); //reset timer -} - - -//############################################################################ -DebugLog::DebugLog() : - lineCount(0), - logFile(NULL) -{ - logFile = new wxFile; - logfileName = assembleFileName(); - logFile->Open(logfileName.c_str(), wxFile::write); -} - - -DebugLog::~DebugLog() -{ - delete logFile; //automatically closes file handle -} - - -wxString DebugLog::assembleFileName() -{ - wxString tmp = wxDateTime::Now().FormatISOTime(); - tmp.Replace(wxT(":"), wxEmptyString); - return wxString(wxT("DEBUG_")) + wxDateTime::Now().FormatISODate() + wxChar('_') + tmp + wxT(".log"); -} - - -void DebugLog::write(const wxString& logText) -{ - ++lineCount; - if (lineCount % 50000 == 0) //prevent logfile from becoming too big - { - logFile->Close(); - wxRemoveFile(logfileName); - - logfileName = assembleFileName(); - logFile->Open(logfileName.c_str(), wxFile::write); - } - - logFile->Write(wxString(wxT("[")) + wxDateTime::Now().FormatTime() + wxT("] ")); - logFile->Write(logText + globalFunctions::LINE_BREAK); -} - -//DebugLog logDebugInfo; - - -wxString getCodeLocation(const wxString file, const int line) -{ - return wxString(file).AfterLast(globalFunctions::FILE_NAME_SEPARATOR) + wxT(", LINE ") + wxLongLong(line).ToString() + wxT(" | "); -} |