Welcome to mirror list, hosted at ThFree Co, Russian Federation.

FormatUtils.cpp « FileManager « 7zip - github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e0427df9ddb65597bb5a039f3ff3520baa3bf056 (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
65
66
67
68
69
70
71
72
73
74
75
76
// FormatUtils.cpp

#include "StdAfx.h"

#include "FormatUtils.h"
#include "Windows/ResourceString.h"
#include "Common/IntToString.h"
#include "Common/StringConvert.h"

#ifdef LANG
#include "LangUtils.h"
#endif

/*
CSysString MyFormat(const CSysString &format, const CSysString &argument)
{
  CSysString result;
  _stprintf(result.GetBuffer(format.Length() + argument.Length() + 2), 
      format, argument);
  result.ReleaseBuffer();
  return result;
}

CSysString MyFormat(UINT32 resourceID, 
    #ifdef LANG
    UINT32 aLangID, 
    #endif
    const CSysString &argument)
{
  return MyFormat(
    #ifdef LANG
    LangLoadString(resourceID, aLangID), 
    #else
    NWindows::MyLoadString(resourceID), 
    #endif
    
    argument);
}
*/

CSysString NumberToString(UINT64 number)
{
  TCHAR temp[32];
  ConvertUInt64ToString(number, temp);
  return temp;
}

UString NumberToStringW(UINT64 number)
{
  wchar_t numberString[32];
  ConvertUInt64ToString(number, numberString);
  return numberString;
}

UString MyFormatNew(const UString &format, const UString &argument)
{
  UString result = format;
  result.Replace(L"{0}", argument);
  return result;
}


UString MyFormatNew(UINT32 resourceID, 
    #ifdef LANG
    UINT32 aLangID, 
    #endif
    const UString &argument)
{
  return MyFormatNew(
    #ifdef LANG
    LangLoadStringW(resourceID, aLangID), 
    #else
    NWindows::MyLoadStringW(resourceID), 
    #endif
    argument);
}