summaryrefslogtreecommitdiff
path: root/zen/format_unit.h
blob: 9416e3e522bd5780546a87564e1565f58842db2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// **************************************************************************
// * 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 <cstdint>
#include "string_tools.h"

namespace zen
{
std::wstring filesizeToShortString(std::int64_t filesize);
std::wstring remainingTimeToString(double timeInSec);
std::wstring fractionToString(double fraction); //within [0, 1]
std::wstring utcToLocalTimeString(std::int64_t utcTime); //like Windows Explorer would...

std::wstring formatThreeDigitPrecision(double value); //= *at least* three digits

template <class NumberType>
std::wstring toGuiString(NumberType number); //format integer number including thousands separator













//--------------- inline impelementation -------------------------------------------
namespace ffs_Impl
{
std::wstring includeNumberSeparator(const std::wstring& number);
}

template <class NumberType> inline
std::wstring toGuiString(NumberType number)
{
    static_assert(IsInteger<NumberType>::value, "");
    return ffs_Impl::includeNumberSeparator(zen::numberTo<std::wstring>(number));
}
}

#endif
bgstack15