diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:59:06 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:59:06 +0200 |
commit | 4046be06720932a57a0f49416b0144b2858824d0 (patch) | |
tree | 678c37cab05960f48923a23bb46d9e01be89d35a /library/globalFunctions.cpp | |
parent | 1.19 (diff) | |
download | FreeFileSync-4046be06720932a57a0f49416b0144b2858824d0.tar.gz FreeFileSync-4046be06720932a57a0f49416b0144b2858824d0.tar.bz2 FreeFileSync-4046be06720932a57a0f49416b0144b2858824d0.zip |
2.0
Diffstat (limited to 'library/globalFunctions.cpp')
-rw-r--r-- | library/globalFunctions.cpp | 49 |
1 files changed, 10 insertions, 39 deletions
diff --git a/library/globalFunctions.cpp b/library/globalFunctions.cpp index 7c4a1b92..33932d67 100644 --- a/library/globalFunctions.cpp +++ b/library/globalFunctions.cpp @@ -1,40 +1,10 @@ #include "globalFunctions.h" -#include "resources.h" #include <wx/msgdlg.h> #include <wx/file.h> #include <fstream> - - -std::string globalFunctions::numberToString(const unsigned int number) -{ - char result[100]; - sprintf(result, "%u", number); - return std::string(result); -} - - -std::string globalFunctions::numberToString(const int number) -{ - char result[100]; - sprintf(result, "%d", number); - return std::string(result); -} - - -std::string globalFunctions::numberToString(const long number) -{ - char result[100]; - sprintf(result, "%ld", number); - return std::string(result); -} - - -std::string globalFunctions::numberToString(const float number) -{ - char result[100]; - sprintf(result, "%f", number); - return std::string(result); -} +#include "../structures.h" +#include <wx/stream.h> +#include <wx/stopwatch.h> wxString globalFunctions::numberToWxString(const unsigned int number) @@ -97,7 +67,7 @@ wxString globalFunctions::includeNumberSeparator(const wxString& number) { wxString output(number); for (int i = output.size() - 3; i > 0; i -= 3) - output.insert(i, GlobalResources::THOUSANDS_SEPARATOR); + output.insert(i, FreeFileSync::THOUSANDS_SEPARATOR); return output; } @@ -136,9 +106,10 @@ void globalFunctions::writeInt(wxOutputStream& stream, const int number) //############################################################################ Performance::Performance() : - resultWasShown(false) + resultWasShown(false), + timer(new wxStopWatch) { - timer.Start(); + timer->Start(); } @@ -152,8 +123,8 @@ Performance::~Performance() void Performance::showResult() { resultWasShown = true; - wxMessageBox(globalFunctions::numberToWxString(unsigned(timer.Time())) + wxT(" ms")); - timer.Start(); //reset timer + wxMessageBox(globalFunctions::numberToWxString(unsigned(timer->Time())) + wxT(" ms")); + timer->Start(); //reset timer } @@ -203,5 +174,5 @@ void DebugLog::write(const wxString& logText) wxString getCodeLocation(const wxString file, const int line) { - return wxString(file).AfterLast(GlobalResources::FILE_NAME_SEPARATOR) + wxT(", LINE ") + globalFunctions::numberToWxString(line) + wxT(" | "); + return wxString(file).AfterLast(FreeFileSync::FILE_NAME_SEPARATOR) + wxT(", LINE ") + globalFunctions::numberToWxString(line) + wxT(" | "); } |