blob: 5f641819f1dde43bec367bae5700578a4aeade39 (
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
|
#pragma once
using namespace std;
// 4J Stu - The java formated numbers based on a local passed in, but I am just going for a constant format here
class NumberFormat
{
public:
static wstring format(int value)
{
// TODO 4J Stu - Change the length of the formatted number
wchar_t output[256];
swprintf( output, 256, L"%d", value);
wstring result = wstring( output );
return result;
}
};
class DecimalFormat
{
private:
const wstring formatString;
public:
wstring format(double value)
{
// TODO 4J Stu - Change the length of the formatted number
wchar_t output[256];
swprintf( output, 256, formatString.c_str(), value);
wstring result = wstring( output );
return result;
}
// 4J Stu - The java code took a string format, we take a printf format string
DecimalFormat(wstring x) : formatString( x ) {};
};
|