From 4046be06720932a57a0f49416b0144b2858824d0 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 16:59:06 +0200 Subject: 2.0 --- library/globalFunctions.cpp | 49 +++++++++------------------------------------ 1 file changed, 10 insertions(+), 39 deletions(-) (limited to 'library/globalFunctions.cpp') 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 #include #include - - -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 +#include 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(" | "); } -- cgit