MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / StringFormatV

Method StringFormatV

LuaSTGPlus/Utility.cpp:15–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13}
14
15std::string LuaSTGPlus::StringFormatV(const char* Format, va_list vaptr)LNOEXCEPT
16{
17 std::string tRet;
18 try
19 {
20 while (*Format != '\0')
21 {
22 char c = *Format;
23 if (c != '%')
24 tRet.push_back(c);
25 else
26 {
27 c = *(++Format);
28
29 switch (c)
30 {
31 case '%':
32 tRet.push_back('%');
33 break;
34 case 'b':
35 tRet.append(va_arg(vaptr, bool) ? "true" : "false");
36 break;
37 case 'd':
38 tRet.append(std::to_string(va_arg(vaptr, int32_t)));
39 break;
40 case 'f':
41 tRet.append(std::to_string(va_arg(vaptr, double)));
42 break;
43 case 'l':
44 c = *(++Format);
45 switch (c)
46 {
47 case 'f':
48 tRet.append(std::to_string(va_arg(vaptr, double)));
49 break;
50 case 'd':
51 tRet.append(std::to_string(va_arg(vaptr, int64_t)));
52 break;
53 case 'u':
54 tRet.append(std::to_string(va_arg(vaptr, uint64_t)));
55 break;
56 default:
57 tRet.append("%l");
58 if (c == '\0')
59 Format--;
60 else
61 tRet.push_back(c);
62 break;
63 }
64 break;
65 case 'u':
66 tRet.append(std::to_string(va_arg(vaptr, uint32_t)));
67 break;
68 case 'c':
69 tRet.push_back(va_arg(vaptr, int32_t));
70 break;
71 case 's':
72 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected