Init commit

This commit is contained in:
2026-08-17 06:31:43 +09:00
commit 348d9275f6
428 changed files with 61806 additions and 0 deletions
+74
View File
@@ -0,0 +1,74 @@
#ifndef ZCPPWIN_TOOL_H
#define ZCPPWIN_TOOL_H
#include <string>
#include <filesystem>
#if _WIN32
#include <Windows.h>
#endif
#include "ztool_lib_macro.h"
// WINDOWS独享
namespace Z {
#if _WIN32
ZTOOL_API std::wstring HResultToWString(HRESULT hr);
#endif
}
// 字符串转换(UTF8 - WSTRING)
namespace Z {
#if _WIN32
ZTOOL_API std::string wstring_to_u8(const std::wstring &wstr);
ZTOOL_API std::wstring u8_to_wstring(const std::string &u8str);
#endif
}
// windows 文件操作相关
namespace Z {
#if _WIN32
ZTOOL_API std::filesystem::path get_module_path();
ZTOOL_API std::filesystem::path get_module_dir();
#endif
}
// 随机数
namespace Z {
class ZTOOL_API Random {
public:
Random() = delete;
// 产生[min,max]的随机整数
static int Get(int min, int max);
// 产生[min,max)的随机小数
static float Get(float min, float max);
// 产生[min,max)的随机小数
static double Get(double min, double max);
// 重新产生随机种子
static void GenerateSequence();
// 重新产生固定种子
static void GenerateSequence(uint32_t seed);
private:
static bool bInitialized;
static unsigned int m_seed;
static void *m_gen;
static void InitOnce();
static void GenSequence();
static void GenSequence(uint32_t seed);
static void CleanUp();
};
}
// 其他
namespace Z {
ZTOOL_API void print_obj_memory(const void *obj, size_t len);
}
#endif //ZCPPWIN_TOOL_H