aboutsummaryrefslogtreecommitdiff
path: root/src/util/common.h
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2025-01-15 19:12:12 +0800
committerMistivia <i@mistivia.com>2025-01-15 19:12:46 +0800
commit4da382953c830a61ae24ccbe95c4241db8788269 (patch)
tree31f6d184273274e2660516d1ac1146b5661f20b6 /src/util/common.h
restore
Diffstat (limited to 'src/util/common.h')
-rw-r--r--src/util/common.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/util/common.h b/src/util/common.h
new file mode 100644
index 0000000..4ec4c4a
--- /dev/null
+++ b/src/util/common.h
@@ -0,0 +1,33 @@
+#ifndef HIVE_MIND_UTIL_COMMON_H_
+#define HIVE_MIND_UTIL_COMMON_H_
+
+#include <exception>
+#include <memory>
+#include <variant>
+#include <vector>
+#include <random>
+#include <string>
+#include <mutex>
+
+template<typename T>
+using Arc = std::shared_ptr<T>;
+
+template<typename T>
+using Box = std::unique_ptr<T>;
+
+using ulock = std::unique_lock<std::mutex>;
+using std::make_shared;
+using std::make_unique;
+
+struct Void{};
+
+std::string gen_random();
+std::string url_encode(const std::string &s);
+std::string url_decode(const std::string &s);
+std::string html_encode(const std::string& data);
+
+void load_text_resource(std::string filename, std::string key);
+const std::string &get_text_resource(std::string key);
+void str_replace(std::string& str, const std::string& from, const std::string& to);
+
+#endif