diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:21:41 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:21:41 +0200 |
commit | d6301fca6b78db52d0d98f8e0799aba175ad2e59 (patch) | |
tree | 0380aac034e0d70ee058db07900d80ff20cfc81e /zen/format_unit.h | |
parent | 5.7 (diff) | |
download | FreeFileSync-d6301fca6b78db52d0d98f8e0799aba175ad2e59.tar.gz FreeFileSync-d6301fca6b78db52d0d98f8e0799aba175ad2e59.tar.bz2 FreeFileSync-d6301fca6b78db52d0d98f8e0799aba175ad2e59.zip |
5.8
Diffstat (limited to 'zen/format_unit.h')
-rw-r--r-- | zen/format_unit.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/zen/format_unit.h b/zen/format_unit.h new file mode 100644 index 00000000..f634e5e5 --- /dev/null +++ b/zen/format_unit.h @@ -0,0 +1,59 @@ +// ************************************************************************** +// * 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) Zenju (zenju AT gmx DOT de) - All Rights Reserved * +// ************************************************************************** + +#ifndef FMT_UNIT_8702184019487324 +#define FMT_UNIT_8702184019487324 + +#include <string> +#include <zen/string_tools.h> +#include <zen/int64.h> + +namespace zen +{ +std::wstring filesizeToShortString(Int64 filesize); +std::wstring remainingTimeToShortString(double timeInSec); +std::wstring fractionToShortString(double fraction); //within [0, 1] + +template <class NumberType> +std::wstring toGuiString(NumberType number); //format integer number including thousands separator + +std::wstring utcToLocalTimeString(Int64 utcTime); //like Windows Explorer would... + + + + + + + + + + + + + + + + + + + + + +//--------------- inline impelementation ------------------------------------------- +namespace ffs_Impl +{ +std::wstring includeNumberSeparator(const std::wstring& number); +} + +template <class NumberType> inline +std::wstring toGuiString(NumberType number) +{ + //assert_static(IsInteger<NumberType>::value); -> doesn't work for UInt64 + return ffs_Impl::includeNumberSeparator(zen::numberTo<std::wstring>(number)); +} +} + +#endif |