21 #ifndef __ANTARES_LIBS_UTILS_H__
22 #define __ANTARES_LIBS_UTILS_H__
29 #include <yuni/yuni.h>
30 #include <yuni/core/string.h>
39 template<
class StringT>
40 void TransformNameIntoID(
const AnyString& name, StringT& out);
41 std::string transformNameIntoID(
const std::string& name);
43 std::tm getCurrentTime();
44 std::string formatTime(
const std::tm& localTime,
const std::string& format);
49 void BeautifyName(YString& out, AnyString oldname);
50 void BeautifyName(std::string& out,
const std::string& oldname);
52 std::vector<std::pair<std::string, std::string>> splitStringIntoPairs(
const std::string& s,
59 bool isZero(
double d);
60 double round(
double d,
unsigned precision);
61 double ceil(
double d);
62 double floor(
double d);
64 bool isPathValid(
const std::string& path);
66 std::map<std::string, unsigned> giveNumbersToStrings(
const std::vector<std::string>& strs);
67 bool checkAllElementsIdenticalOrOne(std::vector<unsigned> w);
68 bool checkAllElementsIdenticalOrOne(std::vector<std::pair<unsigned, std::string>>& p);
72 using clock = std::chrono::steady_clock;
77 long duration_ms()
const;
78 std::string toString()
const;
79 std::string toStringInSeconds()
const;
83 clock::time_point start_;
84 clock::time_point end_;