30 lines
820 B
C++
30 lines
820 B
C++
#ifndef UTILS_HPP
|
|
#define UTILS_HPP
|
|
|
|
#include <dirent.h>
|
|
#include <fcntl.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
|
|
#include <cstdint>
|
|
#include <cstdlib>
|
|
#include <filesystem>
|
|
#include <fstream>
|
|
#include <iomanip>
|
|
#include <print>
|
|
#include <sstream>
|
|
#include <string>
|
|
|
|
#define FILL_CHAR ' '
|
|
|
|
std::string pNum(double num, uint8_t decs = 0);
|
|
std::string pNum(float num, uint8_t decs = 0);
|
|
std::string pad(std::string s, uint8_t len, bool ljust = false);
|
|
std::string pBytes(double bytes, bool isKbytes = false);
|
|
std::string readFile(std::string path, size_t trim = 4096);
|
|
ssize_t readFile2(std::string path, char *buffer, size_t maxlen);
|
|
ssize_t readFile2(const char *path, char *buffer, size_t maxlen);
|
|
int get_val(const std::string &target, const std::string &content);
|
|
std::string getFirstDir(std::string path);
|
|
|
|
#endif |