bunch of shit clang-tidy and clion made me do

This commit is contained in:
2026-01-01 16:36:15 +01:00
parent 6f8e2e2abd
commit f871dbd2e8
9 changed files with 57 additions and 55 deletions

View File

@@ -8,7 +8,7 @@
namespace utils {
const char FILL_CHAR = ' ';
constexpr char fill_char = ' ';
enum just { right,
left };
@@ -16,21 +16,23 @@ enum just { right,
std::string pad(std::string s, uint8_t len, just j = just::right);
std::string center(std::string str, uint8_t len);
std::string pBytes(double bytes, bool isKbytes = false);
ssize_t readFile(std::string path, char* buffer, size_t maxlen);
ssize_t readFile(const std::string& path, char* buffer, size_t maxlen);
ssize_t readFile(const char* path, char* buffer, size_t maxlen);
std::string getFirstDir(std::string_view path);
std::string getFirstDir(const std::string_view& path);
template <size_t N>
inline long long fastReadNum(const std::string& path, char (&buf)[N]) {
inline int fastReadNum(const std::string& path, char (&buf)[N]) {
readFile(path, buf, N);
return std::strtoll(buf, nullptr, 10);
int ret = 0;
std::from_chars(buf, buf + N, ret);
return ret;
}
inline std::string pNum(auto num, uint8_t decs = 0) {
return std::format("{:.{}f}", num, decs);
}
inline bool fileExists(std::string_view path) {
inline bool fileExists(const std::string_view& path) {
return std::filesystem::exists(path);
}