| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,12 @@ | ||
| add_rules("mode.debug", "mode.release") | ||
|
|
||
| add_requires("gtest", {optional = true}) | ||
|
|
||
| target("PluginUtils") | ||
| set_kind("static") | ||
| set_languages("cxx20") | ||
| set_policy("build.warning", true) | ||
|
|
||
| add_headerfiles("src/**.h", { public = true }) | ||
| add_includedirs("src/", {public = true}) | ||
| add_includedirs("src/", {public = true}) | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| #pragma once | ||
|
|
||
| #include "spdlog/spdlog.h" | ||
|
|
||
| namespace ES::Utils::Log { | ||
| using Level = spdlog::level::level_enum; | ||
|
|
||
| template <typename T> inline void Debug(const T &msg) { spdlog::debug(msg); }; | ||
|
|
||
| template <typename T> inline void Info(const T &msg) { spdlog::info(msg); }; | ||
|
|
||
| template <typename T> inline void Warn(const T &msg) { spdlog::warn(msg); }; | ||
|
|
||
| template <typename T> inline void Error(const T &msg) { spdlog::error(msg); }; | ||
|
|
||
| template <typename T> inline void Critical(const T &msg) { spdlog::critical(msg); }; | ||
|
|
||
| template <typename T> inline void Trace(const T &msg) { spdlog::trace(msg); }; | ||
|
|
||
| template <typename T> inline void Log(Level level, const T &msg) | ||
| { | ||
| if (level == Level::info) | ||
| Log::Info(msg); | ||
| else if (level == Level::warn) | ||
| Log::Warn(msg); | ||
| else if (level == Level::err) | ||
| Log::Error(msg); | ||
| else if (level == Level::critical) | ||
| Log::Critical(msg); | ||
| else if (level == Level::debug) | ||
| Log::Debug(msg); | ||
| else | ||
| Log::Trace(msg); | ||
| }; | ||
|
|
||
| inline void SetPattern(const std::string &pattern, | ||
| spdlog::pattern_time_type time_type = spdlog::pattern_time_type::local) | ||
| { | ||
| spdlog::set_pattern(pattern, time_type); | ||
| }; | ||
| } // namespace ES::Utils::Log |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| add_rules("mode.debug", "mode.release") | ||
| add_requires("spdlog") | ||
| set_languages("cxx20") | ||
|
|
||
| target("UtilsLog") | ||
| set_kind("static") | ||
| add_packages("spdlog") | ||
|
|
||
| add_files("src/**.cpp") | ||
| add_includedirs("src/", {public = true}) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #include <sstream> | ||
|
|
||
| #include "String.hpp" | ||
|
|
||
| std::vector<std::string> ES::Plugin::Utils::String::Split(const std::string &str, const char &delimiter) | ||
| { | ||
| std::vector<std::string> result; | ||
| std::string token; | ||
| std::istringstream tokenStream(str); | ||
| while (std::getline(tokenStream, token, delimiter)) | ||
| { | ||
| result.push_back(token); | ||
| } | ||
| return std::move(result); | ||
| } | ||
|
|
||
| bool ES::Plugin::Utils::String::EndsWith(const std::string &str, const std::string &suffix) | ||
| { | ||
| return str.size() >= suffix.size() && 0 == str.compare(str.size() - suffix.size(), suffix.size(), suffix); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| namespace ES::Plugin::Utils::String { | ||
| /** | ||
| * @brief Split a string by a delimiter | ||
| * | ||
| * @param str The string to split | ||
| * @param delimiter The delimiter to split by | ||
| * @return std::vector<std::string> The split string | ||
| */ | ||
| std::vector<std::string> Split(const std::string &str, const char &delimiter); | ||
|
|
||
| /** | ||
| * @brief Check if a string ends with a suffix | ||
| * | ||
| * @param str The string to check | ||
| * @param suffix The suffix to check for | ||
| * @return bool True if the string ends with the suffix, false otherwise | ||
| */ | ||
| bool EndsWith(const std::string &str, const std::string &suffix); | ||
| } // namespace ES::Plugin::Utils::String |
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.