diff options
Diffstat (limited to 'shared/util.h')
-rw-r--r-- | shared/util.h | 59 |
1 files changed, 56 insertions, 3 deletions
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 <wx/string.h> #include <wx/longlong.h> +#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 <class NumberType> +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 <class NumberType> +inline +wxString numberToStringSep(NumberType number) +{ + return FreeFileSync_Impl::includeNumberSeparator(globalFunctions::numberToString(number)); +} +} + + #endif // UTIL_H_INCLUDED |