From 4226e548662339ea1ca37b45385a7cf9b237ff1e Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:07:43 +0200 Subject: 3.8 --- shared/util.h | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-) (limited to 'shared/util.h') diff --git a/shared/util.h b/shared/util.h index cc721ac1..25048132 100644 --- a/shared/util.h +++ b/shared/util.h @@ -10,6 +10,7 @@ #include "../shared/zstring.h" #include #include +#include "../shared/globalFunctions.h" class wxComboBox; class wxTextCtrl; @@ -25,9 +26,8 @@ wxString formatFilesizeToShortString(double filesize); wxString formatPercentage(const wxLongLong& dividend, const wxLongLong& divisor); -wxString numberToWxString(size_t number, bool includeNumberSep); //convert number to wxString -wxString numberToWxString(int number, bool includeNumberSep); //convert number to wxString -wxString numberToWxString(const wxULongLong& number, bool includeNumberSep); //convert number to wxString +template +wxString numberToStringSep(NumberType number); //convert number to wxString including thousands separator void setDirectoryName(const wxString& dirname, wxTextCtrl* txtCtrl, wxDirPickerCtrl* dirPicker); void setDirectoryName(const wxString& dirname, wxComboBox* txtCtrl, wxDirPickerCtrl* dirPicker); @@ -37,4 +37,57 @@ wxString utcTimeToLocalString(const wxLongLong& utcTime); //throw std::runtime_e } + + + + + + + + + + + + + + + + + + + + + + + + +//--------------- inline impelementation ------------------------------------------- + +//helper function! not to be used directly +namespace FreeFileSync_Impl +{ +wxString includeNumberSeparator(const wxString& number); +} + + +namespace FreeFileSync +{ +//wxULongLongNative doesn't support operator<<(std::ostream&, wxULongLongNative) +template <> +inline +wxString numberToStringSep(wxULongLongNative number) +{ + return FreeFileSync_Impl::includeNumberSeparator(number.ToString()); +} + + +template +inline +wxString numberToStringSep(NumberType number) +{ + return FreeFileSync_Impl::includeNumberSeparator(globalFunctions::numberToString(number)); +} +} + + #endif // UTIL_H_INCLUDED -- cgit