summaryrefslogtreecommitdiff
path: root/wx+/format_unit.h
blob: 71501db79c1ffa39e806d22907695e60a28ba2c1 (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
53
54
55
56
57
58
59
60
61
62
63
64
// **************************************************************************
// * 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 (zhnmju123 AT gmx DOT de) - All Rights Reserved    *
// **************************************************************************

#ifndef UTIL_H_INCLUDED
#define UTIL_H_INCLUDED

#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 toStringSep(NumberType number); //convert number to std::wstring including thousands separator

std::wstring utcToLocalTimeString(Int64 utcTime); //throw std::runtime_error



























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

template <class NumberType> inline
std::wstring toStringSep(NumberType number)
{
    return ffs_Impl::includeNumberSeparator(zen::numberTo<std::wstring>(number));
}
}

#endif // UTIL_H_INCLUDED
bgstack15