| | |
| | | #pragma once |
| | | #include <string> |
| | | #include <chrono> |
| | | #include <optional> |
| | | #include <utility> |
| | | #include <vector> |
| | | #include <cstdarg> |
| | | |
| | | enum class QuickRange { Today, Last7Days, ThisMonth, ThisYear }; |
| | | using TP = std::chrono::system_clock::time_point; |
| | | class CToolUnits |
| | | { |
| | | public: |
| | |
| | | static CString& floatToString1(float value, CString& strOut); |
| | | static CString& floatToString3(float value, CString& strOut); |
| | | static ULONGLONG getTimestamp(); |
| | | static time_t getUnixTimestamp(); |
| | | static void createDir(const char* pszDir); |
| | | static BOOL copyTextToClipboard(CWnd* pWnd, const CString& strText); |
| | | static std::string getCurrentExePath(); |
| | |
| | | static std::vector<CString> GetFileNamesInDirectory(const CString& strFolderPath, const CString& strExtension); |
| | | static std::string getRecipePath(); |
| | | static std::string getCurrentTimeString(); |
| | | static bool startsWith(const std::string& str, const std::string& prefix); |
| | | static std::string& toHexString(int value, std::string& strOut); |
| | | static void convertString(const char* pszBuffer, int size, std::string& strOut); |
| | | static inline std::chrono::system_clock::time_point FileTimeToTimePointUTC(const FILETIME& ftUtc); |
| | | static bool GetCtrlTimeUtc(const CDateTimeCtrl& ctrl, |
| | | std::chrono::system_clock::time_point& outUtc); |
| | | static bool GetCtrlDateRangeUtc_StartOfDay(const CDateTimeCtrl& ctrl, |
| | | std::chrono::system_clock::time_point& outUtc); |
| | | static bool GetCtrlDateRangeUtc_EndOfDay(const CDateTimeCtrl& ctrl, |
| | | std::chrono::system_clock::time_point& outUtc); |
| | | static std::chrono::system_clock::time_point CToolUnits::LocalSTtoUtcTP(const SYSTEMTIME& stLocal); |
| | | static SYSTEMTIME CToolUnits::MakeLocalST(int y, int m, int d, int hh, int mi, int ss, int ms); |
| | | static bool IsLeap(int y); |
| | | static int DaysInMonth(int y, int m); |
| | | static void GetTodayYMD_Local(int& y, int& m, int& d); |
| | | static void LocalCalendarMinusDays(int& y, int& m, int& d, int nDays); |
| | | static std::pair<std::chrono::system_clock::time_point, |
| | | std::chrono::system_clock::time_point> |
| | | CalcQuickRangeUtc(QuickRange r); |
| | | static bool containsCI(const std::string& hay, const std::string& needle); |
| | | static std::string TimePointToLocalString(const std::optional<TP>& tp, |
| | | const char* fmt = "%Y-%m-%d %H:%M:%S"); |
| | | static std::string TimePointToUtcString(const std::optional<TP>& tp, |
| | | const char* fmt = "%Y-%m-%d %H:%M:%S"); |
| | | static std::string TimePointToLocalStringMs(const std::optional<TP>& tp); |
| | | static std::string NowStrSec(); |
| | | static std::wstring AnsiToWString(const std::string& str); |
| | | static std::string WStringToAnsi(const std::wstring& wstr); |
| | | static std::string formatString(const char* fmt, ...); |
| | | }; |
| | | |