TODO: Things would be much simpler if g_aProfileLine is just a container of std::string.
| 257 | |
| 258 | // TODO: Things would be much simpler if g_aProfileLine is just a container of std::string. |
| 259 | struct ProfileLine_t |
| 260 | { |
| 261 | ProfileLine_t() : buf(NULL), bufsz(0) {} |
| 262 | ProfileLine_t(char* _buf, size_t _bufsz) : buf(_buf), bufsz(_bufsz) {} |
| 263 | void Assign(std::string const& str) |
| 264 | { |
| 265 | if (!buf || bufsz <= 0) return; |
| 266 | strncpy_s(buf, bufsz, str.c_str(), _TRUNCATE); |
| 267 | } |
| 268 | ATTRIBUTE_FORMAT_PRINTF(2, 3) /* 1 is "this" */ |
| 269 | void Format(const char* fmt, ...) |
| 270 | { |
| 271 | if (!buf || bufsz <= 0) return; |
| 272 | va_list va; |
| 273 | va_start(va, fmt); |
| 274 | Assign(StrFormatV(fmt, va)); |
| 275 | va_end(va); |
| 276 | } |
| 277 | char* buf; |
| 278 | size_t bufsz; |
| 279 | }; |
| 280 | ProfileLine_t ProfileLinePeek ( int iLine ); |
| 281 | ProfileLine_t ProfileLinePush (); |
| 282 | void ProfileLineReset (); |