MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / formatStringPart

Function formatStringPart

src/OpenLoco/src/Localisation/Formatting.cpp:305–579  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303 }
304
305 static void formatStringPart(StringBuffer& buffer, const char* sourceStr, FormatArgumentsView& args)
306 {
307 while (true)
308 {
309 uint8_t ch = *sourceStr;
310
311 if (ch == 0)
312 {
313 return;
314 }
315 else if (ch <= 4)
316 {
317 buffer.appendData(sourceStr, 2);
318 sourceStr += 2;
319 }
320 else if (ch <= 16)
321 {
322 buffer.appendData(sourceStr, 1);
323 sourceStr += 1;
324 }
325 else if (ch <= 22)
326 {
327 buffer.appendData(sourceStr, 3);
328 sourceStr += 3;
329 }
330 else if (ch <= 0x1F)
331 {
332 buffer.appendData(sourceStr, 5);
333 sourceStr += 5;
334 }
335 else if (ch < 0x7B || ch >= 0x90)
336 {
337 buffer.append(ch);
338 sourceStr += 1;
339 }
340 else
341 {
342 sourceStr++;
343
344 switch (ch)
345 {
346 case ControlCodes::int32_grouped:
347 {
348 int32_t value = args.pop<int32_t>();
349 formatInt32Grouped(value, buffer);
350 break;
351 }
352
353 case ControlCodes::int32_ungrouped:
354 {
355 int32_t value = args.pop<int32_t>();
356 formatInt32Ungrouped(value, buffer);
357 break;
358 }
359
360 case ControlCodes::int16_decimals:
361 {
362 int16_t value = args.pop<int16_t>();

Callers 2

formatCurrencyFunction · 0.85
formatStringImplFunction · 0.85

Calls 15

formatInt32GroupedFunction · 0.85
formatInt32UngroupedFunction · 0.85
formatIntWithTwoDecimalsFunction · 0.85
formatCurrencyFunction · 0.85
formatStringImplFunction · 0.85
formatDateDMYFullFunction · 0.85
formatDateMYFullFunction · 0.85
formatDateMYAbbrevFunction · 0.85
formatRawDateMYAbbrevFunction · 0.85
getStringFunction · 0.85
hpTokWFunction · 0.85

Tested by

no test coverage detected