MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / FormatStack

Function FormatStack

src/hx/Debug.cpp:154–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152
153
154String FormatStack(const char *file, const char *clazz, const char *func, int line, bool display)
155{
156 // Not sure if the following is even possible but the old debugger did it so ...
157 char buf[1024];
158 if (!file || file[0]=='?')
159 {
160 if (display)
161 snprintf(buf, sizeof(buf), "%s::%s", clazz, func);
162 else
163 snprintf(buf, sizeof(buf), "%s::%s::%d", clazz, func,line);
164 }
165 else
166 {
167 // Old-style combined file::class...
168 if (!clazz || !clazz[0])
169 {
170 if (line>0 || !display)
171 snprintf(buf, sizeof(buf), display ? "%s %s line %d" : "%s::%s::%d", func, file, line);
172 else
173 snprintf(buf, sizeof(buf), "%s %s", func, file);
174 }
175 else
176 {
177 if (line>0 || !display)
178 snprintf(buf, sizeof(buf), display ? "%s::%s %s line %d" : "%s::%s::%s::%d", clazz, func, file, line);
179 else
180 snprintf(buf, sizeof(buf), "%s::%s %s", clazz, func, file);
181 }
182 }
183 return ::String(buf);
184}
185
186
187

Callers 3

toDisplayMethod · 0.85
toStringMethod · 0.85
formatMethod · 0.85

Calls 1

StringClass · 0.50

Tested by

no test coverage detected