| 467 | } |
| 468 | |
| 469 | void EllipsiseInPlace(std::string& str, u32 max_length, const char* ellipsis /*= "..."*/) |
| 470 | { |
| 471 | const u32 str_length = static_cast<u32>(str.length()); |
| 472 | const u32 ellipsis_len = static_cast<u32>(std::strlen(ellipsis)); |
| 473 | pxAssert(ellipsis_len > 0 && ellipsis_len <= max_length); |
| 474 | |
| 475 | if (str_length > max_length) |
| 476 | { |
| 477 | const u32 keep_size = std::min(static_cast<u32>(str.length()), max_length - ellipsis_len); |
| 478 | if (keep_size != str_length) |
| 479 | str.erase(keep_size); |
| 480 | |
| 481 | str.append(ellipsis); |
| 482 | } |
| 483 | } |
| 484 | |
| 485 | #ifdef _WIN32 |
| 486 | std::wstring UTF8StringToWideString(const std::string_view str) |