MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / human_readable_formatting

Function human_readable_formatting

src/simulate/debug_print.cpp:9–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7namespace das {
8
9 string human_readable_formatting ( const string & str ) {
10 string result;
11 string tab;
12 auto it = str.begin();
13 auto tail = str.end();
14 while ( it != tail ) {
15 while ( it!=tail && *it==' ') {
16 it ++;
17 }
18 while ( it!=tail && *it!='\n' ) {
19 auto Ch = *it;
20 result += Ch;
21 if ( Ch=='[' || Ch=='(' || Ch=='{' ) tab += " ";
22 else if ( Ch==']' || Ch==')' || Ch=='}' ) {
23 if ( tab.size()>=2 ) tab.resize(tab.size()-2); // note: we don't track mismatch
24 }
25 it ++;
26 }
27 if ( it == tail ) break;
28 while ( it!=tail && *it=='\n' ) {
29 it ++;
30 }
31 result += "\n";
32 result += tab;
33 }
34 return result;
35 }
36
37 string debug_value ( const void * pX, TypeInfo * info, PrintFlags flags ) {
38 TextWriter ss;

Callers 1

debug_valueFunction · 0.85

Calls 4

resizeMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected